This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A030000 #64 Mar 16 2025 12:52:22 %S A030000 10,0,1,5,2,8,4,15,3,12,10,40,7,17,18,21,4,27,30,13,11,18,43,41,10,8, %T A030000 18,15,7,32,22,17,5,25,27,25,16,30,14,42,12,22,19,22,18,28,42,31,11, %U A030000 32,52,9,19,16,25,16,8,20,33,33,23,58,18,14,6,16,46,24,15,34,29,21,17,30 %N A030000 a(n) is the smallest nonnegative number k such that the decimal expansion of 2^k contains the string n. %C A030000 a(n) is well-defined for all n, because 2^k can actually start with (not just contain) any finite sequence of digits without leading zeros. This follows from the facts that log_10(2) is irrational and that the set of fractional parts of n*x is dense in [0,1] if x is irrational. - _Pontus von Brömssen_, Jul 21 2021 %H A030000 Giovanni Resta, <a href="/A030000/b030000.txt">Table of n, a(n) for n = 0..10000</a> (terms up to a(1000) from T. D. Noe, a(9634) corrected by Piotr Idzik) %F A030000 a(n) <= A018856(n) for n >= 1. - _Pontus von Brömssen_, Jul 21 2021 %e A030000 2^12 = 4096 is first power of 2 containing a 9, so a(9) = 12. %t A030000 Table[ i=0; While[ StringPosition[ ToString[ 2^i ], ToString[ n ] ]=={}, i++ ]; i, {n, 0, 80} ] %t A030000 snn[n_]:=Module[{k=0},While[SequenceCount[IntegerDigits[2^k],IntegerDigits[n]]==0,k++];k]; Array[snn,100,0] (* _Harvey P. Dale_, Mar 16 2025 *) %o A030000 (Haskell) %o A030000 import Data.List (isInfixOf, findIndex) %o A030000 import Data.Maybe (fromJust) %o A030000 a030000 n = %o A030000 fromJust $ findIndex (show n `isInfixOf`) $ map show a000079_list %o A030000 -- _Reinhard Zumkeller_, Aug 04 2011 %o A030000 (PARI) a(n) = {if (n==1, return (0)); my(k=1, sn = Str(n)); while (#strsplit(Str(2^k), sn) == 1, k++); k;} \\ _Michel Marcus_, Mar 06 2021 %o A030000 (PARI) apply( A030000(n)={n=Str(n);for(k=0,oo,#strsplit(Str(2^k),n)>1&& return(k))}, [0..99]) \\ Also allows to search for digit strings with leading zeros, e.g., "00" => k=53. - _M. F. Hasler_, Jul 11 2021 %o A030000 (Python) %o A030000 def a(n): %o A030000 k, strn = 0, str(n) %o A030000 while strn not in str(2**k): k += 1 %o A030000 return k %o A030000 print([a(n) for n in range(74)]) # _Michael S. Branicky_, Mar 06 2021 %Y A030000 Cf. A030001 (the actual powers of 2), A063565, A018856, A000079, A372044, A372045. %Y A030000 See also A321043. %K A030000 nonn,base %O A030000 0,1 %A A030000 _N. J. A. Sloane_ %E A030000 More terms from _Hans Havermann_