OFFSET
1,2
COMMENTS
Write lg = log_10, let {x} denote the fractional part of x. Note that {k*lg(5)} = 1 - {k*lg(2)}, so we have {k > 0 : 2^k, 5^k, 8^k all start with a} = {k: {k*lg(2)} is in I_a}, where I_a = (lg(a), lg(a+1)) intersect (1-lg(a+1), 1-lg(a)). Note that I_3 = (lg(3), 1-lg(3)) and I_a is empty otherwise. As a result, k > 0 is a term if and only if lg(3) < {k*lg(2)} < 1-lg(3). - Jianing Song, Dec 26 2022
LINKS
David A. Corneth, Table of n, a(n) for n = 1..10000
T. Sillke, Powers of 2 and 5 Puzzle
EXAMPLE
78 is in the sequence since 2^78 = 302231454903657293676544 and 5^78 = 3308722450212110699485634768279851414263248443603515625
98 is in the sequence since 2^98 = 316912650057057350374175801344 and 5^98 = 315544362088404722164691426113114491869282574043609201908111572265625.
MAPLE
filter:= n -> convert(2^n, base, 10)[-1]=convert(5^n, base, 10)[-1]:
select(filter, [$0..1000]); # Robert Israel, Aug 09 2018
MATHEMATICA
Select[ Range[ 1000 ], IntegerDigits[ 2^# ][ [ 1 ] ] == IntegerDigits[ 5^# ][ [ 1 ] ] & ]
PROG
(PARI) is(n)=(digits(2^n)[1]==digits(5^n)[1]);
for(n=0, 10^3, if(is(n), print1(n, ", "))); \\ Joerg Arndt, Aug 10 2018
(Python)
def ok(n): return str(2**n)[0] == str(5**n)[0]
print([k for k in range(1100) if ok(k)]) # Michael S. Branicky, Nov 03 2022
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Lekraj Beedassy, Dec 01 2003
EXTENSIONS
Edited by Robert G. Wilson v, Dec 02 2003
STATUS
approved