Cody

# Problem 1084. Square Digits Number Chain Terminal Value (Inspired by Project Euler Problem 92)

Solution 3081461

Submitted on 6 Oct 2020 by sachin kansal
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
assert(digits_squared_chain(649) == 1)

a = '649' l = 3 g = 0 b = 36 g = 36 b = 16 g = 52 b = 81 g = 133 x = 133 a = '133' l = 3 g = 0 b = 1 g = 1 b = 9 g = 10 b = 9 g = 19 x = 19 a = '19' l = 2 g = 0 b = 1 g = 1 b = 81 g = 82 x = 82 a = '82' l = 2 g = 0 b = 64 g = 64 b = 4 g = 68 x = 68 a = '68' l = 2 g = 0 b = 36 g = 36 b = 64 g = 100 x = 100 a = '100' l = 3 g = 0 b = 1 g = 1 b = 0 g = 1 b = 0 g = 1 x = 1 y = 1

2   Pass
assert(digits_squared_chain(79) == 1)

a = '79' l = 2 g = 0 b = 49 g = 49 b = 81 g = 130 x = 130 a = '130' l = 3 g = 0 b = 1 g = 1 b = 9 g = 10 b = 0 g = 10 x = 10 a = '10' l = 2 g = 0 b = 1 g = 1 b = 0 g = 1 x = 1 y = 1

3   Pass
assert(digits_squared_chain(608) == 1)

a = '608' l = 3 g = 0 b = 36 g = 36 b = 0 g = 36 b = 64 g = 100 x = 100 a = '100' l = 3 g = 0 b = 1 g = 1 b = 0 g = 1 b = 0 g = 1 x = 1 y = 1

4   Pass
assert(digits_squared_chain(487) == 1)

a = '487' l = 3 g = 0 b = 16 g = 16 b = 64 g = 80 b = 49 g = 129 x = 129 a = '129' l = 3 g = 0 b = 1 g = 1 b = 4 g = 5 b = 81 g = 86 x = 86 a = '86' l = 2 g = 0 b = 64 g = 64 b = 36 g = 100 x = 100 a = '100' l = 3 g = 0 b = 1 g = 1 b = 0 g = 1 b = 0 g = 1 x = 1 y = 1

5   Pass
assert(digits_squared_chain(739) == 1)

a = '739' l = 3 g = 0 b = 49 g = 49 b = 9 g = 58 b = 81 g = 139 x = 139 a = '139' l = 3 g = 0 b = 1 g = 1 b = 9 g = 10 b = 81 g = 91 x = 91 a = '91' l = 2 g = 0 b = 81 g = 81 b = 1 g = 82 x = 82 a = '82' l = 2 g = 0 b = 64 g = 64 b = 4 g = 68 x = 68 a = '68' l = 2 g = 0 b = 36 g = 36 b = 64 g = 100 x = 100 a = '100' l = 3 g = 0 b = 1 g = 1 b = 0 g = 1 b = 0 g = 1 x = 1 y = 1

6   Pass
assert(digits_squared_chain(565) == 1)

a = '565' l = 3 g = 0 b = 25 g = 25 b = 36 g = 61 b = 25 g = 86 x = 86 a = '86' l = 2 g = 0 b = 64 g = 64 b = 36 g = 100 x = 100 a = '100' l = 3 g = 0 b = 1 g = 1 b = 0 g = 1 b = 0 g = 1 x = 1 y = 1

7   Pass
assert(digits_squared_chain(68) == 1)

a = '68' l = 2 g = 0 b = 36 g = 36 b = 64 g = 100 x = 100 a = '100' l = 3 g = 0 b = 1 g = 1 b = 0 g = 1 b = 0 g = 1 x = 1 y = 1

8   Pass
assert(digits_squared_chain(383) == 1)

