%I #6 Feb 23 2017 22:54:34
%S 9,17,48,55,96,120,124,131,244,426,787,1893,5307,5364,5600,10083,
%T 31085,46733,52700,53456,56857,56920,109620,110313,110376,374016,
%U 2989245,4081505,5173765,13017112,17242512,34346372,34638676
%N 9*n analog to Keith numbers.
%C Like Keith numbers but starting from 9*n digits to reach n.
%C Consider the digits of 9*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 9*17 = 153:
%e 1 + 5 + 3 = 9;
%e 5 + 3 + 9 = 17.
%p with(numtheory): P:=proc(q, h,w) local a, b, k, n, t, v; v:=array(1..h);
%p for n from 1 to q do a:=w*n; b:=ilog10(a)+1; if b>1 then
%p for k from 1 to b do v[b-k+1]:=(a mod 10); a:=trunc(a/10); od; t:=b+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); od;
%p if v[t]=n then print(n); fi; fi; od; end: P(10^6, 1000,9);
%t Select[Range[10^6], Function[n, Module[{d = IntegerDigits[9 n], 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 *)
%Y Cf. A282757 - A282763, A282765.
%K nonn,base
%O 1,1
%A _Paolo P. Lava_, Feb 22 2017
|