A333332 Positive numbers k at which min{abs(2^k - 10^y)/10^y: y in Z} reaches a new minimum.
1, 2, 3, 10, 93, 196, 485, 2136, 13301, 28738, 42039, 70777, 254370, 325147, 6107016, 6432163, 44699994, 51132157, 146964308, 198096465, 345060773, 1578339557, 1923400330, 82361153417, 496090320832, 578451474249, 2809896217828, 6198243909905, 21404627947543
Offset: 1
Keywords
Programs
-
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))
Extensions
More terms from Hugo Pfoertner, May 01 2020
Comments