a = '383' l = 3 g = 0 b = 9 g = 9 b = 64 g = 73 b = 9 g = 82 x = 82 a = '82' l = 2 g = 0 b = 64 g = 64 b = 4 g = 68 x = 68 a = '68' l = 2 g = 0 b = 36 g = 36 b = 64 g = 100 x = 100 a = '100' l = 3 g = 0 b = 1 g = 1 b = 0 g = 1 b = 0 g = 1 x = 1 y = 1

9   Pass
assert(digits_squared_chain(379) == 1)

a = '379' l = 3 g = 0 b = 9 g = 9 b = 49 g = 58 b = 81 g = 139 x = 139 a = '139' l = 3 g = 0 b = 1 g = 1 b = 9 g = 10 b = 81 g = 91 x = 91 a = '91' l = 2 g = 0 b = 81 g = 81 b = 1 g = 82 x = 82 a = '82' l = 2 g = 0 b = 64 g = 64 b = 4 g = 68 x = 68 a = '68' l = 2 g = 0 b = 36 g = 36 b = 64 g = 100 x = 100 a = '100' l = 3 g = 0 b = 1 g = 1 b = 0 g = 1 b = 0 g = 1 x = 1 y = 1

10   Pass
assert(digits_squared_chain(203) == 1)

a = '203' l = 3 g = 0 b = 4 g = 4 b = 0 g = 4 b = 9 g = 13 x = 13 a = '13' l = 2 g = 0 b = 1 g = 1 b = 9 g = 10 x = 10 a = '10' l = 2 g = 0 b = 1 g = 1 b = 0 g = 1 x = 1 y = 1

11   Pass
assert(digits_squared_chain(632) == 1)

a = '632' l = 3 g = 0 b = 36 g = 36 b = 9 g = 45 b = 4 g = 49 x = 49 a = '49' l = 2 g = 0 b = 16 g = 16 b = 81 g = 97 x = 97 a = '97' l = 2 g = 0 b = 81 g = 81 b = 49 g = 130 x = 130 a = '130' l = 3 g = 0 b = 1 g = 1 b = 9 g = 10 b = 0 g = 10 x = 10 a = '10' l = 2 g = 0 b = 1 g = 1 b = 0 g = 1 x = 1 y = 1

12   Pass
assert(digits_squared_chain(391) == 1)

a = '391' l = 3 g = 0 b = 9 g = 9 b = 81 g = 90 b = 1 g = 91 x = 91 a = '91' l = 2 g = 0 b = 81 g = 81 b = 1 g = 82 x = 82 a = '82' l = 2 g = 0 b = 64 g = 64 b = 4 g = 68 x = 68 a = '68' l = 2 g = 0 b = 36 g = 36 b = 64 g = 100 x = 100 a = '100' l = 3 g = 0 b = 1 g = 1 b = 0 g = 1 b = 0 g = 1 x = 1 y = 1

13   Pass
assert(digits_squared_chain(863) == 1)

a = '863' l = 3 g = 0 b = 64 g = 64 b = 36 g = 100 b = 9 g = 109 x = 109 a = '109' l = 3 g = 0 b = 1 g = 1 b = 0 g = 1 b = 81 g = 82 x = 82 a = '82' l = 2 g = 0 b = 64 g = 64 b = 4 g = 68 x = 68 a = '68' l = 2 g = 0 b = 36 g = 36 b = 64 g = 100 x = 100 a = '100' l = 3 g = 0 b = 1 g = 1 b = 0 g = 1 b = 0 g = 1 x = 1 y = 1

14   Pass
assert(digits_squared_chain(13) == 1)

a = '13' l = 2 g = 0 b = 1 g = 1 b = 9 g = 10 x = 10 a = '10' l = 2 g = 0 b = 1 g = 1 b = 0 g = 1 x = 1 y = 1

15   Pass
assert(digits_squared_chain(100) == 1)

a = '100' l = 3 g = 0 b = 1 g = 1 b = 0 g = 1 b = 0 g = 1 x = 1 y = 1

16   Pass
assert(digits_squared_chain(236) == 1)

