OFFSET
1,2
COMMENTS
If {k(n)/y(n)} are the convergent fractions to log_2(10), then numerators k(n) are in A073733, and denominators y(n) are in A046104; now, k and y means k(n) and y(n): k/y ~ log_2(10) <==> 2^(k/y) ~ 10 <==> 2^k ~ 10^y <==> lim_{n->oo} (2^k / 10^y) = 1 <==> lim_{n->oo} abs(2^k/10^y - 1) = 0 <==> lim_{n->oo} abs(2^k - 10^y)/10^y = 0, that corresponds to the name. - Bernard Schott, Apr 29 2020
PROG
(Python)
def closest_powers_of_2_to_10(n):
smallest_error = 1
a = []
r = 0.2 # ratio test starts at 2/10
k = 1
while len(a) < n:
error = abs(1-r)
if error < smallest_error:
smallest_error = error
a.append(k)
print(a)
if r<1.0:
r *= 2
else:
r /= 10
k -= 1 # need to check the other power of 10
k += 1
return a
print(closest_powers_of_2_to_10(20))
CROSSREFS
KEYWORD
nonn
AUTHOR
Zachary Hervieux-Moore, Mar 15 2020
EXTENSIONS
More terms from Hugo Pfoertner, May 01 2020
STATUS
approved