Cody

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

Solution 2055711

Submitted on 12 Dec 2019 by Asif Newaz
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 = 6 4 9 b = 133 a = 1 3 3 b = 19 a = 1 9 b = 82 a = 8 2 b = 68 a = 6 8 b = 100 a = 1 0 0 b = 1

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

a = 7 9 b = 130 a = 1 3 0 b = 10 a = 1 0 b = 1

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

a = 6 0 8 b = 100 a = 1 0 0 b = 1

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

a = 4 8 7 b = 129 a = 1 2 9 b = 86 a = 8 6 b = 100 a = 1 0 0 b = 1

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

a = 7 3 9 b = 139 a = 1 3 9 b = 91 a = 9 1 b = 82 a = 8 2 b = 68 a = 6 8 b = 100 a = 1 0 0 b = 1

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

a = 5 6 5 b = 86 a = 8 6 b = 100 a = 1 0 0 b = 1

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

a = 6 8 b = 100 a = 1 0 0 b = 1

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

a = 3 8 3 b = 82 a = 8 2 b = 68 a = 6 8 b = 100 a = 1 0 0 b = 1

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

a = 3 7 9 b = 139 a = 1 3 9 b = 91 a = 9 1 b = 82 a = 8 2 b = 68 a = 6 8 b = 100 a = 1 0 0 b = 1

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

a = 2 0 3 b = 13 a = 1 3 b = 10 a = 1 0 b = 1

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

a = 6 3 2 b = 49 a = 4 9 b = 97 a = 9 7 b = 130 a = 1 3 0 b = 10 a = 1 0 b = 1

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

a = 3 9 1 b = 91 a = 9 1 b = 82 a = 8 2 b = 68 a = 6 8 b = 100 a = 1 0 0 b = 1

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

a = 8 6 3 b = 109 a = 1 0 9 b = 82 a = 8 2 b = 68 a = 6 8 b = 100 a = 1 0 0 b = 1

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

a = 1 3 b = 10 a = 1 0 b = 1

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

a = 1 0 0 b = 1

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

a = 2 3 6 b = 49 a = 4 9 b = 97 a = 9 7 b = 130 a = 1 3 0 b = 10 a = 1 0 b = 1

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

a = 2 9 3 b = 94 a = 9 4 b = 97 a = 9 7 b = 130 a = 1 3 0 b = 10 a = 1 0 b = 1

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

a = 2 3 0 b = 13 a = 1 3 b = 10 a = 1 0 b = 1

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

a = 3 1 b = 10 a = 1 0 b = 1

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

a = 8 0 6 b = 100 a = 1 0 0 b = 1

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

a = 6 2 3 b = 49 a = 4 9 b = 97 a = 9 7 b = 130 a = 1 3 0 b = 10 a = 1 0 b = 1

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

a = 7 b = 49 a = 4 9 b = 97 a = 9 7 b = 130 a = 1 3 0 b = 10 a = 1 0 b = 1

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

a = 1 3 b = 10 a = 1 0 b = 1

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

a = 8 3 6 b = 109 a = 1 0 9 b = 82 a = 8 2 b = 68 a = 6 8 b = 100 a = 1 0 0 b = 1

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

a = 9 5 4 b = 122 a = 1 2 2 b = 9 a = 9 b = 81 a = 8 1 b = 65 a = 6 5 b = 61 a = 6 1 b = 37 a = 3 7 b = 58 a = 5 8 b = 89

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

a = 5 6 7 b = 110 a = 1 1 0 b = 2 a = 2 b = 4 a = 4 b = 16 a = 1 6 b = 37 a = 3 7 b = 58 a = 5 8 b = 89

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

a = 3 8 8 b = 137 a = 1 3 7 b = 59 a = 5 9 b = 106 a = 1 0 6 b = 37 a = 3 7 b = 58 a = 5 8 b = 89

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

a = 7 8 9 b = 194 a = 1 9 4 b = 98 a = 9 8 b = 145 a = 1 4 5 b = 42 a = 4 2 b = 20 a = 2 0 b = 4 a = 4 b = 16 a = 1 6 b = 37 a = 3 7 b = 58 a = 5 8 b = 89

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

a = 2 4 6 b = 56 a = 5 6 b = 61 a = 6 1 b = 37 a = 3 7 b = 58 a = 5 8 b = 89

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

