A336682 a(n) is the number of iterations needed to reach a fixed point starting with n and repeatedly applying f(x) = x - (the product of the digits of x).
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 3, 3, 3, 3, 1, 2, 2, 2, 2, 0, 3, 4, 4, 3, 3, 3, 2, 2, 2, 0, 4, 5, 3, 4, 1, 3, 3, 2, 2, 0, 2, 1, 4, 1, 2, 1, 3, 1, 2, 0, 2, 3, 6, 4, 1, 4, 3, 3, 2, 0, 7, 2, 3, 6, 4
Offset: 0
Examples
a(42) = 4 because: 1: 42 - 4*2 = 34 2: 34 - 3*4 = 22 3: 22 - 2*2 = 18 4: 18 - 1*8 = 10 5: 10 - 1*0 = 10
Links
- Robert Price, Table of n, a(n) for n = 0..1000
Programs
-
Mathematica
Table[Length@ NestWhileList[# - Times @@ IntegerDigits[#] &, n, UnsameQ[##] &, 2] - 2, {n, 0, 85}];(* Robert Price, Sep 13 2020 *)