OFFSET
1,3
REFERENCES
A. M. Yaglom and I. M. Yaglom, Challenging Mathematical Problems With Elementary Solutions, Vol. 1, pp. 29, 199-200, Prob. 91a, Dover, NY, 1987.
LINKS
Daniel Mondot, Table of n, a(n) for n = 1..32699
MATHEMATICA
f[n_] := Block[{k = 1, m = Floor[ Log[10, n]]}, While[ Log[10, 2^k] < Floor[ Log[10, n]], k++ ]; While[ Quotient[2^k, 10^(Floor[k*Log[10, 2]] - m)] != n, k++ ]; k]; f[1] = 0;; Array[f, 73] (* Robert G. Wilson v, Jun 02 2009 *)
PROG
(Haskell)
import Data.List (isPrefixOf, findIndex)
import Data.Maybe (fromJust)
a018856 n =
fromJust $ findIndex (show n `isPrefixOf`) $ map show a000079_list
-- Reinhard Zumkeller, Aug 04 2011
(Python)
from itertools import count
def aupton(terms):
adict, pow2 = dict(), 1
for i in count(0):
s = str(pow2)
for j in range(len(s)):
t = int(s[:j+1])
if t > terms:
break
if t not in adict:
adict[t] = i
if len(adict) == terms:
return [adict[i+1] for i in range(terms)]
pow2 *= 2
print(aupton(67)) # Michael S. Branicky, Apr 08 2023
CROSSREFS
KEYWORD
nonn,base
AUTHOR
STATUS
approved