login
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