a = '236' l = 3 g = 0 b = 4 g = 4 b = 9 g = 13 b = 36 g = 49 x = 49 a = '49' l = 2 g = 0 b = 16 g = 16 b = 81 g = 97 x = 97 a = '97' l = 2 g = 0 b = 81 g = 81 b = 49 g = 130 x = 130 a = '130' l = 3 g = 0 b = 1 g = 1 b = 9 g = 10 b = 0 g = 10 x = 10 a = '10' l = 2 g = 0 b = 1 g = 1 b = 0 g = 1 x = 1 y = 1

17   Pass
assert(digits_squared_chain(293) == 1)

a = '293' l = 3 g = 0 b = 4 g = 4 b = 81 g = 85 b = 9 g = 94 x = 94 a = '94' l = 2 g = 0 b = 81 g = 81 b = 16 g = 97 x = 97 a = '97' l = 2 g = 0 b = 81 g = 81 b = 49 g = 130 x = 130 a = '130' l = 3 g = 0 b = 1 g = 1 b = 9 g = 10 b = 0 g = 10 x = 10 a = '10' l = 2 g = 0 b = 1 g = 1 b = 0 g = 1 x = 1 y = 1

18   Pass
assert(digits_squared_chain(230) == 1)

a = '230' l = 3 g = 0 b = 4 g = 4 b = 9 g = 13 b = 0 g = 13 x = 13 a = '13' l = 2 g = 0 b = 1 g = 1 b = 9 g = 10 x = 10 a = '10' l = 2 g = 0 b = 1 g = 1 b = 0 g = 1 x = 1 y = 1

19   Pass
assert(digits_squared_chain(31) == 1)

a = '31' l = 2 g = 0 b = 9 g = 9 b = 1 g = 10 x = 10 a = '10' l = 2 g = 0 b = 1 g = 1 b = 0 g = 1 x = 1 y = 1

20   Pass
assert(digits_squared_chain(806) == 1)

a = '806' l = 3 g = 0 b = 64 g = 64 b = 0 g = 64 b = 36 g = 100 x = 100 a = '100' l = 3 g = 0 b = 1 g = 1 b = 0 g = 1 b = 0 g = 1 x = 1 y = 1

21   Pass
assert(digits_squared_chain(623) == 1)

a = '623' l = 3 g = 0 b = 36 g = 36 b = 4 g = 40 b = 9 g = 49 x = 49 a = '49' l = 2 g = 0 b = 16 g = 16 b = 81 g = 97 x = 97 a = '97' l = 2 g = 0 b = 81 g = 81 b = 49 g = 130 x = 130 a = '130' l = 3 g = 0 b = 1 g = 1 b = 9 g = 10 b = 0 g = 10 x = 10 a = '10' l = 2 g = 0 b = 1 g = 1 b = 0 g = 1 x = 1 y = 1

22   Pass
assert(digits_squared_chain(7) == 1)

a = '7' l = 1 g = 0 b = 49 g = 49 x = 49 a = '49' l = 2 g = 0 b = 16 g = 16 b = 81 g = 97 x = 97 a = '97' l = 2 g = 0 b = 81 g = 81 b = 49 g = 130 x = 130 a = '130' l = 3 g = 0 b = 1 g = 1 b = 9 g = 10 b = 0 g = 10 x = 10 a = '10' l = 2 g = 0 b = 1 g = 1 b = 0 g = 1 x = 1 y = 1

23   Pass
assert(digits_squared_chain(13) == 1)

a = '13' l = 2 g = 0 b = 1 g = 1 b = 9 g = 10 x = 10 a = '10' l = 2 g = 0 b = 1 g = 1 b = 0 g = 1 x = 1 y = 1

24   Pass
assert(digits_squared_chain(836) == 1)

