login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A030001 Smallest power of 2 whose decimal expansion contains n. 17
1024, 1, 2, 32, 4, 256, 16, 32768, 8, 4096, 1024, 1099511627776, 128, 131072, 262144, 2097152, 16, 134217728, 1073741824, 8192, 2048, 262144, 8796093022208, 2199023255552, 1024, 256, 262144, 32768, 128, 4294967296, 4194304, 131072, 32, 33554432, 134217728, 33554432 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,1
LINKS
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
Cf. A030000 (the exponents), A000079.
Sequence in context: A212934 A263168 A336779 * A176764 A351262 A336778
KEYWORD
nonn,base,nice,look
AUTHOR
EXTENSIONS
a(30) corrected by Reinhard Zumkeller, Nov 02 2011
a(0) added by N. J. A. Sloane, Jul 04 2017
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 04:29 EDT 2024. Contains 371782 sequences. (Running on oeis4.)