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.

A274769 Square analog to Keith numbers.

This page as a plain text file.
%I A274769 #22 Jun 02 2021 22:22:34
%S A274769 1,9,37,40,43,62,70,74,160,1264,1952,2847,12799,16368,16584,42696,
%T A274769 83793,97415,182011,352401,889871,925356,1868971,1881643,3661621,
%U A274769 7645852,15033350,21655382,63288912,88192007,158924174,381693521,792090500,2025078249,2539401141
%N A274769 Square analog to Keith numbers.
%C A274769 Like Keith numbers but starting from n^2 digits to reach n.
%C A274769 Consider the digits of the square of a number n. Take their sum and repeat the process deleting the first addend and adding the previous sum. The sequence lists the numbers that after some iterations reach a sum equal to themselves.
%e A274769 1264^2 = 1597696 :
%e A274769 1 + 5 + 9 + 7 + 6 + 9 + 6 = 43;
%e A274769 5 + 9 + 7 + 6 + 9 + 6 + 43 = 85;
%e A274769 9 + 7 + 6 + 9 + 6 + 43 + 85 = 165;
%e A274769 7 + 6 + 9 + 6 + 43 + 85 + 165 = 321;
%e A274769 6 + 9 + 6 + 43 + 85 + 165 + 321 = 635;
%e A274769 9 + 6 + 43 + 85 + 165 + 321 + 635 = 1264.
%p A274769 with(numtheory): P:=proc(q, h) local a,b,k,n,t,v; v:=array(1..h);
%p A274769 for n from 1 to q do b:=n^2; a:=[];
%p A274769 for k from 1 to ilog10(b)+1 do a:=[(b mod 10),op(a)]; b:=trunc(b/10); od;
%p A274769 for k from 1 to nops(a) do v[k]:=a[k]; od; b:=ilog10(n^2)+1;
%p A274769 t:=nops(a)+1; v[t]:=add(v[k], k=1..b); while v[t]<n do t:=t+1; v[t]:=add(v[k], k=t-b..t-1);
%p A274769 od; if v[t]=n then print(n); fi; od; end: P(10^6, 10000);
%t A274769 Select[Range[10^6], Function[n, Module[{d = IntegerDigits[n^2], s, k = 0}, s = Total@ d; While[s < n, AppendTo[d, s]; k++; s = 2 s - d[[k]]]; s == n]]] (* _Michael De Vlieger_, Feb 22 2017, after _T. D. Noe_ at A007629 *)
%t A274769 (* function keithQ[ ] is defined in A007629 *)
%t A274769 a274769[n_] := Join[{1, 9}, Select[Range[10, n], keithQ[#, 2]&]]
%t A274769 a274769[10^6] (* _Hartmut F. W. Hoft_, Jun 02 2021 *)
%Y A274769 Cf. A007629, A246544, A263534, A274770.
%K A274769 nonn,base
%O A274769 1,2
%A A274769 _Paolo P. Lava_, Jul 06 2016
%E A274769 a(32)-a(35) from _Giovanni Resta_, Jul 08 2016