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.

User: Robert Saye

Robert Saye's wiki page.

Robert Saye has authored 2 sequences.

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

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

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

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