a = '836' l = 3 g = 0 b = 64 g = 64 b = 9 g = 73 b = 36 g = 109 x = 109 a = '109' l = 3 g = 0 b = 1 g = 1 b = 0 g = 1 b = 81 g = 82 x = 82 a = '82' l = 2 g = 0 b = 64 g = 64 b = 4 g = 68 x = 68 a = '68' l = 2 g = 0 b = 36 g = 36 b = 64 g = 100 x = 100 a = '100' l = 3 g = 0 b = 1 g = 1 b = 0 g = 1 b = 0 g = 1 x = 1 y = 1

25   Pass
assert(digits_squared_chain(954) == 89)

a = '954' l = 3 g = 0 b = 81 g = 81 b = 25 g = 106 b = 16 g = 122 x = 122 a = '122' l = 3 g = 0 b = 1 g = 1 b = 4 g = 5 b = 4 g = 9 x = 9 a = '9' l = 1 g = 0 b = 81 g = 81 x = 81 a = '81' l = 2 g = 0 b = 64 g = 64 b = 1 g = 65 x = 65 a = '65' l = 2 g = 0 b = 36 g = 36 b = 25 g = 61 x = 61 a = '61' l = 2 g = 0 b = 36 g = 36 b = 1 g = 37 x = 37 a = '37' l = 2 g = 0 b = 9 g = 9 b = 49 g = 58 x = 58 a = '58' l = 2 g = 0 b = 25 g = 25 b = 64 g = 89 x = 89 y = 89

26   Pass
assert(digits_squared_chain(567) == 89)

a = '567' l = 3 g = 0 b = 25 g = 25 b = 36 g = 61 b = 49 g = 110 x = 110 a = '110' l = 3 g = 0 b = 1 g = 1 b = 1 g = 2 b = 0 g = 2 x = 2 a = '2' l = 1 g = 0 b = 4 g = 4 x = 4 a = '4' l = 1 g = 0 b = 16 g = 16 x = 16 a = '16' l = 2 g = 0 b = 1 g = 1 b = 36 g = 37 x = 37 a = '37' l = 2 g = 0 b = 9 g = 9 b = 49 g = 58 x = 58 a = '58' l = 2 g = 0 b = 25 g = 25 b = 64 g = 89 x = 89 y = 89

27   Pass
assert(digits_squared_chain(388) == 89)

a = '388' l = 3 g = 0 b = 9 g = 9 b = 64 g = 73 b = 64 g = 137 x = 137 a = '137' l = 3 g = 0 b = 1 g = 1 b = 9 g = 10 b = 49 g = 59 x = 59 a = '59' l = 2 g = 0 b = 25 g = 25 b = 81 g = 106 x = 106 a = '106' l = 3 g = 0 b = 1 g = 1 b = 0 g = 1 b = 36 g = 37 x = 37 a = '37' l = 2 g = 0 b = 9 g = 9 b = 49 g = 58 x = 58 a = '58' l = 2 g = 0 b = 25 g = 25 b = 64 g = 89 x = 89 y = 89

28   Pass
assert(digits_squared_chain(789) == 89)

a = '789' l = 3 g = 0 b = 49 g = 49 b = 64 g = 113 b = 81 g = 194 x = 194 a = '194' l = 3 g = 0 b = 1 g = 1 b = 81 g = 82 b = 16 g = 98 x = 98 a = '98' l = 2 g = 0 b = 81 g = 81 b = 64 g = 145 x = 145 a = '145' l = 3 g = 0 b = 1 g = 1 b = 16 g = 17 b = 25 g = 42 x = 42 a = '42' l = 2 g = 0 b = 16 g = 16 b = 4 g = 20 x = 20 a = '20' l = 2 g = 0 b = 4 g = 4 b = 0 g = 4 x = 4 a = '4' l = 1 g = 0 b = 16 g = 16 x = 16 a = '16' l = 2 g = 0 b = 1 g = 1 b = 36 g = 37 x = 37 a = '37' l = 2 g = 0 b = 9 g = 9 b = 49 g = 58 x = 58 a = '58' l = 2 g = 0 b = 25 g = 25 b = 64 g = 89 x = 89 y = 89

29   Pass
assert(digits_squared_chain(246) == 89)

