login
A018856
2^a(n) is the smallest power of 2 beginning with n.
11
0, 1, 5, 2, 9, 6, 46, 3, 53, 10, 50, 7, 17, 47, 77, 4, 34, 54, 84, 11, 31, 51, 61, 81, 8, 18, 38, 48, 68, 78, 98, 5, 25, 35, 45, 55, 75, 85, 95, 12, 22, 32, 42, 145, 52, 62, 72, 82, 92, 102, 9, 19, 29, 39, 142, 49, 59, 162, 69, 79, 89, 192, 99, 6, 16, 119, 26
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
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
Cf. A018802.
Cf. A100129 (a(n) = n).
Sequence in context: A367844 A258503 A180726 * A019093 A329986 A097897
KEYWORD
nonn,base
STATUS
approved