A225416 Number of iterations of the map n -> f(n) needed to reach 0 and starting with n, where f(n) is given by the following definition: f(n) = u(n) mod v(n) where u(n) = max (n, reverse(n)) and v(n) = min(n, reverse(n)).
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 2, 3, 2, 2, 3, 1, 2, 1, 2, 3, 2, 2, 3, 3, 2, 1, 2, 2, 1, 2, 3, 4, 5, 2, 3, 1, 3, 3, 2, 1, 2, 3, 4, 5, 3, 1, 2, 2, 3, 2, 1, 2, 3, 4, 5, 1, 3, 2, 4, 3, 2, 1, 2, 3, 4, 1, 2, 3, 5, 4, 3, 2, 1, 2, 3, 1, 2, 3, 2, 5, 4, 3
Offset: 0
Examples
The trajectory of 37 is 37 -> 36 -> 27 -> 18 -> 9 -> 0, so a(37) = 5. The fixed point is 9 = A061917(10). 73 mod 37 = 36, 63 mod 36 = 27, 72 mod 27 = 18, 81 mod 18 = 9 and 9 mod 9 = 0.
Links
- Michel Lagneau, Table of n, a(n) for n = 0..10000
Crossrefs
Cf. A061917.
Programs
-
Maple
lst1:={}:for n from 1 to 494 do:nn:=n:ii:=0:r:=1:lst:={n}:for it from 1 to 20 while(r<>0) do: V:=convert(nn, base, 10): n1:=nops(V):s:=0:for a from n1 by -1 to 1 do:s:=s+V[a]*10^(n1-a): od:m1:=min(nn,s):m2:=max(nn,s):r:=irem(m2,m1): lst:=lst union {r}:nn:=r: od: printf(`%d, `,it-1): lst1:=lst1 union { lst[2]}: od:print(lst1):
Comments