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 26 results. Next

A027870 Number of zero digits in 2^n.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 2, 3, 1, 1, 1, 1, 1, 0, 1, 0, 2, 3, 2, 2, 2, 1, 1, 2, 2, 3, 2, 2, 2, 1, 1, 0, 1, 3, 3, 1, 0, 1, 1, 1, 0, 0, 2, 4, 2, 0, 2, 3, 1, 1, 0, 3, 5, 3, 3, 4, 2, 3, 4, 1, 1, 4, 5, 5, 6, 6, 7, 5, 5
Offset: 0

Views

Author

Keywords

Comments

I conjecture that any value x = 0, 1, 2, ... occurs only a finite number of times N(x) = 36, 41, 31, 34, 25, 32, 37, 23, 43, 47, 33, ... in this sequence, for the last time at well defined indices i(x) = 86, 229, 231, 359, 283, 357, 475, 476, 649, 733, 648, ... - M. F. Hasler, Jul 09 2025

Examples

			2^31 = 2147483648 so a(31) = 0 and 2^42 = 4398046511104 so a(42) = 2.
		

Crossrefs

Cf. A000079 (powers of 2), A007377 (2^n has no zeros).
Similar for other digits: A065712 (1's), A065710 (2's), A065714 (3's), A065715 (4's), A065716 (5's), A065717 (6's), A065718 (7's), A065719 (8's), A065744 (9's).
Cf. A031146 (index of first appearance of n in this sequence), A094776 (index of last occurrence of digit n in powers of 2).
Cf. A305932 (table with n in row a(n)).

Programs

  • Haskell
    a027870 = a055641 . a000079  -- Reinhard Zumkeller, Apr 30 2013
    
  • Mathematica
    Table[ Count[ IntegerDigits[2^n], 0], {n, 0, 100} ]
    DigitCount[2^Range[0,110],10,0] (* Harvey P. Dale, Nov 20 2011 *)
  • PARI
    A027870(n)=#select(d->!d,digits(2^n)) \\ M. F. Hasler, Jun 14 2018
    
  • Python
    def A027870(n):
        return str(2**n).count('0') # Chai Wah Wu, Feb 14 2020

Formula

a(n) = A055641(A000079(n)). - Reinhard Zumkeller, Apr 30 2013
a(A007377(n)) = 0; A224782(n) <= a(n). - Reinhard Zumkeller, Apr 30 2013

Extensions

Edited by M. F. Hasler, Jul 09 2025

A065710 Number of 2's in the decimal expansion of 2^n.

Original entry on oeis.org

0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 2, 2, 0, 2, 0, 0, 1, 1, 0, 2, 1, 1, 1, 1, 2, 1, 0, 0, 0, 1, 1, 0, 1, 4, 0, 3, 1, 2, 0, 1, 1, 3, 3, 3, 1, 2, 0, 1, 2, 1, 2, 2, 2, 3, 1, 3, 0, 2, 2, 3, 3, 2, 2, 4, 4, 4, 0, 1, 2, 4, 3, 1, 3, 6, 2, 0, 2, 4, 4, 4, 2, 3, 6, 2, 1, 5, 1, 2, 4, 4, 1, 2, 6
Offset: 0

Views

Author

Benoit Cloitre, Dec 04 2001

Keywords

Comments

See A034293 for indices of zeros: It is conjectured that the last 0 appears at index 168 = A094776(2). More generally, I conjecture that any value x = 0, 1, 2, 3, ... occurs only a finite number of times N(x) = 23, 35, 28, 26, 41, 37, 34, 26, 34, 38, 33, 41, ... in this sequence, for the last time at a well defined index i(x) = 168, 176, 186, 268, 423, 361, 472, 555, 470, 562, 563, 735, .... - M. F. Hasler, Feb 10 2023, edited by M. F. Hasler, Jul 09 2025

Examples

			2^31 = 2147483648 so a(31) = 1.
		

Crossrefs

Cf. 0's A027870, 1's A065712, 3's A065714, 4's A065715, 5's A065716, 6's A065717, 7's A065718, 8's A065719, 9's A065744.
Cf. A034293, A094776 (largest k for which 2^k has no digit n).

Programs

  • Maple
    seq(numboccur(2, convert(2^n,base,10)),n=0..100); # Robert Israel, Jul 09 2025
  • Mathematica
    Table[ Count[ IntegerDigits[2^n], 2], {n, 0, 100} ]
  • PARI
    a(n) = #select(x->(x==2), digits(2^n)); \\ Michel Marcus, Jun 15 2018
    
  • Python
    def A065710(n):
        return str(2**n).count('2') # Chai Wah Wu, Feb 14 2020

Formula

a(n) = a(floor(n/10)) + [n == 2 (mod 10)], where [...] is the Iverson bracket. - M. F. Hasler, Feb 10 2023

Extensions

More terms from Robert G. Wilson v, Dec 07 2001

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

A063565 Smallest positive number k such that 2^k contains n.

Original entry on oeis.org

10, 4, 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

Robert G. Wilson v, Aug 10 2001

Keywords

Examples

			a(7) = 15 because 2^15 = 32768.
		

Crossrefs

Apart from initial term, a duplicate of A030000.

Programs

  • Mathematica
    a = {}; Do[k = 1; While[ StringPosition[ ToString[2^k], ToString[n] ] == {}, k++ ]; a = Append[a, k], {n, 0, 50} ]; a
  • Python
    def A063565(n):
        s, k, k2 = str(n), 1, 2
        while True:
            if s in str(k2):
                return k
            k += 1
            k2 *= 2 # Chai Wah Wu, Jun 20 2015

Extensions

More terms from Hans Havermann

A065714 Number of 3's in decimal expansion of 2^n.

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 3, 0, 1, 1, 1, 1, 1, 0, 1, 0, 4, 1, 3, 0, 1, 0, 1, 1, 1, 0, 3, 1, 3, 0, 2, 0, 1, 2, 0, 1, 2, 2, 0, 2, 3, 0, 4, 1, 3, 1, 4, 2, 1, 1, 1, 2, 3, 2, 3, 1, 2, 4, 1, 4, 3, 0, 3, 2, 3, 4, 4, 3, 3, 2, 1, 3, 0, 0, 4, 2, 2, 6, 1, 4, 4, 2
Offset: 0

Views

Author

Benoit Cloitre, Dec 04 2001

Keywords

Comments

I conjecture that any value x = 0, 1, 2, ... occurs only a finite number of times N(x) = 34, 34, 24, 34, 39, 34, 35, 34, 35, 32, 33, 31, ... in this sequence, for the last time at well defined indices i(x) = 153, 139, 226, 237, 308, 386, 413, 506, 461, 578, 644, 732, 857, 657, 743, 768, 784, 848, 906, ... - M. F. Hasler, Jul 09 2025

Examples

			2^5 = 32 so a(5)=1.
		

Crossrefs

Cf. A000079 (powers of 2), A035058 (2^n does not contain the digit 3).
Similar for other digits: A027870 (0's), A065712 (1's), A065710 (2's), this (3's), A065715 (4's), A065716 (5's), A065717 (6's), A065718 (7's), A065719 (8's), A065744 (9's).
Cf. A094776 (index of last occurrence of digit n in powers of 2).

Programs

  • Mathematica
    Table[ Count[ IntegerDigits[2^n], 3], {n, 0, 100} ]
  • PARI
    a(n) = #select(x->(x==3), digits(2^n)); \\ Michel Marcus, Jun 15 2018
    
  • Python
    def A065714(n):
        return str(2**n).count('3') # Chai Wah Wu, Feb 14 2020

Extensions

More terms from Robert G. Wilson v, Dec 07 2001

A034293 Numbers k such that 2^k does not contain the digit 2 (probably finite).

Original entry on oeis.org

0, 2, 3, 4, 6, 12, 14, 16, 20, 22, 23, 26, 34, 35, 36, 39, 42, 46, 54, 64, 74, 83, 168
Offset: 1

Views

Author

Keywords

Comments

Is 168 the last term?
First row of A136291. - R. J. Mathar Apr 29 2008
Equivalently, indices of zeros in A065710. - M. F. Hasler, Feb 10 2023

Examples

			Here is 2^168, conjecturally the largest power of 2 that does not contain a 2: 374144419156711147060143317175368453031918731001856. - _N. J. A. Sloane_, Feb 10 2023
		

Crossrefs

Cf. A007377.
See also similar sequences listed in A035064.
Cf. A065710 (number of '2's in 2^n), A094776.

Programs

Formula

The last term is A094776(2), by definition. - M. F. Hasler, Feb 10 2023

Extensions

Edited by N. J. A. Sloane, Oct 03 2007
Removed keyword "fini" since it is only a conjecture that this sequence contains only finitely many terms. - Altug Alkan, May 07 2016

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

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

Original entry on oeis.org

0, 1, 51, 43, 692, 314, 2354, 8555, 13326, 81784, 279272, 865356, 1727608, 1727602, 23157022, 63416790
Offset: 0

Views

Author

Shyam Sunder Gupta, Aug 26 2007

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
    a = ""; Do[ a = StringJoin[a, "2"]; b = StringJoin[a, "2"]; k = 1; While[ StringPosition[ ToString[2^k], a] == {} || StringPosition[ ToString[2^k], b] != {}, k++ ]; Print[k], {n, 1, 10} ]
  • Python
    def A131536(n):
        s, t, m, k, u = '2'*n, '2'*(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

3 more terms from Sean A. Irvine, Jul 19 2010
a(14) from Lars Blomberg, Jan 24 2013
a(15) from Bert Dobbelaere, Feb 25 2019
a(0) from 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

A259081 a(n) = largest k such that the decimal representation of 3^k does not contain the digit n.

Original entry on oeis.org

68, 43, 59, 84, 106, 91, 104, 101, 100, 56
Offset: 0

Views

Author

N. J. A. Sloane, Jun 18 2015

Keywords

Comments

These values are only conjectural.

Crossrefs

Showing 1-10 of 26 results. Next