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.
%I A082381 #16 Jan 02 2021 13:03:03 %S A082381 1,4,9,81,65,61,37,58,89,145,42,20,4,16,37,58,89,145,42,20,4,25,29,85, %T A082381 89,145,42,20,4,36,45,41,17,50,25,29,85,89,145,42,20,4,49,97,130,10,1, %U A082381 64,52,29,85,89,145,42,20,4,81,65,61,37,58,89,145,42,20,4,1,2,4,5,25,29 %N A082381 Sequence of the squared digital root of a number until 1 or 4 is reached. The initial numbers 1,2,..n are not output. %C A082381 Conjecture: The sequence always terminates with 1 or the 4 16 37 58 89 145 42 20 4... loop (cf. A080709). %C A082381 From _M. F. Hasler_, Dec 18 2009: (Start) %C A082381 This sequence should be read as fuzzy table, where the n-th row contains the successive results under the map "sum of digits squared", when starting with n, until either 1 or 4 is reached. So either of these two marks the end of a row: See example. %C A082381 Row lengths (i.e. "stopping times") are given in A171250. (End) %D A082381 C. Stanley Ogilvy, Tomorrow's Math, 1972 %e A082381 From _M. F. Hasler_, Dec 18 2009: (Start) %e A082381 The table reads: %e A082381 [n=1] 1 (n=1 -> 1^2=1 -> STOP) %e A082381 [n=2] 4 (n=2 -> 2^2=4 -> STOP) %e A082381 [n=3] 9,81,65,61,37,58,89,145,42,20,4 (n=3 -> 3^2=9 -> 9^2=81 -> 8^2+1^2=65 -> ...) %e A082381 [n=4] 16,37,58,89,145,42,20,4 (n=4 -> 4^2=16 -> 1^2+6^2=37 -> 3^2+7^2=58 -> ...) %e A082381 ... %e A082381 [n=7] 49,97,130,10,1 (n=7 -> 7^2=49 -> 4^2+9^2=97 -> 130 -> 10 -> 1 -> STOP) %e A082381 etc. (End) %o A082381 (PARI) digitsq2(m) = {y=0; for(x=1,m, digitsq(x) ) } %o A082381 /* The squared digital root of a number */ digitsq(n) = { while(1, s=0; while(n > 0, d=n%10; s = s+d*d; n=floor(n/10); ); print1(s" "); if(s==1 || s==4,break); n=s; ) } %Y A082381 Cf. A082382 (list also the initial value); sequences ending in the 4-loop: A000216 (n=2), A000218 (n=3), A080709 (n=4), A000221 (n=5), A008460 (n=6), A008462 (n=8), A008462 (n=9), A139566 (n=15), A122065 (n=74169); sequences ending in 1: A000012 (n=1), A008461 (n=7). [From M. F. Hasler, Dec 18 2009] %K A082381 nonn,base,easy,tabf %O A082381 1,2 %A A082381 _Cino Hilliard_, Apr 13 2003 %E A082381 Corrected and edited, added explanations _M. F. Hasler_, Dec 18 2009