a = 7 8 7 b = 162 a = 1 6 2 b = 41 a = 4 1 b = 17 a = 1 7 b = 50 a = 5 0 b = 25 a = 2 5 b = 29 a = 2 9 b = 85 a = 8 5 b = 89

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

a = 3 1 1 b = 11 a = 1 1 b = 2 a = 2 b = 4 a = 4 b = 16 a = 1 6 b = 37 a = 3 7 b = 58 a = 5 8 b = 89

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

a = 8 5 6 b = 125 a = 1 2 5 b = 30 a = 3 0 b = 9 a = 9 b = 81 a = 8 1 b = 65 a = 6 5 b = 61 a = 6 1 b = 37 a = 3 7 b = 58 a = 5 8 b = 89

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

a = 1 4 3 b = 26 a = 2 6 b = 40 a = 4 0 b = 16 a = 1 6 b = 37 a = 3 7 b = 58 a = 5 8 b = 89

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

a = 8 7 3 b = 122 a = 1 2 2 b = 9 a = 9 b = 81 a = 8 1 b = 65 a = 6 5 b = 61 a = 6 1 b = 37 a = 3 7 b = 58 a = 5 8 b = 89

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

a = 2 1 5 b = 30 a = 3 0 b = 9 a = 9 b = 81 a = 8 1 b = 65 a = 6 5 b = 61 a = 6 1 b = 37 a = 3 7 b = 58 a = 5 8 b = 89

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

a = 9 9 5 b = 187 a = 1 8 7 b = 114 a = 1 1 4 b = 18 a = 1 8 b = 65 a = 6 5 b = 61 a = 6 1 b = 37 a = 3 7 b = 58 a = 5 8 b = 89

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

a = 4 5 5 b = 66 a = 6 6 b = 72 a = 7 2 b = 53 a = 5 3 b = 34 a = 3 4 b = 25 a = 2 5 b = 29 a = 2 9 b = 85 a = 8 5 b = 89

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

a = 9 4 8 b = 161 a = 1 6 1 b = 38 a = 3 8 b = 73 a = 7 3 b = 58 a = 5 8 b = 89

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

a = 8 7 5 b = 138 a = 1 3 8 b = 74 a = 7 4 b = 65 a = 6 5 b = 61 a = 6 1 b = 37 a = 3 7 b = 58 a = 5 8 b = 89

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

a = 7 8 8 b = 177 a = 1 7 7 b = 99 a = 9 9 b = 162 a = 1 6 2 b = 41 a = 4 1 b = 17 a = 1 7 b = 50 a = 5 0 b = 25 a = 2 5 b = 29 a = 2 9 b = 85 a = 8 5 b = 89

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

a = 7 2 2 b = 57 a = 5 7 b = 74 a = 7 4 b = 65 a = 6 5 b = 61 a = 6 1 b = 37 a = 3 7 b = 58 a = 5 8 b = 89

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

a = 2 5 0 b = 29 a = 2 9 b = 85 a = 8 5 b = 89

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

a = 2 2 7 b = 57 a = 5 7 b = 74 a = 7 4 b = 65 a = 6 5 b = 61 a = 6 1 b = 37 a = 3 7 b = 58 a = 5 8 b = 89

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

a = 6 4 0 b = 52 a = 5 2 b = 29 a = 2 9 b = 85 a = 8 5 b = 89

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

a = 8 3 5 b = 98 a = 9 8 b = 145 a = 1 4 5 b = 42 a = 4 2 b = 20 a = 2 0 b = 4 a = 4 b = 16 a = 1 6 b = 37 a = 3 7 b = 58 a = 5 8 b = 89

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

a = 9 6 5 b = 142 a = 1 4 2 b = 21 a = 2 1 b = 5 a = 5 b = 25 a = 2 5 b = 29 a = 2 9 b = 85 a = 8 5 b = 89

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

a = 7 2 6 b = 89

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

a = 6 8 9 b = 181 a = 1 8 1 b = 66 a = 6 6 b = 72 a = 7 2 b = 53 a = 5 3 b = 34 a = 3 4 b = 25 a = 2 5 b = 29 a = 2 9 b = 85 a = 8 5 b = 89