a = '246' l = 3 g = 0 b = 4 g = 4 b = 16 g = 20 b = 36 g = 56 x = 56 a = '56' l = 2 g = 0 b = 25 g = 25 b = 36 g = 61 x = 61 a = '61' l = 2 g = 0 b = 36 g = 36 b = 1 g = 37 x = 37 a = '37' l = 2 g = 0 b = 9 g = 9 b = 49 g = 58 x = 58 a = '58' l = 2 g = 0 b = 25 g = 25 b = 64 g = 89 x = 89 y = 89

30   Pass
assert(digits_squared_chain(787) == 89)

a = '787' l = 3 g = 0 b = 49 g = 49 b = 64 g = 113 b = 49 g = 162 x = 162 a = '162' l = 3 g = 0 b = 1 g = 1 b = 36 g = 37 b = 4 g = 41 x = 41 a = '41' l = 2 g = 0 b = 16 g = 16 b = 1 g = 17 x = 17 a = '17' l = 2 g = 0 b = 1 g = 1 b = 49 g = 50 x = 50 a = '50' l = 2 g = 0 b = 25 g = 25 b = 0 g = 25 x = 25 a = '25' l = 2 g = 0 b = 4 g = 4 b = 25 g = 29 x = 29 a = '29' l = 2 g = 0 b = 4 g = 4 b = 81 g = 85 x = 85 a = '85' l = 2 g = 0 b = 64 g = 64 b = 25 g = 89 x = 89 y = 89

31   Pass
assert(digits_squared_chain(311) == 89)

a = '311' l = 3 g = 0 b = 9 g = 9 b = 1 g = 10 b = 1 g = 11 x = 11 a = '11' l = 2 g = 0 b = 1 g = 1 b = 1 g = 2 x = 2 a = '2' l = 1 g = 0 b = 4 g = 4 x = 4 a = '4' l = 1 g = 0 b = 16 g = 16 x = 16 a = '16' l = 2 g = 0 b = 1 g = 1 b = 36 g = 37 x = 37 a = '37' l = 2 g = 0 b = 9 g = 9 b = 49 g = 58 x = 58 a = '58' l = 2 g = 0 b = 25 g = 25 b = 64 g = 89 x = 89 y = 89

32   Pass
assert(digits_squared_chain(856) == 89)

a = '856' l = 3 g = 0 b = 64 g = 64 b = 25 g = 89 b = 36 g = 125 x = 125 a = '125' l = 3 g = 0 b = 1 g = 1 b = 4 g = 5 b = 25 g = 30 x = 30 a = '30' l = 2 g = 0 b = 9 g = 9 b = 0 g = 9 x = 9 a = '9' l = 1 g = 0 b = 81 g = 81 x = 81 a = '81' l = 2 g = 0 b = 64 g = 64 b = 1 g = 65 x = 65 a = '65' l = 2 g = 0 b = 36 g = 36 b = 25 g = 61 x = 61 a = '61' l = 2 g = 0 b = 36 g = 36 b = 1 g = 37 x = 37 a = '37' l = 2 g = 0 b = 9 g = 9 b = 49 g = 58 x = 58 a = '58' l = 2 g = 0 b = 25 g = 25 b = 64 g = 89 x = 89 y = 89

33   Pass
assert(digits_squared_chain(143) == 89)

a = '143' l = 3 g = 0 b = 1 g = 1 b = 16 g = 17 b = 9 g = 26 x = 26 a = '26' l = 2 g = 0 b = 4 g = 4 b = 36 g = 40 x = 40 a = '40' l = 2 g = 0 b = 16 g = 16 b = 0 g = 16 x = 16 a = '16' l = 2 g = 0 b = 1 g = 1 b = 36 g = 37 x = 37 a = '37' l = 2 g = 0 b = 9 g = 9 b = 49 g = 58 x = 58 a = '58' l = 2 g = 0 b = 25 g = 25 b = 64 g = 89 x = 89 y = 89

