%I #11 Dec 07 2019 15:00:03
%S 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,
%T 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,
%U 3,4,1,2,3,5,4,3,2,1,2,3,1,2,3,2,5,4,3
%N 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)).
%C 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.
%C 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.
%C The Maple program below gives two sequences: the number of iterations of this sequence and the fixed points in increasing order (sequence A061917).
%H Michel Lagneau, <a href="/A225416/b225416.txt">Table of n, a(n) for n = 0..10000</a>
%e The trajectory of 37 is 37 -> 36 -> 27 -> 18 -> 9 -> 0, so a(37) = 5. The fixed point is 9 = A061917(10).
%e 73 mod 37 = 36, 63 mod 36 = 27, 72 mod 27 = 18, 81 mod 18 = 9 and 9 mod 9 = 0.
%p 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):
%Y Cf. A061917.
%K nonn,base
%O 0,13
%A _Michel Lagneau_, May 07 2013
|