2 added 9 characters in body edited Apr 20 '17 at 0:43 Bob Hanlon 65.7k33 gold badges3737 silver badges100100 bronze badges nextVal[x_Integer]nextVal[x_Integer?Positive] := Total[IntegerDigits[x]^2]  The sequence can be readily generated using NestList seq = NestList[nextVal, 57, 27] (* {57, 74, 65, 61, 37, 58, 89, 145, 42, 20, 4, 16, 37, 58, 89, 145, 42, 20, 4, 16, 37, 58, 89, 145, 42, 20, 4, 16} *)  The function to generate the sequence is expressible as a DifferenceRoot sf = FindSequenceFunction[seq]  Verifying, seq == sf /@ Range[Length[seq]] (* True *)  nextVal[x_Integer] := Total[IntegerDigits[x]^2]  The sequence can be readily generated using NestList seq = NestList[nextVal, 57, 27] (* {57, 74, 65, 61, 37, 58, 89, 145, 42, 20, 4, 16, 37, 58, 89, 145, 42, 20, 4, 16, 37, 58, 89, 145, 42, 20, 4, 16} *)  The function to generate the sequence is expressible as a DifferenceRoot sf = FindSequenceFunction[seq]  Verifying, seq == sf /@ Range[Length[seq]] (* True *)  nextVal[x_Integer?Positive] := Total[IntegerDigits[x]^2]  The sequence can be readily generated using NestList seq = NestList[nextVal, 57, 27] (* {57, 74, 65, 61, 37, 58, 89, 145, 42, 20, 4, 16, 37, 58, 89, 145, 42, 20, 4, 16, 37, 58, 89, 145, 42, 20, 4, 16} *)  The function to generate the sequence is expressible as a DifferenceRoot sf = FindSequenceFunction[seq]  Verifying, seq == sf /@ Range[Length[seq]] (* True *)  1 answered Apr 20 '17 at 0:38 Bob Hanlon 65.7k33 gold badges3737 silver badges100100 bronze badges nextVal[x_Integer] := Total[IntegerDigits[x]^2]  The sequence can be readily generated using NestList seq = NestList[nextVal, 57, 27] (* {57, 74, 65, 61, 37, 58, 89, 145, 42, 20, 4, 16, 37, 58, 89, 145, 42, 20, 4, 16, 37, 58, 89, 145, 42, 20, 4, 16} *)  The function to generate the sequence is expressible as a DifferenceRoot sf = FindSequenceFunction[seq]  Verifying, seq == sf /@ Range[Length[seq]] (* True *)