Cody

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

Solution 1582726

Submitted on 13 Jul 2018 by laurent guyot
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)

xchar = '649' xchar = '133' xchar = '19' xchar = '82' xchar = '68' xchar = '100'

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

xchar = '79' xchar = '130' xchar = '10'

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

xchar = '608' xchar = '100'

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

xchar = '487' xchar = '129' xchar = '86' xchar = '100'

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

xchar = '739' xchar = '139' xchar = '91' xchar = '82' xchar = '68' xchar = '100'

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

xchar = '565' xchar = '86' xchar = '100'

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

xchar = '68' xchar = '100'

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

xchar = '383' xchar = '82' xchar = '68' xchar = '100'

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

xchar = '379' xchar = '139' xchar = '91' xchar = '82' xchar = '68' xchar = '100'

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

xchar = '203' xchar = '13' xchar = '10'

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

xchar = '632' xchar = '49' xchar = '97' xchar = '130' xchar = '10'

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

xchar = '391' xchar = '91' xchar = '82' xchar = '68' xchar = '100'

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

xchar = '863' xchar = '109' xchar = '82' xchar = '68' xchar = '100'

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

xchar = '13' xchar = '10'

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

xchar = '100'

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

xchar = '236' xchar = '49' xchar = '97' xchar = '130' xchar = '10'

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

xchar = '293' xchar = '94' xchar = '97' xchar = '130' xchar = '10'

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

xchar = '230' xchar = '13' xchar = '10'

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

xchar = '31' xchar = '10'

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

xchar = '806' xchar = '100'

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

xchar = '623' xchar = '49' xchar = '97' xchar = '130' xchar = '10'

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

xchar = '7' xchar = '49' xchar = '97' xchar = '130' xchar = '10'

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

xchar = '13' xchar = '10'

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

xchar = '836' xchar = '109' xchar = '82' xchar = '68' xchar = '100'

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

xchar = '954' xchar = '122' xchar = '9' xchar = '81' xchar = '65' xchar = '61' xchar = '37' xchar = '58'

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

xchar = '567' xchar = '110' xchar = '2' xchar = '4' xchar = '16' xchar = '37' xchar = '58'

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

xchar = '388' xchar = '137' xchar = '59' xchar = '106' xchar = '37' xchar = '58'

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

xchar = '789' xchar = '194' xchar = '98' xchar = '145' xchar = '42' xchar = '20' xchar = '4' xchar = '16' xchar = '37' xchar = '58'

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

xchar = '246' xchar = '56' xchar = '61' xchar = '37' xchar = '58'

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

xchar = '787' xchar = '162' xchar = '41' xchar = '17' xchar = '50' xchar = '25' xchar = '29' xchar = '85'

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

xchar = '311' xchar = '11' xchar = '2' xchar = '4' xchar = '16' xchar = '37' xchar = '58'

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

xchar = '856' xchar = '125' xchar = '30' xchar = '9' xchar = '81' xchar = '65' xchar = '61' xchar = '37' xchar = '58'

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

xchar = '143' xchar = '26' xchar = '40' xchar = '16' xchar = '37' xchar = '58'

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

xchar = '873' xchar = '122' xchar = '9' xchar = '81' xchar = '65' xchar = '61' xchar = '37' xchar = '58'

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

xchar = '215' xchar = '30' xchar = '9' xchar = '81' xchar = '65' xchar = '61' xchar = '37' xchar = '58'

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

xchar = '995' xchar = '187' xchar = '114' xchar = '18' xchar = '65' xchar = '61' xchar = '37' xchar = '58'

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

xchar = '455' xchar = '66' xchar = '72' xchar = '53' xchar = '34' xchar = '25' xchar = '29' xchar = '85'

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

xchar = '948' xchar = '161' xchar = '38' xchar = '73' xchar = '58'

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

xchar = '875' xchar = '138' xchar = '74' xchar = '65' xchar = '61' xchar = '37' xchar = '58'

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

xchar = '788' xchar = '177' xchar = '99' xchar = '162' xchar = '41' xchar = '17' xchar = '50' xchar = '25' xchar = '29' xchar = '85'

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

xchar = '722' xchar = '57' xchar = '74' xchar = '65' xchar = '61' xchar = '37' xchar = '58'

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

xchar = '250' xchar = '29' xchar = '85'

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

xchar = '227' xchar = '57' xchar = '74' xchar = '65' xchar = '61' xchar = '37' xchar = '58'

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

xchar = '640' xchar = '52' xchar = '29' xchar = '85'

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

xchar = '835' xchar = '98' xchar = '145' xchar = '42' xchar = '20' xchar = '4' xchar = '16' xchar = '37' xchar = '58'

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

xchar = '965' xchar = '142' xchar = '21' xchar = '5' xchar = '25' xchar = '29' xchar = '85'

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

xchar = '726'

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

xchar = '689' xchar = '181' xchar = '66' xchar = '72' xchar = '53' xchar = '34' xchar = '25' xchar = '29' xchar = '85'

### Community Treasure Hunt

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

Start Hunting!