cp's OEIS Frontend

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.

Showing 1-10 of 10 results.

A030000 a(n) is the smallest nonnegative number k such that the decimal expansion of 2^k contains the string n.

Original entry on oeis.org

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, 18, 15, 7, 32, 22, 17, 5, 25, 27, 25, 16, 30, 14, 42, 12, 22, 19, 22, 18, 28, 42, 31, 11, 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
Offset: 0

Views

Author

Keywords

Comments

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

Examples

			2^12 = 4096 is first power of 2 containing a 9, so a(9) = 12.
		

Crossrefs

Cf. A030001 (the actual powers of 2), A063565, A018856, A000079, A372044, A372045.
See also A321043.

Programs

  • Haskell
    import Data.List (isInfixOf, findIndex)
    import Data.Maybe (fromJust)
    a030000 n =
       fromJust $ findIndex (show n `isInfixOf`) $ map show a000079_list
    -- Reinhard Zumkeller, Aug 04 2011
    
  • Mathematica
    Table[ i=0; While[ StringPosition[ ToString[ 2^i ], ToString[ n ] ]=={}, i++ ]; i, {n, 0, 80} ]
    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 *)
  • 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
    
  • 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
    
  • Python
    def a(n):
      k, strn = 0, str(n)
      while strn not in str(2**k): k += 1
      return k
    print([a(n) for n in range(74)]) # Michael S. Branicky, Mar 06 2021

Formula

a(n) <= A018856(n) for n >= 1. - Pontus von Brömssen, Jul 21 2021

Extensions

More terms from Hans Havermann

A006889 Exponent of least power of 2 having n consecutive 0's in its decimal representation.

Original entry on oeis.org

0, 10, 53, 242, 377, 1491, 1492, 6801, 14007, 100823, 559940, 1148303, 4036338, 4036339, 53619497, 119476156, 146226201, 918583174, 4627233991, 11089076233
Offset: 0

Views

Author

P. D. Mitchelmore (dh115(AT)city.ac.uk)

Keywords

Comments

A224782(a(n)) = n and A224782(m) <> n for m < a(n). - Reinhard Zumkeller, Apr 30 2013
The name of this sequence previously began "Least power of 2 having exactly n consecutive 0's...". The word "exactly" was unnecessary because the least power of 2 having at least n consecutive 0's in its decimal representation will always have exactly n consecutive 0's. The previous power of two will have had n-1 consecutive 0's with a "5" immediately to the left. - Clive Tooth, Jan 22 2016
a(20) is greater than 12*10^9. - Benjamin Chaffin, Jan 18 2017

Examples

			2^53619497 is the smallest power of 2 to contain a run of 14 consecutive zeros in its decimal form.
2^119476156 (a 35965907-digit number) contains the sequence ...40030000000000000008341... about one third of the way through.
2^4627233991 (a 1392936229-digit number) contains the sequence "813000000000000000000538" about 99.5% of the way through. The computation took about six months.
		

