Cody

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

Solution 1631716

Submitted on 22 Sep 2018 by NZMarkW
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)

Ndigits = 6 4 9 Ndigits = 1 3 3 Ndigits = 1 9 Ndigits = 8 2 Ndigits = 6 8 Ndigits = 1 0 0

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

Ndigits = 7 9 Ndigits = 1 3 0 Ndigits = 1 0

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

Ndigits = 6 0 8 Ndigits = 1 0 0

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

Ndigits = 4 8 7 Ndigits = 1 2 9 Ndigits = 8 6 Ndigits = 1 0 0

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

Ndigits = 7 3 9 Ndigits = 1 3 9 Ndigits = 9 1 Ndigits = 8 2 Ndigits = 6 8 Ndigits = 1 0 0

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

Ndigits = 5 6 5 Ndigits = 8 6 Ndigits = 1 0 0

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

Ndigits = 6 8 Ndigits = 1 0 0

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

Ndigits = 3 8 3 Ndigits = 8 2 Ndigits = 6 8 Ndigits = 1 0 0

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

Ndigits = 3 7 9 Ndigits = 1 3 9 Ndigits = 9 1 Ndigits = 8 2 Ndigits = 6 8 Ndigits = 1 0 0

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

Ndigits = 2 0 3 Ndigits = 1 3 Ndigits = 1 0

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

Ndigits = 6 3 2 Ndigits = 4 9 Ndigits = 9 7 Ndigits = 1 3 0 Ndigits = 1 0

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

Ndigits = 3 9 1 Ndigits = 9 1 Ndigits = 8 2 Ndigits = 6 8 Ndigits = 1 0 0

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

Ndigits = 8 6 3 Ndigits = 1 0 9 Ndigits = 8 2 Ndigits = 6 8 Ndigits = 1 0 0

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

Ndigits = 1 3 Ndigits = 1 0

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

Ndigits = 1 0 0

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

Ndigits = 2 3 6 Ndigits = 4 9 Ndigits = 9 7 Ndigits = 1 3 0 Ndigits = 1 0

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

Ndigits = 2 9 3 Ndigits = 9 4 Ndigits = 9 7 Ndigits = 1 3 0 Ndigits = 1 0

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

Ndigits = 2 3 0 Ndigits = 1 3 Ndigits = 1 0

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

Ndigits = 3 1 Ndigits = 1 0

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

Ndigits = 8 0 6 Ndigits = 1 0 0

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

Ndigits = 6 2 3 Ndigits = 4 9 Ndigits = 9 7 Ndigits = 1 3 0 Ndigits = 1 0

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

Ndigits = 7 Ndigits = 4 9 Ndigits = 9 7 Ndigits = 1 3 0 Ndigits = 1 0

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

Ndigits = 1 3 Ndigits = 1 0

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

Ndigits = 8 3 6 Ndigits = 1 0 9 Ndigits = 8 2 Ndigits = 6 8 Ndigits = 1 0 0

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

Ndigits = 9 5 4 Ndigits = 1 2 2 Ndigits = 9 Ndigits = 8 1 Ndigits = 6 5 Ndigits = 6 1 Ndigits = 3 7 Ndigits = 5 8

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

Ndigits = 5 6 7 Ndigits = 1 1 0 Ndigits = 2 Ndigits = 4 Ndigits = 1 6 Ndigits = 3 7 Ndigits = 5 8

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

Ndigits = 3 8 8 Ndigits = 1 3 7 Ndigits = 5 9 Ndigits = 1 0 6 Ndigits = 3 7 Ndigits = 5 8

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

Ndigits = 7 8 9 Ndigits = 1 9 4 Ndigits = 9 8 Ndigits = 1 4 5 Ndigits = 4 2 Ndigits = 2 0 Ndigits = 4 Ndigits = 1 6 Ndigits = 3 7 Ndigits = 5 8

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

