login
Upper limit of backward value of 5^n.
5

%I #35 Feb 07 2022 02:24:10

%S 5,2,6,5,6,7,9,5,7,8,7,9,6,9,9,7,6,5,7,8,8,5,5,7,6,9,7,5,9,9,5,7,8,9,

%T 5,8,6,7,7,5,6,5,6,9,5,7,5,6,6,9,6,7,7,6,7,6,8,8,5,8,5,6,7,5,8,9,6,6,

%U 7,5,9,5,7,9,8,6,8,8,7,9,5,8,8,5,8,5,9,5,5,8,9,7,7,9,7,7,9,6,7,6,8,9,7,6,6

%N Upper limit of backward value of 5^n.

%C Digits are all in {5,6,7,8,9} after 2nd term.

%C The other limit, related to odd n, is in A158625.

%C The first digit of the backward value of 5^n is always a(0)=5. The second digit is a(-1)=2 from n=2 on. The third digit is a(-2)=6 for all even n >= 4. The fourth digit is a(-3)=5 for n=6+4k, k >= 0. The fifth digit is a(-4)=6 for n=10+8k, k >= 0. The 6th digit is a(-5)=7 for n=10+16k, k >= 0. The 7th digit is a(-6)=9 for n=10+32k, k >= 0.

%H Robert Israel, <a href="/A158624/b158624.txt">Table of n, a(n) for n = 0..999</a>

%e 5^3 = 125 so the backward value is 0.521, 5^10 = 9765625, so the backward value is 0.5265679. The upper limit of all values is a constant, which appears to be 0.5265679578796997657885576975995789586775656...

%p A158624:= proc(N)

%p local m,n,A;

%p m[2]:= 3;

%p for n from 3 to N do

%p A:= 5&^m[n-1] mod 10^n;

%p if A > 5*10^(n-1) then m[n]:= m[n-1]

%p else m[n]:= m[n-1]+2^(n-3)

%p end if

%p end do:

%p convert(5&^m[N] mod 10^(N),base,10);

%p end proc; # _Robert Israel_, Apr 01 2012

%t A158624[k_] := Module[{m, n, a}, m[2] = 3; For[n = 3, n <= k, n++, a = PowerMod[5, m[n-1], 10^n]; If[ a > 5*10^(n-1), m[n] = m[n-1], m[n] = m[n-1] + 2^(n-3)]]; IntegerDigits[PowerMod[5, m[k], 10^k]] // Reverse]; A158624[105] (* _Jean-François Alcover_, Dec 21 2012, translated from _Robert Israel_'s Maple program *)

%o (Magma) D:=87; e:=6; for d in [2..D-1] do t:=Modexp(5, e, 10^(d+1)); if t div 10^d lt 5 then e+:=2^(d-2); end if; end for; t:=Modexp(5, e, 10^D); IntegerToSequence(t, 10); // _Jon E. Schoenfield_, Feb 07 2018

%Y Cf. A158625, A071583, A145679.

%K cons,nonn,base,nice

%O 0,1

%A _Simon Plouffe_, Mar 23 2009