A273913 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).
1902, 1902, 730, 230, 550, 420, 502, 1902, 2150, 1074, 1074, 1074, 1902, 1902, 8170, 730, 550, 730, 600, 230, 80, 230, 470, 550, 1074, 4045, 4990, 180, 230, 106, 90, 4990, 1062, 102, 902, 1230, 730, 108, 1406, 1017, 1410, 630, 2038, 505, 230, 1810, 150, 2306, 630
Offset: 1
Examples
b(1) = 1, b(2) = 7. Then: b(3) = 7 + Pd(1) = 7+1 = 8; b(4) = 8 + Pd(7) = 8+7 = 15; b(5) = 15 + Pd(8) = 15+8 = 23; b(6) = 23 + Pd(15) = 23+5 = 28; b(7) = 28 + Pd(23) = 28+6 = 34; b(8) = 34 + Pd(28) = 34+16 = 50; … b(19) = 270 + Pd(214) = 270+8 = 278; b(20) = 278 + Pd(270) = 278+0 = 278; b(21) = 278 + Pd(278) = 278+112 = 390; b(22) = 390 + Pd(278) = 390+112 = 502; b(23) = 502 + Pd(502) = 502+0 = 502; therefore a(7) = 502.
Links
- Paolo P. Lava, Table of n, a(n) for n = 1..10000
Programs
-
Maple
with(numtheory); T:=proc(w) local x, y, z; x:=w; y:=1; for z from 1 to ilog10(x)+1 do y:=y*(x mod 10); x:=trunc(x/10); od; y; end: P:=proc(q) local a1,a2,a3,n; for n from 1 to q do a1:=1; a2:=n; a3:=T(a1)+a2; while not (a1=a2 and a2=a3) do a1:=a2; a2:=a3; a3:=T(a1)+a2; od; print(a1); od; end: P(10^7);
-
Mathematica
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 *)
-
PARI
pd(n) = my(d=digits(n)); prod(k=1, #d, d[k]); 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
Comments