login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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)).
1
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,13
COMMENTS
The fixed points are in A061917 (either a palindrome or becomes a palindrome if trailing 0's are omitted). The number of iterations needed to reach a fixed point equals a(n) - 1 with n > 0, and 0 for n = 0.
The smallest k such that a(k) = n iterations are {0, 1, 12, 14, 36, 37, 103, 118, 238, 257, 1282, 2165, 2459, 11908, 100673, 113233, 144104, 300768, 1329025, ...}, and it seems that 3*log_10(k)/n ~ 1 where n tends into infinity.
The Maple program below gives two sequences: the number of iterations of this sequence and the fixed points in increasing order (sequence A061917).
LINKS
EXAMPLE
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.
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):
CROSSREFS
Cf. A061917.
Sequence in context: A113517 A278399 A349197 * A369871 A295784 A275803
KEYWORD
nonn,base
AUTHOR
Michel Lagneau, May 07 2013
STATUS
approved