OFFSET
0,1
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
MATHEMATICA
a[n_] := (k = 0; While[ !MatchQ[ IntegerDigits[2^k], {___, Sequence @@ IntegerDigits[n], ___}], k++]; 2^k); Table[a[n], {n, 1, 30}](* Jean-François Alcover, Nov 30 2011 *)
Module[{p2=2^Range[0, 50]}, Table[SelectFirst[p2, SequenceCount[ IntegerDigits[ #], IntegerDigits[ n]]>0&], {n, 0, 40}]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Dec 13 2019 *)
PROG
(Haskell)
import Data.List (isInfixOf)
a030001 n = head $ filter ((show n `isInfixOf`) . show) a000079_list
-- Reinhard Zumkeller, Nov 02 2011
(Python)
def a(n):
k, strn = 0, str(n)
while strn not in str(2**k): k += 1
return 2**k
print([a(n) for n in range(36)]) # Michael S. Branicky, Apr 03 2024
CROSSREFS
KEYWORD
AUTHOR
EXTENSIONS
a(30) corrected by Reinhard Zumkeller, Nov 02 2011
a(0) added by N. J. A. Sloane, Jul 04 2017
STATUS
approved