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.

Previous Showing 11-20 of 22 results. Next

A117970 Position of first 0 counting from the least significant digit in the ternary expansion of 2^n.

Original entry on oeis.org

0, 0, 0, 0, 0, 3, 2, 2, 4, 4, 5, 4, 2, 2, 4, 0, 3, 4, 2, 2, 3, 3, 8, 3, 2, 2, 5, 5, 6, 5, 2, 2, 11, 4, 3, 5, 2, 2, 3, 3, 11, 3, 2, 2, 5, 8, 4, 5, 2, 2, 13, 5, 3, 5, 2, 2, 3, 3, 4, 3, 2, 2, 4, 4, 7, 4, 2, 2, 4, 6, 3, 4, 2, 2, 3, 3, 7, 3, 2, 2, 6, 6, 7, 6, 2, 2, 10, 4, 3, 7, 2, 2, 3, 3, 5, 3, 2, 2, 11, 5, 4, 17
Offset: 0

Views

Author

Eric W. Weisstein, Apr 06 2006

Keywords

Crossrefs

Programs

  • PARI
    a(n) = { my (p=2^n); for (k=1, oo, if (p==0, return (0), p%3==0, return (k), p\=3)) } \\ Rémy Sigrist, Dec 20 2019

Extensions

Edited by Charles R Greathouse IV, Aug 05 2010
a(0) = 0 prepended by Rémy Sigrist, Dec 20 2019

A004645 Powers of 2 written in base 6.

Original entry on oeis.org

1, 2, 4, 12, 24, 52, 144, 332, 1104, 2212, 4424, 13252, 30544, 101532, 203504, 411412, 1223224, 2450452, 5341344, 15123132, 34250304, 112541012, 225522024, 455444052, 1355332144, 3155104332, 10354213104
Offset: 0

Views

Author

Keywords

Crossrefs

Cf. A000079, A004642, ..., A004655: powers of 2 written in base 10, 3, 4, ..., 16
Cf. A000244, A004656, A004658, A004659, ... : powers of 3 written in base 10, 2, 4, 5, ...

Programs

  • Magma
    [Seqint(Intseq(2^n, 6)): n in [0..30]]; // G. C. Greubel, Sep 10 2018
  • Mathematica
    Table[FromDigits[IntegerDigits[2^n, 6]], {n, 0, 40}] (* Vincenzo Librandi, Jun 07 2013 *)
  • PARI
    a(n)=fromdigits(digits(2^n,6)) \\ M. F. Hasler, Jun 23 2018
    

A117971 One-based position of the first 2 from the least significant digit in the ternary expansion of 2^n, or 0 if there are no 2's present.

Original entry on oeis.org

0, 1, 0, 1, 2, 1, 4, 1, 0, 1, 2, 1, 3, 1, 3, 1, 2, 1, 5, 1, 8, 1, 2, 1, 11, 1, 11, 1, 2, 1, 3, 1, 3, 1, 2, 1, 4, 1, 4, 1, 2, 1, 5, 1, 4, 1, 2, 1, 3, 1, 3, 1, 2, 1, 6, 1, 8, 1, 2, 1, 4, 1, 7, 1, 2, 1, 3, 1, 3, 1, 2, 1, 12, 1, 7, 1, 2, 1, 6, 1, 10, 1, 2, 1, 3, 1, 3, 1, 2, 1, 4, 1, 4, 1, 2, 1, 6, 1, 4, 1, 2, 1, 3, 1
Offset: 0

Views

Author

Eric W. Weisstein, Apr 06 2006

Keywords

Comments

a(0), a(2) and a(8) are the conjectured to be the only terms equal to 0.

Examples

			For n=0, 2^0 = 1 is also "1" in base-3, thus there are no 2-digits present, and therefore a(0) = 0.
For n=4, 2^4 = 16, which in base-3 is "121" as 1*(3^2) + 2*3 + 1 = 16, so the rightmost 2 occurs at two steps from the end, therefore a(4) = 2.
For n=5, 2^5 = 32, which in base-3 is "1012" as 1*(3^3) + 1*3 + 2*1 = 32, so the rightmost 2 occurs as the least significant digit (which is the position 1), therefore a(5) = 1.
		

Crossrefs

Cf. A004642 (ternary expansion of 2^n), A007089. See also A117970.

Programs

  • Mathematica
    pf2[n_]:=Module[{p=Position[Reverse[IntegerDigits[2^n,3]],2,{1},1]},If[p=={},0,p]]; Flatten[Array[pf2,110]] (* Harvey P. Dale, Nov 30 2013 *)
  • PARI
    A117971(n) = { my(n=(2^n),i=1); while(n, if(2==(n%3),return(i)); i++; n \= 3); (0); }; \\ Antti Karttunen, Mar 30 2021

Extensions