References

  • Julian Havil, Impossible?: Surprising Solutions to Counterintuitive Conundrums, Princeton University Press 2008, chapter 15, p. 176ff
  • Popular Computing (Calabasas, CA), Zeros in Powers of 2, Vol. 3 (No. 25, Apr 1975), page PC25-16 [Gives a(1)-a(8)]
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Haskell
    import Data.List (elemIndex)
    import Data.Maybe (fromJust)
    a006889 = fromJust . (`elemIndex` a224782_list)
    -- Reinhard Zumkeller, Apr 30 2013
    
  • Maple
    A[0]:= 0:
    m:= 1:
    for n from 1 while m <= 9 do
      S:= convert(2^n,string);
      if StringTools:-Search(StringTools:-Fill("0",m),S) <> 0 then
        A[m]:= n;
        m:= m+1;
      fi
    od:
    seq(A[i],i=0..9); # Robert Israel, Jan 22 2016
  • Mathematica
    a = ""; Do[ a = StringJoin[a, "0"]; k = 1; While[ StringPosition[ ToString[2^k], a] == {}, k++ ]; Print[k], {n, 1, 10} ] (* Robert G. Wilson v, edited by Clive Tooth, Jan 25 2016 *)
  • PARI
    conseczerorec(n) = my(d=digits(n), i=0, r=0, x=#Str(n)); while(x > 0, while(d[x]==0, i++; x--); if(i > r, r=i); i=0; x--); r
    a(n) = my(k=0); while(conseczerorec(2^k) < n, k++); k \\ Felix Fröhlich, Sep 27 2016

Extensions

3 more terms from Clive Tooth, Jan 24 2001
One more term from Clive Tooth, Nov 28 2001
One more term from Sacha Roscoe (scarletmanuka(AT)iprimus.com.au), Dec 16 2002
a(17) from Sacha Roscoe (scarletmanuka(AT)iprimus.com.au), Feb 06 2007
a(18) from Clive Tooth, Sep 30 2012
Name clarified by Clive Tooth, Jan 22 2016
Definition clarified by Felix Fröhlich, Sep 27 2016
a(19) from Benjamin Chaffin, Jan 18 2017

A176763 Smallest power of 3 whose decimal expansion contains n.

Original entry on oeis.org

59049, 1, 27, 3, 243, 6561, 6561, 27, 81, 9, 10460353203, 1162261467, 129140163, 31381059609, 177147, 1594323, 129140163, 177147, 2187, 19683, 387420489, 2187, 1162261467, 1594323, 243, 2541865828329, 1162261467, 27, 282429536481, 729, 43046721, 531441, 1594323
Offset: 0

Views

Author

Jonathan Vos Post, Apr 25 2010

Keywords

Comments

This is to 3 as A030001 is to 2.

Examples

			a(1) = 1 because 3^0 = 1 has "1" as a substring (not a proper substring, though).
a(2) = 27 because 3^3 = 27 has "2" as a substring.
a(10) = 10460353203 because 3^21 = 10460353203 is the smallest power of 3 whose decimal expansion contains "10" (in this case, "10" happens to be the left-hand or initial digits, but that is not generally true).
		

Crossrefs

Programs

  • Mathematica
    A176763[n_] := Block[{k = -1}, While[StringFreeQ[IntegerString[3^++k], IntegerString[n]]]; 3^k]; Array[A176763, 50, 0] (* Paolo Xausa, Apr 03 2024 *)
  • Python
    def a(n):
        k, strn = 0, str(n)
        while strn not in str(3**k): k += 1
        return 3**k
    print([a(n) for n in range(33)]) # Michael S. Branicky, Apr 03 2024

Formula

a(n) = MIN{A000244(i) such that n in decimal representation is a substring of A000244(i)}.

Extensions

More terms from Sean A. Irvine and Jon E. Schoenfield, May 05 2010
a(0) prepended by Paolo Xausa, Apr 03 2024

A131535 Exponent of least power of 2 having exactly n consecutive 1's in its decimal representation.

Original entry on oeis.org

1, 0, 40, 42, 313, 485, 1841, 8923, 8554, 81783, 165742, 1371683, 1727601, 9386566, 28190643, 63416789
Offset: 0

Views

Author

Shyam Sunder Gupta, Aug 26 2007

Keywords

Examples

			a(3)=42 because 2^42(i.e. 4398046511104) is the smallest power of 2 to contain a run of 3 consecutive ones in its decimal form.
		

Crossrefs

Programs

  • Mathematica
    a = ""; Do[ a = StringJoin[a, "1"]; b = StringJoin[a, "1"]; k = 1; While[ StringPosition[ ToString[2^k], a] == {} || StringPosition[ ToString[2^k], b] != {}, k++ ]; Print[k], {n, 1, 10} ]
  • Python
    def A131535(n):
        s, t, m, k, u = '1'*n, '1'*(n+1), 0, 1, '1'
        while s not in u or t in u:
            m += 1
            k *= 2
            u = str(k)
        return m # Chai Wah Wu, Jan 28 2020

Extensions

2 more terms from Sean A. Irvine, Jul 19 2010
a(13)-a(14) from Lars Blomberg, Jan 24 2013
a(15) from Bert Dobbelaere, Feb 25 2019
a(0) added and a(1) corrected by Chai Wah Wu, Jan 28 2020

A259089 Least k such that 2^k has at least n consecutive 2's in its decimal representation.

Original entry on oeis.org

0, 1, 43, 43, 314, 314, 2354, 8555, 13326, 81784, 279272, 865356, 1727602, 1727602
Offset: 0

Views

Author

N. J. A. Sloane, Jun 18 2015

Keywords

Examples

			a(3)=43 because 2^43 (i.e. 8796093022208) is the smallest power of 2 to contain a run of 3 consecutive twos in its decimal form.
		

Crossrefs

Programs

  • Mathematica
    Table[k = 0; While[! SequenceCount[IntegerDigits[2^k], ConstantArray[2, n]] > 0, k++]; k, {n, 10}] (* Robert Price, May 17 2019 *)
  • Python
    def A259089(n):
        s, k, k2 = '2'*n, 0, 1
        while True:
            if s in str(k2):
                return k
            k += 1
            k2 *= 2 # Chai Wah Wu, Jun 19 2015

Extensions

a(7)-a(13) from Chai Wah Wu, Jun 20 2015
Definition corrected by Manfred Scheucher, Jun 23 2015
a(0) prepended by Chai Wah Wu, Jan 28 2020

A259091 Smallest k such that 2^k contains two adjacent copies of n in its decimal expansion.

Original entry on oeis.org

53, 40, 43, 25, 18, 16, 46, 24, 19, 33, 378, 313, 170, 374, 361, 359, 64, 34, 507, 151, 348, 246, 314, 284, 349, 314, 261, 151, 385, 166, 156, 364, 65, 219, 371, 359, 503, 148, 155, 352, 349, 308, 247, 255, 192, 387, 165, 149, 171, 150, 210, 155, 209, 101, 505
Offset: 0

Views

Author

N. J. A. Sloane, Jun 18 2015

Keywords

Comments

The multi-digit generalization of A171132. - R. J. Mathar, Jul 06 2015

Examples

			2^53 = 9007199254740992 contains two adjacent 0's.
		

Crossrefs

Programs

  • Mathematica
    Table[k = 0; While[! SequenceCount[IntegerDigits[2^k], Flatten[ConstantArray[IntegerDigits[n], 2]]] > 0, k++]; k, {n, 0, 100}] (* Robert Price, May 17 2019 *)
  • Python
    def A259091(n):
        s, k, k2 = str(n)*2, 0, 1
        while True:
            if s in str(k2):
                return k
            k += 1
            k2 *= 2 # Chai Wah Wu, Jun 18 2015

Extensions

More terms from Chai Wah Wu, Jun 18 2015

A259092 Smallest k such that 2^k contains three adjacent copies of n in its decimal expansion.

Original entry on oeis.org

242, 42, 43, 83, 44, 41, 157, 24, 39, 50, 949, 1841, 3661, 1798, 1701, 1161, 1806, 391, 1890, 2053, 950, 1164, 2354, 1807, 3816, 1800, 1799, 818, 1702, 2115, 904, 1798, 1807, 2270, 392, 1699, 3022, 394, 2054, 1758, 1804, 2300, 2720, 2403, 3396, 1133, 1808, 3820
Offset: 0

Views

Author

N. J. A. Sloane, Jun 18 2015

Keywords

Comments

The multi-digit generalization of A171242. - R. J. Mathar, Jul 06 2015

Examples

			2^242 = 7067388259113537318333190002971674063309935587502475832486424805170479104 contains three adjacent 0's.
		

Crossrefs

Programs

  • Mathematica
    Table[k = 0; While[! SequenceCount[IntegerDigits[2^k], Flatten[ConstantArray[IntegerDigits[n], 3]]] > 0, k++]; k, {n, 0, 50}] (* Robert Price, May 17 2019 *)
  • Python
    def A259092(n):
        s, k, k2 = str(n)*3, 0, 1
        while True:
            if s in str(k2):
                return k
            k += 1
            k2 *= 2 # Chai Wah Wu, Jun 18 2015

Extensions

More terms from Chai Wah Wu, Jun 18 2015

A186774 Smallest power of n whose decimal expansion contains n+1, or 0 if no such number exists.

Original entry on oeis.org

32, 243, 256, 625, 7776, 16807, 4096, 31381059609, 0, 121, 79496847203390844133441536, 51185893014090757, 155568095557812224, 22168378200531005859375, 17592186044416, 118587876497, 11019960576, 42052983462257059
Offset: 2

Views

Author

Jonathan Vos Post, Feb 26 2011

Keywords

Comments

More precisely: smallest power of n (with positive integer exponent) whose decimal expansion contains n+1 as a substring of consecutive decimal digits. This is A[n,n+1], the diagonal above the trivial main diagonal of the array A[k,n] = Smallest power of k whose decimal expansion contains n.
The k=2 row A[2,n] = A030001.
The k=3 row A[3,n] = A176763.
The k=4 row A[4,n] = A176764.
The k=5 row A[5,n] = A176765...
a(10^k+1) = (10^k+1)^2 for k > 0. - Chai Wah Wu, Feb 13 2017

Examples

			a(2) = 32 = A030001(3) = smallest power of 2 whose decimal expansion contains 3.
a(3) = 243 = A176763(4) = smallest power of 3 whose decimal expansion contains 4.
		

Crossrefs

Programs

  • Maple
    a:= proc(n) local t, k;
          if type(simplify(log[10](n)), integer) then 0
        else t:= cat(n+1);
             for k from 2 while searchtext(t, cat(n^k))=0
             do od; n^k
          fi
        end:
    seq(a(n), n=2..40);  # Alois P. Heinz, Feb 26 2011
  • Python
    def A186774(n):
        if sum(int(d) for d in str(n)) == 1:
            return 0
        sn, k = str(n+1), 1
        while sn not in str(k):
            k *= n
        return k # Chai Wah Wu, Feb 13 2017

A371904 a(1) = 1; for n > 1, a(n) is the smallest unused positive number such that 2^a(n) contains a(n-1) as a substring.

Original entry on oeis.org

1, 4, 2, 5, 8, 3, 14, 18, 30, 22, 43, 25, 41, 44, 38, 23, 58, 33, 63, 55, 16, 24, 10, 17, 27, 15, 21, 31, 49, 32, 45, 28, 7, 20, 11, 40, 12, 9, 13, 37, 47, 36, 29, 60, 59, 35, 52, 19, 53, 79, 34, 65, 42, 50, 54, 39, 61, 62, 66, 46, 64, 6, 26, 71, 48, 51, 57, 56, 68, 75, 67, 78, 74, 70, 69, 72
Offset: 1

Views

Author

Scott R. Shannon, Apr 11 2024

Keywords

Comments

The sequence is conjectured to be a permutation of the positive integers.

Examples

			a(2) = 4 as 2^4 = 16 which contains a(n-1) = a(1) = '1' as a substring.
a(7) = 14 as 2^14 = 16384 which contains a(n-1) = a(6) = '3' as a substring. Note that 2^5 = 32 also contains '3' as a substring but 5 has already been used.
		

Crossrefs

A371918 The smallest unused positive number such that 2^a(n) contains n as a substring.

Original entry on oeis.org

10, 4, 1, 5, 2, 8, 6, 15, 3, 12, 17, 40, 7, 27, 18, 21, 14, 34, 30, 13, 11, 24, 43, 41, 19, 50, 28, 38, 47, 32, 22, 49, 25, 63, 33, 35, 16, 37, 23, 42, 53, 44, 59, 45, 46, 52, 60, 31, 20, 39, 54, 9, 51, 29, 74, 57, 48, 56, 61, 69, 55, 58, 66, 76, 26, 73, 72, 36, 62, 82, 64, 70, 77, 67, 65, 91, 78
Offset: 0

Views

Author

Scott R. Shannon, Apr 12 2024

Keywords

Comments

The sequence is conjectured to be a permutation of the positive integers.

Examples

			a(0) = 10 as 2^10 = 1024 which contains '0' as a substring.
a(6) = 6 as 2^6 = 64 which contains '6' as a substring. Note that 2^4 also contains '6' but 4 has already been used. This is the first term to differ from A063565.
		

Crossrefs

Showing 1-10 of 10 results.