Test  Status  Code Input and Output 

1  Pass 
x =4000000
y_correct = 4613732;
assert(isequal(euler002(x),y_correct))
x =
4000000
first =
2
second =
0
y =
2
next =
8
second =
2
first =
8
y =
10
next =
34
second =
8
first =
34
y =
44
next =
144
second =
34
first =
144
y =
188
next =
610
second =
144
first =
610
y =
798
next =
2584
second =
610
first =
2584
y =
3382
next =
10946
second =
2584
first =
10946
y =
14328
next =
46368
second =
10946
first =
46368
y =
60696
next =
196418
second =
46368
first =
196418
y =
257114
next =
832040
second =
196418
first =
832040
y =
1089154
next =
3524578
second =
832040
first =
3524578
y =
4613732

2  Pass 
x =97455000
y_correct = 82790070;
assert(isequal(euler002(x),y_correct))
x =
97455000
first =
2
second =
0
y =
2
next =
8
second =
2
first =
8
y =
10
next =
34
second =
8
first =
34
y =
44
next =
144
second =
34
first =
144
y =
188
next =
610
second =
144
first =
610
y =
798
next =
2584
second =
610
first =
2584
y =
3382
next =
10946
second =
2584
first =
10946
y =
14328
next =
46368
second =
10946
first =
46368
y =
60696
next =
196418
second =
46368
first =
196418
y =
257114
next =
832040
second =
196418
first =
832040
y =
1089154
next =
3524578
second =
832040
first =
3524578
y =
4613732
next =
14930352
second =
3524578
first =
14930352
y =
19544084
next =
63245986
second =
14930352
first =
63245986
y =
82790070
next =
267914296
second =
63245986
first =
267914296

3  Pass 
x =597455000
y_correct = 350704366;
assert(isequal(euler002(x),y_correct))
x =
597455000
first =
2
second =
0
y =
2
next =
8
second =
2
first =
8
y =
10
next =
34
second =
8
first =
34
y =
44
next =
144
second =
34
first =
144
y =
188
next =
610
second =
144
first =
610
y =
798
next =
2584
second =
610
first =
2584
y =
3382
next =
10946
second =
2584
first =
10946
y =
14328
next =
46368
second =
10946
first =
46368
y =
60696
next =
196418
second =
46368
first =
196418
y =
257114
next =
832040
second =
196418
first =
832040
y =
1089154
next =
3524578
second =
832040
first =
3524578
y =
4613732
next =
14930352
second =
3524578
first =
14930352
y =
19544084
next =
63245986
second =
14930352
first =
63245986
y =
82790070
next =
267914296
second =
63245986
first =
267914296
y =
350704366
next =
1.1349e+09
second =
267914296
first =
1.1349e+09

4  Pass 
x =666576
y_correct = 257114;
assert(isequal(euler002(x),y_correct))
x =
666576
first =
2
second =
0
y =
2
next =
8
second =
2
first =
8
y =
10
next =
34
second =
8
first =
34
y =
44
next =
144
second =
34
first =
144
y =
188
next =
610
second =
144
first =
610
y =
798
next =
2584
second =
610
first =
2584
y =
3382
next =
10946
second =
2584
first =
10946
y =
14328
next =
46368
second =
10946
first =
46368
y =
60696
next =
196418
second =
46368
first =
196418
y =
257114
next =
832040
second =
196418
first =
832040

295 Solvers
289 Solvers
206 Solvers
Square Digits Number Chain Terminal Value (Inspired by Project Euler Problem 92)
162 Solvers
157 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!