Edited by Charles R Greathouse IV, Aug 05 2010
Term a(0) = 0 prepended, examples added and the definition clarified by Antti Karttunen, Mar 30 2021

A260683 Number of 2's in the expansion of 2^n in base 3.

Original entry on oeis.org

0, 1, 0, 2, 1, 1, 1, 2, 0, 4, 2, 4, 3, 3, 2, 6, 5, 5, 3, 7, 4, 7, 5, 4, 1, 5, 2, 8, 8, 7, 9, 9, 8, 7, 7, 8, 4, 6, 8, 9, 11, 11, 7, 11, 10, 8, 9, 8, 8, 10, 11, 16, 13, 10, 9, 12, 13, 16, 12, 13, 15, 15, 11, 15, 16, 14, 14, 12, 14, 15, 14, 16, 11, 18, 11, 17, 10
Offset: 0

Views

Author

Emmanuel Vantieghem, Nov 15 2015

Keywords

Comments

Erdős conjectures that a(n) > 0 for n > 8.

Examples

			For n=5, the expansion of 2^n in number base 3 is 1012, thus: a(n)=1
For n=10, the expansion of 2^n in number base 3 is 1101221, thus: a(n)=2
		

References

  • R. K. Guy, Unsolved Problems in Number Theory, B33. [Does not seem to be in section B33.]

Crossrefs

