login
The sum of the squares of the digits of n, repeated until reaching a single-digit number.
0

%I #31 Mar 02 2023 22:59:52

%S 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,

%T 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,

%U 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

%N The sum of the squares of the digits of n, repeated until reaching a single-digit number.

%C Square the digits of n, then sum the squares. Repeat the process until the sum is less than 10.

%e 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.

%e a(n) = 4 for 72 of the first 100 n (0 to 99 inclusive.)

%t f[n_] := Plus @@ (IntegerDigits[n]^2); a[n_] := NestWhile[f, f[n], # > 9 &]; Array[a, 100, 0] (* _Amiram Eldar_, Feb 17 2023 *)

%Y Cf. A003132, A007770, A099645.

%K nonn,base

%O 0,3

%A _Will Nicholes_, Feb 16 2023