Ndigits = 2 4 6 Ndigits = 5 6 Ndigits = 6 1 Ndigits = 3 7 Ndigits = 5 8

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

Ndigits = 7 8 7 Ndigits = 1 6 2 Ndigits = 4 1 Ndigits = 1 7 Ndigits = 5 0 Ndigits = 2 5 Ndigits = 2 9 Ndigits = 8 5

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

Ndigits = 3 1 1 Ndigits = 1 1 Ndigits = 2 Ndigits = 4 Ndigits = 1 6 Ndigits = 3 7 Ndigits = 5 8

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

Ndigits = 8 5 6 Ndigits = 1 2 5 Ndigits = 3 0 Ndigits = 9 Ndigits = 8 1 Ndigits = 6 5 Ndigits = 6 1 Ndigits = 3 7 Ndigits = 5 8

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

Ndigits = 1 4 3 Ndigits = 2 6 Ndigits = 4 0 Ndigits = 1 6 Ndigits = 3 7 Ndigits = 5 8

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

Ndigits = 8 7 3 Ndigits = 1 2 2 Ndigits = 9 Ndigits = 8 1 Ndigits = 6 5 Ndigits = 6 1 Ndigits = 3 7 Ndigits = 5 8

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

Ndigits = 2 1 5 Ndigits = 3 0 Ndigits = 9 Ndigits = 8 1 Ndigits = 6 5 Ndigits = 6 1 Ndigits = 3 7 Ndigits = 5 8

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

Ndigits = 9 9 5 Ndigits = 1 8 7 Ndigits = 1 1 4 Ndigits = 1 8 Ndigits = 6 5 Ndigits = 6 1 Ndigits = 3 7 Ndigits = 5 8

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

Ndigits = 4 5 5 Ndigits = 6 6 Ndigits = 7 2 Ndigits = 5 3 Ndigits = 3 4 Ndigits = 2 5 Ndigits = 2 9 Ndigits = 8 5

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

Ndigits = 9 4 8 Ndigits = 1 6 1 Ndigits = 3 8 Ndigits = 7 3 Ndigits = 5 8

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

Ndigits = 8 7 5 Ndigits = 1 3 8 Ndigits = 7 4 Ndigits = 6 5 Ndigits = 6 1 Ndigits = 3 7 Ndigits = 5 8

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

Ndigits = 7 8 8 Ndigits = 1 7 7 Ndigits = 9 9 Ndigits = 1 6 2 Ndigits = 4 1 Ndigits = 1 7 Ndigits = 5 0 Ndigits = 2 5 Ndigits = 2 9 Ndigits = 8 5

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

Ndigits = 7 2 2 Ndigits = 5 7 Ndigits = 7 4 Ndigits = 6 5 Ndigits = 6 1 Ndigits = 3 7 Ndigits = 5 8

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

Ndigits = 2 5 0 Ndigits = 2 9 Ndigits = 8 5

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

Ndigits = 2 2 7 Ndigits = 5 7 Ndigits = 7 4 Ndigits = 6 5 Ndigits = 6 1 Ndigits = 3 7 Ndigits = 5 8

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

Ndigits = 6 4 0 Ndigits = 5 2 Ndigits = 2 9 Ndigits = 8 5

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

Ndigits = 8 3 5 Ndigits = 9 8 Ndigits = 1 4 5 Ndigits = 4 2 Ndigits = 2 0 Ndigits = 4 Ndigits = 1 6 Ndigits = 3 7 Ndigits = 5 8

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

Ndigits = 9 6 5 Ndigits = 1 4 2 Ndigits = 2 1 Ndigits = 5 Ndigits = 2 5 Ndigits = 2 9 Ndigits = 8 5

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

Ndigits = 7 2 6

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

Ndigits = 6 8 9 Ndigits = 1 8 1 Ndigits = 6 6 Ndigits = 7 2 Ndigits = 5 3 Ndigits = 3 4 Ndigits = 2 5 Ndigits = 2 9 Ndigits = 8 5