34   Pass
assert(digits_squared_chain(873) == 89)

a = '873' l = 3 g = 0 b = 64 g = 64 b = 49 g = 113 b = 9 g = 122 x = 122 a = '122' l = 3 g = 0 b = 1 g = 1 b = 4 g = 5 b = 4 g = 9 x = 9 a = '9' l = 1 g = 0 b = 81 g = 81 x = 81 a = '81' l = 2 g = 0 b = 64 g = 64 b = 1 g = 65 x = 65 a = '65' l = 2 g = 0 b = 36 g = 36 b = 25 g = 61 x = 61 a = '61' l = 2 g = 0 b = 36 g = 36 b = 1 g = 37 x = 37 a = '37' l = 2 g = 0 b = 9 g = 9 b = 49 g = 58 x = 58 a = '58' l = 2 g = 0 b = 25 g = 25 b = 64 g = 89 x = 89 y = 89

35   Pass
assert(digits_squared_chain(215) == 89)

a = '215' l = 3 g = 0 b = 4 g = 4 b = 1 g = 5 b = 25 g = 30 x = 30 a = '30' l = 2 g = 0 b = 9 g = 9 b = 0 g = 9 x = 9 a = '9' l = 1 g = 0 b = 81 g = 81 x = 81 a = '81' l = 2 g = 0 b = 64 g = 64 b = 1 g = 65 x = 65 a = '65' l = 2 g = 0 b = 36 g = 36 b = 25 g = 61 x = 61 a = '61' l = 2 g = 0 b = 36 g = 36 b = 1 g = 37 x = 37 a = '37' l = 2 g = 0 b = 9 g = 9 b = 49 g = 58 x = 58 a = '58' l = 2 g = 0 b = 25 g = 25 b = 64 g = 89 x = 89 y = 89

36   Pass
assert(digits_squared_chain(995) == 89)

a = '995' l = 3 g = 0 b = 81 g = 81 b = 81 g = 162 b = 25 g = 187 x = 187 a = '187' l = 3 g = 0 b = 1 g = 1 b = 64 g = 65 b = 49 g = 114 x = 114 a = '114' l = 3 g = 0 b = 1 g = 1 b = 1 g = 2 b = 16 g = 18 x = 18 a = '18' l = 2 g = 0 b = 1 g = 1 b = 64 g = 65 x = 65 a = '65' l = 2 g = 0 b = 36 g = 36 b = 25 g = 61 x = 61 a = '61' l = 2 g = 0 b = 36 g = 36 b = 1 g = 37 x = 37 a = '37' l = 2 g = 0 b = 9 g = 9 b = 49 g = 58 x = 58 a = '58' l = 2 g = 0 b = 25 g = 25 b = 64 g = 89 x = 89 y = 89

37   Pass
assert(digits_squared_chain(455) == 89)

a = '455' l = 3 g = 0 b = 16 g = 16 b = 25 g = 41 b = 25 g = 66 x = 66 a = '66' l = 2 g = 0 b = 36 g = 36 b = 36 g = 72 x = 72 a = '72' l = 2 g = 0 b = 49 g = 49 b = 4 g = 53 x = 53 a = '53' l = 2 g = 0 b = 25 g = 25 b = 9 g = 34 x = 34 a = '34' l = 2 g = 0 b = 9 g = 9 b = 16 g = 25 x = 25 a = '25' l = 2 g = 0 b = 4 g = 4 b = 25 g = 29 x = 29 a = '29' l = 2 g = 0 b = 4 g = 4 b = 81 g = 85 x = 85 a = '85' l = 2 g = 0 b = 64 g = 64 b = 25 g = 89 x = 89 y = 89

38   Pass
assert(digits_squared_chain(948) == 89)

