%I #35 Jun 22 2016 23:39:44
%S 1902,1902,730,230,550,420,502,1902,2150,1074,1074,1074,1902,1902,
%T 8170,730,550,730,600,230,80,230,470,550,1074,4045,4990,180,230,106,
%U 90,4990,1062,102,902,1230,730,108,1406,1017,1410,630,2038,505,230,1810,150,2306,630
%N Consider the sequence b(k) with initial values b(1) = 1 and b(2) = n and satisfying b(k) = b(k-1) + Pd(b(k-2)), where Pd(x) is the product of the digits of x. Then b(k) eventually becomes constant, and this constant is a(n).
%C Maximum value in the first 10^5 terms is a(6874) = 209875, from b(128) on.
%C First n's whose last repetitive number of the sequence b(k) is a multiple: 1, 2, 5, 6, 34, 42, 135, 195, 460, 893, 2370, 4230, 7165, 237945.
%H Paolo P. Lava, <a href="/A273913/b273913.txt">Table of n, a(n) for n = 1..10000</a>
%e b(1) = 1, b(2) = 7. Then:
%e b(3) = 7 + Pd(1) = 7+1 = 8; b(4) = 8 + Pd(7) = 8+7 = 15;
%e b(5) = 15 + Pd(8) = 15+8 = 23; b(6) = 23 + Pd(15) = 23+5 = 28;
%e b(7) = 28 + Pd(23) = 28+6 = 34; b(8) = 34 + Pd(28) = 34+16 = 50;
%e …
%e b(19) = 270 + Pd(214) = 270+8 = 278; b(20) = 278 + Pd(270) = 278+0 = 278;
%e b(21) = 278 + Pd(278) = 278+112 = 390; b(22) = 390 + Pd(278) = 390+112 = 502;
%e b(23) = 502 + Pd(502) = 502+0 = 502; therefore a(7) = 502.
%p with(numtheory); T:=proc(w) local x, y, z; x:=w; y:=1;
%p for z from 1 to ilog10(x)+1 do y:=y*(x mod 10); x:=trunc(x/10); od; y; end:
%p P:=proc(q) local a1,a2,a3,n; for n from 1 to q do a1:=1; a2:=n; a3:=T(a1)+a2;
%p while not (a1=a2 and a2=a3) do a1:=a2; a2:=a3; a3:=T(a1)+a2; od; print(a1);
%p od; end: P(10^7);
%t a[n_] := Block[{b=0, c=1, d=n, p}, While[! (b == c == d), b=c; p = Times @@ IntegerDigits@ c; c = d; d += p]; d]; Array[a, 50] (* _Giovanni Resta_, Jun 20 2016 *)
%o (PARI) pd(n) = my(d=digits(n)); prod(k=1, #d, d[k]);
%o a(n) = {ba = 1; bb = n; bc = bb + pd(ba); while (!((ba ==bb) && (bc == bb)), newb = bb + pd(ba); ba = bb; bb = bc; bc = bb + pd(ba);); bc;} \\ _Michel Marcus_, Jun 20 2016
%Y Cf. A007954, A063108.
%K nonn,base,easy
%O 1,1
%A _Paolo P. Lava_, Jun 17 2016
|