%I #24 Aug 06 2017 03:15:15
%S 0,1,1,3,2,1,1,7,1,7,6,7,10,1,7,15,8,1,1,7,1,17,17,7,2,23,1,15,26,7,3,
%T 31,28,25,22,19,34,1,10,7,4,1,1,39,37,17,35,31,1,27,25,23,32,1,17,15,
%U 1,55,36,7,5,3,1,63,62,61,43,59,40,57,49,55,1,71,52,39,50,49,75,47,1,45,66,43,42,1,55,39,63,37,36,63,34,35,77,31,65,1,28,27
%N Limit of f(f(f(...f(2))...) modulo n as the number of iterations of f(x) = 2^x - 1 grows.
%C Also, limit of f(f(f(...f(m))...) modulo n for any integer m >= 2.
%H Vincenzo Librandi, <a href="/A254410/b254410.txt">Table of n, a(n) for n = 1..1000</a>
%F a(n) = limit of A007013(m) mod n as m grows.
%F a(n) = A007013(A227944(n) + k) mod n for any k >= 1. In particular, a(n) = A007013(n) mod n.
%t Clear[a]; Unprotect[Power]; 0^0 = 1; a[1]=0; a[n_] := a[n] = Module[{g, m = n}, g = 2^IntegerExponent[m, 2]; m = Floor[m/g]; Mod[ ChineseRemainder[ {0, Mod[2, m]^a[EulerPhi[m]]}, {g, m}] - 1, n]]; Array[a, 100] (* _Jean-François Alcover_, Jan 01 2016, adapted from PARI *)
%o (PARI) { A254410(m) = my(g); if(m==1, return(0)); g=2^valuation(m,2); m\=g; lift( chinese(Mod(0,g),Mod(2,m)^A254410(eulerphi(m)) ) - 1) }
%Y Cf. A245970, A254411.
%K nonn,easy,nice,look
%O 1,4
%A _Max Alekseyev_, Jan 30 2015