Cf. A004642 (2^n in base 3), A020915 (number of terms), A036461 (number of 1's), A104320 (number of 0's).
Cf. A000108 (conjecture that A000108(n) is 6m+1 only for n = 0, 1 and 5 follows from Erdős's one).
Cf. A005836 (for numbers with no 2 in base 3).

Programs

  • Maple
    seq(numboccur(2, convert(2^n,base,3)),n=0..100); # Robert Israel, Nov 15 2015
  • Mathematica
    S={};n=-1;While[n<150,n++;A=IntegerDigits[2^n,3];k=Count[A,2];AppendTo[S, k]];S
  • PARI
    c(k, d, b) = {my(c=0, f); while (k>b-1, f=k-b*(k\b); if (f==d, c++); k\=b); if (k==d, c++); return(c)}
    for(n=0, 300, print1(c(2^n, 2, 3)", ")) \\ Altug Alkan, Nov 15 2015
    
  • PARI
    a(n) = #select(x->(x==2), digits(2^n, 3)); \\ Michel Marcus, Nov 28 2018
    
  • PARI
    a(n) = hammingweight(digits(2^n, 3)\2); \\ Ruud H.G. van Tol, May 09 2024
    
  • Perl
    use ntheory ":all"; sub a260683 { scalar grep { $==2 } todigits(vecprod((2) x shift), 3) } # _Dana Jacobsen, Aug 16 2016

Formula

a(n) = A020915(n) - A104320(n) - A036461(n). - Altug Alkan, Nov 15 2015
a(n) = A081603(A000079(n)). - Michel Marcus, Dec 03 2015

A265210 Irregular triangle read by rows in which row n lists the base 3 digits of 2^n in reverse order, n >= 0.

Original entry on oeis.org

1, 2, 1, 1, 2, 2, 1, 2, 1, 2, 1, 0, 1, 1, 0, 1, 2, 2, 0, 2, 1, 1, 1, 1, 1, 0, 0, 1, 2, 2, 2, 0, 0, 2, 1, 2, 2, 1, 0, 1, 1, 2, 1, 2, 0, 1, 2, 2, 1, 0, 2, 1, 2, 1, 2, 1, 2, 0, 1, 0, 2, 0, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 1, 2, 2, 2, 1, 1, 2, 2, 2, 2, 1, 1
Offset: 0

Views

Author

L. Edson Jeffery, Dec 04 2015

Keywords

Comments

The length of row n is A020915(n) = 1 + A136409(n).
Conjecture 1: The sequence in column k is periodic, with period p(k) = 2*3^(k-1) = A008776(k-1), k >= 1, and in which the numbers 0,1,2 appear with equal frequency, for each k>1.

Examples

			n
0:    1
1:    2
2:    1  1
3:    2  2
4:    1  2  1
5:    2  1  0  1
6:    1  0  1  2
7:    2  0  2  1  1
8:    1  1  1  0  0  1
9:    2  2  2  0  0  2
10:   1  2  2  1  0  1  1
11:   2  1  2  0  1  2  2
12:   1  0  2  1  2  1  2  1
13:   2  0  1  0  2  0  2  0  1
14:   1  1  2  0  1  1  1  1  2
15:   2  2  1  1  2  2  2  2  1  1
		

Crossrefs

Cf. A000079 (powers of 2), A004642 (powers of 2 written in base 3), A008776 (2*3^n).
Cf. A265209 (base 3 digits of 2^n).
Cf. A264980 (row n read as ternary number).
Cf. A037096 (numbers constructed from the inverse case, base 2 digits of 3^n).

Programs

  • Mathematica
    (* Replace Flatten with Grid to display the triangle: *)
    Flatten[Table[Reverse[IntegerDigits[2^n, 3]], {n, 0, 15}]]
  • PARI
    A265210_row(n)=Vecrev(digits(2^n,3)) \\ M. F. Hasler, Dec 05 2015

A346497 List of powers of 2 written in base 3 which contain no zero digits.

Original entry on oeis.org

1, 2, 11, 22, 121, 1122221122
Offset: 1

Views

Author

Rafael Castro Couto, Jul 20 2021

Keywords

Comments

The listed terms are the base-3 expansions of 1, 2, 4, 8, 16, and 32768.
The program shows that there are no other terms less than 2^1000.
a(7) > 2^(10^7). - Martin Ehrenstein, Jul 27 2021
If it exists, a(7) > 2^(10^21). - Robert Saye, Mar 23 2022

References

  • David Wells, "The Penguin Dictionary of Curious and Interesting Numbers" (1997), p. 123.

Crossrefs

Cf. A102483, A004642 (all powers of 2 in base 3), A104320 (number of zeros in ternary representation of 2^n), A130693 (same problem in base 10).

Programs

  • Mathematica
    pwr = 1; Do[pwr = Mod[2*pwr, 3^100]; d = Union[IntegerDigits[pwr, 3]]; If[Intersection[d, {0}] == {}, Print[IntegerString[pwr, 3]]], {n, 10000000}] (* Ricardo Bittencourt, Jul 07 2021 *)
    Select[Table[FromDigits[IntegerDigits[2^n,3]],{n,0,100}],DigitCount[#,10,0]==0&] (* Harvey P. Dale, Feb 18 2025 *)

Formula

a(n) = A007089(2^A102483(n)). - Michel Marcus, Jul 23 2021

A364049 a(n) is the least k such that the base-n digits of 2^k are not all distinct.

Original entry on oeis.org

2, 2, 4, 5, 6, 3, 6, 11, 16, 14, 11, 12, 8, 4, 8, 15, 16, 12, 16, 18, 9, 17, 15, 14, 24, 13, 16, 15, 10, 5, 10, 19, 24, 14, 21, 15, 18, 15, 19, 17, 17, 28, 18, 12, 24, 23, 31, 24, 31, 20, 26, 44, 35, 33, 25, 18, 36, 14, 14, 18, 12, 6, 12, 23, 45, 37, 38, 24, 20, 35, 36, 26, 51, 31, 33, 47, 34, 34
Offset: 2

Views

Author

Robert Israel, Jul 03 2023

Keywords

Examples

			a(10) = 16 because 2^16 = 65536 does not have all distinct digits in base 10, while 2^k does have all distinct digits for 1 <= k <= 15.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local k,L;
      for k from 2 do
        L:= convert(2^k,base,n);
        if nops(L) <> nops(convert(L,set)) then return k fi
      od;
    end proc:
    map(f, [$2..100]);
  • Python
    from itertools import count
    from sympy.ntheory import digits
    def a(n): return next(k for k in count(2) if len(set(d:=digits(1<Michael S. Branicky, Jul 05 2023

A265209 Irregular triangle read by rows in which row n lists the base-3 digits of 2^n, n >= 0.

Original entry on oeis.org

1, 2, 1, 1, 2, 2, 1, 2, 1, 1, 0, 1, 2, 2, 1, 0, 1, 1, 1, 2, 0, 2, 1, 0, 0, 1, 1, 1, 2, 0, 0, 2, 2, 2, 1, 1, 0, 1, 2, 2, 1, 2, 2, 1, 0, 2, 1, 2, 1, 2, 1, 2, 1, 2, 0, 1, 1, 0, 2, 0, 2, 0, 1, 0, 2, 2, 1, 1, 1, 1, 0, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 2, 2
Offset: 0

Views

Author

L. Edson Jeffery, Dec 04 2015

Keywords

Comments

The length of row n is A020915(n) = 1 + A136409(n).

Examples

			Triangle begins:
  1
  2
  1  1
  2  2
  1  2  1
  1  0  1  2
  2  1  0  1
  1  1  2  0  2
  1  0  0  1  1  1
  2  0  0  2  2  2
  1  1  0  1  2  2  1
  2  2  1  0  2  1  2
  1  2  1  2  1  2  0  1
  1  0  2  0  2  0  1  0  2
  2  1  1  1  1  0  2  1  1
  1  1  2  2  2  2  1  1  2  2
		

Crossrefs

Cf. A000079 (powers of 2), A003137, A004642 (powers of 2 written in base 3).
Cf. A265210 (base 3 digits of 2^n in reverse order).

Programs

  • Mathematica
    (* Replace Flatten with Grid to display the triangle: *)
    Flatten[Table[IntegerDigits[2^n, 3], {n, 0, 15}]]
  • PARI
    for(n=0,15,for(k=1,#digits(2^n,3),print1(digits(2^n,3)[k],", "))) \\ Derek Orr, Dec 24 2015

A351927 Smallest positive integer k such that 2^k has no '0' in the last n digits of its ternary expansion.

Original entry on oeis.org

1, 2, 4, 10, 15, 15, 15, 15, 15, 15, 50, 50, 101, 101, 101, 101, 143, 143, 143, 143, 143, 143, 143, 143, 143, 1916, 1916, 1916, 1916, 1916, 1916, 82286, 1134022, 1639828, 3483159, 3483159, 3483159, 3917963, 3917963, 3917963, 4729774, 4729774, 9827775, 9827775, 43622201, 43622201, 43622201
Offset: 1

Views

Author

Robert Saye, Feb 25 2022

Keywords

Comments

The powers of two are required to have at least n ternary digits, i.e., 2^k >= 3^(n-1).
Sloane (1973) conjectured that every power 2^n with n > 15 has a '0' somewhere in its ternary expansion (see A102483 and A346497).

Crossrefs

Programs

  • Mathematica
    smallest[n_] := Module[{k}, k = Max[1, Ceiling[(n - 1) Log[2, 3]]];  While[MemberQ[Take[IntegerDigits[2^k, 3], -n], 0], ++k]; k]; Table[smallest[n], {n, 1, 20}]
  • PARI
    a(n) = my(k=1); while(!vecmin(Vec(Vecrev(digits(2^k,3)), n)), k++); k; \\ Michel Marcus, Feb 26 2022
    
  • Python
    from sympy.ntheory.digits import digits
    def a(n, startk=1):
        k = max(startk, len(bin(3**(n-1))[2:]))
        pow2 = 2**k
        while 0 in digits(pow2, 3)[-n:]:
            k += 1
            pow2 *= 2
        return k
    an = 0
    for n in range(1, 32):
        an = a(n, an)
        print(an, end=", ") # Michael S. Branicky, Mar 10 2022
    
  • Python
    from itertools import count
    def A351927(n):
        kmax, m = 3**n, (3**(n-1)).bit_length()
        k2 = pow(2,m,kmax)
        for k in count(m):
            a = k2
            if 3*a >= kmax:
                while a > 0:
                    a, b = divmod(a,3)
                    if b == 0:
                        break
                else:
                    return k
            k2 = 2*k2 % kmax # Chai Wah Wu, Mar 19 2022

A351928 Smallest positive integer k such that 2^k has no '2' in the last n digits of its ternary expansion.

Original entry on oeis.org

2, 2, 6, 8, 8, 8, 20, 24, 24, 24, 72, 186, 186, 332, 332, 1134, 1134, 1134, 1134, 1134, 1134, 25458, 25458, 25458, 25458, 25458, 25458, 159140, 249968, 249968, 249968, 249968, 249968, 249968, 249968, 249968, 9076914, 9076914, 9076914, 9076914, 9076914, 9076914, 90062678
Offset: 1

Views

Author

Robert Saye, Feb 25 2022

Keywords

Comments

The powers of two are required to have at least n ternary digits, i.e., 2^k >= 3^(n-1).
Erdős (~1978) conjectured that 1, 4, and 256 are the only powers of two whose ternary expansion consists solely of 0's and 1's.

Crossrefs

Programs

  • Mathematica
    smallest[n_] := Module[{k}, k = Max[1, Ceiling[(n - 1) Log[2, 3]]];  While[MemberQ[Take[IntegerDigits[2^k, 3], -n], 2], ++k]; k]; Table[smallest[n], {n, 1, 20}]
  • PARI
    a(n) = my(k=max(1, logint(3^(n-1), 2))); while(#select(x->(x==2), Vec(Vecrev(digits(2^k,3)), n)), k++); k; \\ Michel Marcus, Feb 26 2022
    
  • Python
    from sympy.ntheory.digits import digits
    def a(n, startk=1):
        k = max(startk, len(bin(3**(n-1))[2:]))
        pow2 = 2**k
        while 2 in digits(pow2, 3)[-n:]:
            k += 1
            pow2 *= 2
        return k
    an = 0
    for n in range(1, 22):
        an = a(n, an)
        print(an, end=", ") # Michael S. Branicky, Feb 27 2022
    
  • Python
    from itertools import count
    def A351928(n):
        kmax, m = 3**n, (3**(n-1)).bit_length()
        k2 = pow(2,m,kmax)
        for k in count(m):
            a = k2
            while a > 0:
                a, b = divmod(a,3)
                if b == 2:
                    break
            else:
                return k
            k2 = 2*k2 % kmax # Chai Wah Wu, Mar 19 2022
Previous Showing 11-20 of 22 results. Next