Cody

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

Solution 1985709

Submitted on 22 Oct 2019 by Ron Larham
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)

xx = 133 xx = 19 xx = 82 xx = 68 xx = 100 xx = 1

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

xx = 130 xx = 10 xx = 1

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

xx = 100 xx = 1

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

xx = 129 xx = 86 xx = 100 xx = 1

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

xx = 139 xx = 91 xx = 82 xx = 68 xx = 100 xx = 1

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

xx = 86 xx = 100 xx = 1

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

xx = 100 xx = 1

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

xx = 82 xx = 68 xx = 100 xx = 1

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

xx = 139 xx = 91 xx = 82 xx = 68 xx = 100 xx = 1

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

xx = 13 xx = 10 xx = 1

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

xx = 49 xx = 97 xx = 130 xx = 10 xx = 1

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

xx = 91 xx = 82 xx = 68 xx = 100 xx = 1

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

xx = 109 xx = 82 xx = 68 xx = 100 xx = 1

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

xx = 10 xx = 1

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

xx = 1

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

xx = 49 xx = 97 xx = 130 xx = 10 xx = 1

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

xx = 94 xx = 97 xx = 130 xx = 10 xx = 1

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

xx = 13 xx = 10 xx = 1

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

xx = 10 xx = 1

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

xx = 100 xx = 1

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

xx = 49 xx = 97 xx = 130 xx = 10 xx = 1

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

xx = 49 xx = 97 xx = 130 xx = 10 xx = 1

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

xx = 10 xx = 1

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

xx = 109 xx = 82 xx = 68 xx = 100 xx = 1

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

xx = 122 xx = 9 xx = 81 xx = 65 xx = 61 xx = 37 xx = 58 xx = 89

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

xx = 110 xx = 2 xx = 4 xx = 16 xx = 37 xx = 58 xx = 89

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

xx = 137 xx = 59 xx = 106 xx = 37 xx = 58 xx = 89

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

xx = 194 xx = 98 xx = 145 xx = 42 xx = 20 xx = 4 xx = 16 xx = 37 xx = 58 xx = 89

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

xx = 56 xx = 61 xx = 37 xx = 58 xx = 89

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

xx = 162 xx = 41 xx = 17 xx = 50 xx = 25 xx = 29 xx = 85 xx = 89

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

xx = 11 xx = 2 xx = 4 xx = 16 xx = 37 xx = 58 xx = 89

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

xx = 125 xx = 30 xx = 9 xx = 81 xx = 65 xx = 61 xx = 37 xx = 58 xx = 89

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

xx = 26 xx = 40 xx = 16 xx = 37 xx = 58 xx = 89

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

xx = 122 xx = 9 xx = 81 xx = 65 xx = 61 xx = 37 xx = 58 xx = 89

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

xx = 30 xx = 9 xx = 81 xx = 65 xx = 61 xx = 37 xx = 58 xx = 89

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

xx = 187 xx = 114 xx = 18 xx = 65 xx = 61 xx = 37 xx = 58 xx = 89

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

xx = 66 xx = 72 xx = 53 xx = 34 xx = 25 xx = 29 xx = 85 xx = 89

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

xx = 161 xx = 38 xx = 73 xx = 58 xx = 89

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

xx = 138 xx = 74 xx = 65 xx = 61 xx = 37 xx = 58 xx = 89

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

xx = 177 xx = 99 xx = 162 xx = 41 xx = 17 xx = 50 xx = 25 xx = 29 xx = 85 xx = 89

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

xx = 57 xx = 74 xx = 65 xx = 61 xx = 37 xx = 58 xx = 89

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

xx = 29 xx = 85 xx = 89

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

xx = 57 xx = 74 xx = 65 xx = 61 xx = 37 xx = 58 xx = 89

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

xx = 52 xx = 29 xx = 85 xx = 89

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

xx = 98 xx = 145 xx = 42 xx = 20 xx = 4 xx = 16 xx = 37 xx = 58 xx = 89

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

xx = 142 xx = 21 xx = 5 xx = 25 xx = 29 xx = 85 xx = 89

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

xx = 89

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

xx = 181 xx = 66 xx = 72 xx = 53 xx = 34 xx = 25 xx = 29 xx = 85 xx = 89

### Community Treasure Hunt

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

Start Hunting!