login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A360697
The sum of the squares of the digits of n, repeated until reaching a single-digit number.
0
0, 1, 4, 9, 4, 4, 4, 1, 4, 4, 1, 2, 5, 1, 4, 4, 4, 4, 4, 1, 4, 5, 8, 1, 4, 4, 4, 4, 1, 4, 9, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 4, 4, 4, 4, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 4, 1, 4, 4, 4, 4, 4, 4, 4, 2, 1, 4, 4, 1, 4, 4, 4, 1, 2, 4, 4, 4, 1, 4, 4, 1, 4, 4, 1, 4, 4, 1
OFFSET
0,3
COMMENTS
Square the digits of n, then sum the squares. Repeat the process until the sum is less than 10.
EXAMPLE
For n=28, the sum of the squares of the digits gives 4+64 = 68. Repeating the process gives 36+64 = 100; repeating once more gives 1+0+0 = 1. Therefore a(28) is 1.
a(n) = 4 for 72 of the first 100 n (0 to 99 inclusive.)
MATHEMATICA
f[n_] := Plus @@ (IntegerDigits[n]^2); a[n_] := NestWhile[f, f[n], # > 9 &]; Array[a, 100, 0] (* Amiram Eldar, Feb 17 2023 *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Will Nicholes, Feb 16 2023
STATUS
approved