a = '948' l = 3 g = 0 b = 81 g = 81 b = 16 g = 97 b = 64 g = 161 x = 161 a = '161' l = 3 g = 0 b = 1 g = 1 b = 36 g = 37 b = 1 g = 38 x = 38 a = '38' l = 2 g = 0 b = 9 g = 9 b = 64 g = 73 x = 73 a = '73' l = 2 g = 0 b = 49 g = 49 b = 9 g = 58 x = 58 a = '58' l = 2 g = 0 b = 25 g = 25 b = 64 g = 89 x = 89 y = 89

39   Pass
assert(digits_squared_chain(875) == 89)

a = '875' l = 3 g = 0 b = 64 g = 64 b = 49 g = 113 b = 25 g = 138 x = 138 a = '138' l = 3 g = 0 b = 1 g = 1 b = 9 g = 10 b = 64 g = 74 x = 74 a = '74' l = 2 g = 0 b = 49 g = 49 b = 16 g = 65 x = 65 a = '65' l = 2 g = 0 b = 36 g = 36 b = 25 g = 61 x = 61 a = '61' l = 2 g = 0 b = 36 g = 36 b = 1 g = 37 x = 37 a = '37' l = 2 g = 0 b = 9 g = 9 b = 49 g = 58 x = 58 a = '58' l = 2 g = 0 b = 25 g = 25 b = 64 g = 89 x = 89 y = 89

40   Pass
assert(digits_squared_chain(788) == 89)

a = '788' l = 3 g = 0 b = 49 g = 49 b = 64 g = 113 b = 64 g = 177 x = 177 a = '177' l = 3 g = 0 b = 1 g = 1 b = 49 g = 50 b = 49 g = 99 x = 99 a = '99' l = 2 g = 0 b = 81 g = 81 b = 81 g = 162 x = 162 a = '162' l = 3 g = 0 b = 1 g = 1 b = 36 g = 37 b = 4 g = 41 x = 41 a = '41' l = 2 g = 0 b = 16 g = 16 b = 1 g = 17 x = 17 a = '17' l = 2 g = 0 b = 1 g = 1 b = 49 g = 50 x = 50 a = '50' l = 2 g = 0 b = 25 g = 25 b = 0 g = 25 x = 25 a = '25' l = 2 g = 0 b = 4 g = 4 b = 25 g = 29 x = 29 a = '29' l = 2 g = 0 b = 4 g = 4 b = 81 g = 85 x = 85 a = '85' l = 2 g = 0 b = 64 g = 64 b = 25 g = 89 x = 89 y = 89

41   Pass
assert(digits_squared_chain(722) == 89)

a = '722' l = 3 g = 0 b = 49 g = 49 b = 4 g = 53 b = 4 g = 57 x = 57 a = '57' l = 2 g = 0 b = 25 g = 25 b = 49 g = 74 x = 74 a = '74' l = 2 g = 0 b = 49 g = 49 b = 16 g = 65 x = 65 a = '65' l = 2 g = 0 b = 36 g = 36 b = 25 g = 61 x = 61 a = '61' l = 2 g = 0 b = 36 g = 36 b = 1 g = 37 x = 37 a = '37' l = 2 g = 0 b = 9 g = 9 b = 49 g = 58 x = 58 a = '58' l = 2 g = 0 b = 25 g = 25 b = 64 g = 89 x = 89 y = 89

42   Pass
assert(digits_squared_chain(250) == 89)

a = '250' l = 3 g = 0 b = 4 g = 4 b = 25 g = 29 b = 0 g = 29 x = 29 a = '29' l = 2 g = 0 b = 4 g = 4 b = 81 g = 85 x = 85 a = '85' l = 2 g = 0 b = 64 g = 64 b = 25 g = 89 x = 89 y = 89

43   Pass
assert(digits_squared_chain(227) == 89)

