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-3 of 3 results.

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

A270026 a(n) is the smallest b for which the base-b representation of n contains at least one 0 (or 0 if no such base exists).

Original entry on oeis.org

0, 2, 3, 2, 2, 2, 7, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2
Offset: 1

Views

Author

Nathan Fox, Mar 08 2016

Keywords

Comments

For n > 1, a(n)=2 whenever n+1 is not a power of 2.
It is conjectured that the only terms that are neither 2 nor 3 in this sequence are a(7) and a(32767), which are 7 and 5 respectively.
a(n) > 0 for n >= 2 since the base-n representation of n is 10.

Crossrefs

Programs

  • Mathematica
    Table[SelectFirst[Range[2, 1200], DigitCount[n, #, 0] > 0 &], {n, 2, 120}] (* Michael De Vlieger, Mar 09 2016, Version 10 *)
  • PARI
    a(n) = if (n==1, 0, my(b=2); while(vecmin(digits(n, b)), b++); b); \\ Michel Marcus, Mar 09 2016

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
Showing 1-3 of 3 results.