The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A367821 a(n) = first exponent k such that n^k starts with 9 or -1 if n is a power of 10. 1

%I #33 Jan 05 2024 14:26:13

%S -1,53,2,78,10,176,13,21,1,-1,24,25,26,34,17,39,13,39,25,53,3,32,11,

%T 21,5,12,37,29,41,2,2,89,25,15,11,88,7,12,5,78,13,8,11,45,3,3,55,22,

%U 13,10,24,60,11,15,4,4,37,17,22,176,14,5,5,26,43,39,6,6,25,13,7

%N a(n) = first exponent k such that n^k starts with 9 or -1 if n is a power of 10.

%C First k such that log_10(9) <= fractional part of k*log_10(n) < 1.

%C For a non-power of 10, the leading digits of the powers of n follow Benford's law, therefore making 9 the least common leading digit of powers of n.

%e a(2) = 53 because smallest power of 2 that starts with 9 is 2^53 = 9007199254740992. See A018856.

%e a(3) = 2 because 3^2 = 9.

%o (Python)

%o def a(n: int) -> int:

%o s = str(n)

%o if n <= 1 or (s[0] == '1' and set(s[1:]) == {'0'}):

%o return -1

%o pwr, e = 1, 0

%o while str(pwr)[0] != '9':

%o pwr *= n

%o e += 1

%o return e

%o (PARI) a(n) = my(t); if ((n==1) || (n==10) || (ispower(n,,&t) && (t==10)), -1, my(k=1); while (digits(n^k)[1] != 9, k++); k); \\ _Michel Marcus_, Dec 03 2023

%Y Cf. A018856, A098174, A367854 (record high indices).

%K sign,easy,base

%O 1,2

%A _William Hu_, Dec 01 2023

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 21 07:02 EDT 2024. Contains 372729 sequences. (Running on oeis4.)