a = '227' l = 3 g = 0 b = 4 g = 4 b = 4 g = 8 b = 49 g = 57 x = 57 a = '57' l = 2 g = 0 b = 25 g = 25 b = 49 g = 74 x = 74 a = '74' l = 2 g = 0 b = 49 g = 49 b = 16 g = 65 x = 65 a = '65' l = 2 g = 0 b = 36 g = 36 b = 25 g = 61 x = 61 a = '61' l = 2 g = 0 b = 36 g = 36 b = 1 g = 37 x = 37 a = '37' l = 2 g = 0 b = 9 g = 9 b = 49 g = 58 x = 58 a = '58' l = 2 g = 0 b = 25 g = 25 b = 64 g = 89 x = 89 y = 89

44   Pass
assert(digits_squared_chain(640) == 89)

a = '640' l = 3 g = 0 b = 36 g = 36 b = 16 g = 52 b = 0 g = 52 x = 52 a = '52' l = 2 g = 0 b = 25 g = 25 b = 4 g = 29 x = 29 a = '29' l = 2 g = 0 b = 4 g = 4 b = 81 g = 85 x = 85 a = '85' l = 2 g = 0 b = 64 g = 64 b = 25 g = 89 x = 89 y = 89

45   Pass
assert(digits_squared_chain(835) == 89)

a = '835' l = 3 g = 0 b = 64 g = 64 b = 9 g = 73 b = 25 g = 98 x = 98 a = '98' l = 2 g = 0 b = 81 g = 81 b = 64 g = 145 x = 145 a = '145' l = 3 g = 0 b = 1 g = 1 b = 16 g = 17 b = 25 g = 42 x = 42 a = '42' l = 2 g = 0 b = 16 g = 16 b = 4 g = 20 x = 20 a = '20' l = 2 g = 0 b = 4 g = 4 b = 0 g = 4 x = 4 a = '4' l = 1 g = 0 b = 16 g = 16 x = 16 a = '16' l = 2 g = 0 b = 1 g = 1 b = 36 g = 37 x = 37 a = '37' l = 2 g = 0 b = 9 g = 9 b = 49 g = 58 x = 58 a = '58' l = 2 g = 0 b = 25 g = 25 b = 64 g = 89 x = 89 y = 89

46   Pass
assert(digits_squared_chain(965) == 89)

a = '965' l = 3 g = 0 b = 81 g = 81 b = 36 g = 117 b = 25 g = 142 x = 142 a = '142' l = 3 g = 0 b = 1 g = 1 b = 16 g = 17 b = 4 g = 21 x = 21 a = '21' l = 2 g = 0 b = 4 g = 4 b = 1 g = 5 x = 5 a = '5' l = 1 g = 0 b = 25 g = 25 x = 25 a = '25' l = 2 g = 0 b = 4 g = 4 b = 25 g = 29 x = 29 a = '29' l = 2 g = 0 b = 4 g = 4 b = 81 g = 85 x = 85 a = '85' l = 2 g = 0 b = 64 g = 64 b = 25 g = 89 x = 89 y = 89

47   Pass
assert(digits_squared_chain(726) == 89)

a = '726' l = 3 g = 0 b = 49 g = 49 b = 4 g = 53 b = 36 g = 89 x = 89 y = 89

48   Pass
assert(digits_squared_chain(689) == 89)

a = '689' l = 3 g = 0 b = 36 g = 36 b = 64 g = 100 b = 81 g = 181 x = 181 a = '181' l = 3 g = 0 b = 1 g = 1 b = 64 g = 65 b = 1 g = 66 x = 66 a = '66' l = 2 g = 0 b = 36 g = 36 b = 36 g = 72 x = 72 a = '72' l = 2 g = 0 b = 49 g = 49 b = 4 g = 53 x = 53 a = '53' l = 2 g = 0 b = 25 g = 25 b = 9 g = 34 x = 34 a = '34' l = 2 g = 0 b = 9 g = 9 b = 16 g = 25 x = 25 a = '25' l = 2 g = 0 b = 4 g = 4 b = 25 g = 29 x = 29 a = '29' l = 2 g = 0 b = 4 g = 4 b = 81 g = 85 x = 85 a = '85' l = 2 g = 0 b = 64 g = 64 b = 25 g = 89 x = 89 y = 89

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!