cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

This page as a plain text file.
%I A360697 #31 Mar 02 2023 22:59:52
%S A360697 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 A360697 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 A360697 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 A360697 The sum of the squares of the digits of n, repeated until reaching a single-digit number.
%C A360697 Square the digits of n, then sum the squares. Repeat the process until the sum is less than 10.
%e A360697 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 A360697 a(n) = 4 for 72 of the first 100 n (0 to 99 inclusive.)
%t A360697 f[n_] := Plus @@ (IntegerDigits[n]^2); a[n_] := NestWhile[f, f[n], # > 9 &]; Array[a, 100, 0] (* _Amiram Eldar_, Feb 17 2023 *)
%Y A360697 Cf. A003132, A007770, A099645.
%K A360697 nonn,base
%O A360697 0,3
%A A360697 _Will Nicholes_, Feb 16 2023