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.

A060035 Least m >= 0 such that 2^m has n 2's in its base-3 expansion.

Original entry on oeis.org

0, 1, 3, 12, 9, 16, 15, 19, 27, 30, 44, 40, 55, 52, 65, 60, 51, 75, 73, 80, 86, 82, 81, 77, 98, 85, 95, 79, 118, 141, 162, 107, 129, 105, 158, 145, 155, 143, 138, 152, 203, 176
Offset: 0

Views

Author

Robert G. Wilson v, Mar 17 2001

Keywords

Comments

Previous name was: First power of 2 which has n 2's in its base 3 expansion, or -1 if no such power exists.
"Paul Erdős conjectured that for n > 8, 2^n is not a sum of distinct powers of 3. In terms of digits, this states that powers of 2 for n > 8 must always contain a '2' in their base 3 expansion."
The value of a(42) is conjectured to be -1 because no power of 2 up to 2^10^7 has exactly 42 2's.
After a(42), that is unknown, the sequence goes on 171, 142, 167, 197, 168, 216, 229, 193, 232, 236, 248, 226, 230, 224, 228, 303, 244, ...

Examples

			a(0) = 0 because 2^0 in base 3 is {1} which has no terms equaling 2.
a(6) = 15 because 2^15 in base 3 is {1, 1, 2, 2, 2, 2, 1, 1, 2, 2} which has 6 terms equaling 2.
		

References

  • Ilan Vardi, "Computational Recreations in Mathematica," Addison-Wesley Publishing Co., Redwood City, CA, 1991, page 20.

Crossrefs

Programs

  • Maple
    for m from 0 to 1000 do
      r:= numboccur(2,convert(2^m,base,3));
      if not assigned(A[r]) then A[r]:= m fi;
    od:
    seq(A[i],i=0..41); # Robert Israel, Dec 08 2015
  • Mathematica
    a[n_] := For[k=0, True, k++, If[Count[IntegerDigits[2^k, 3], 2]==n, Return[k]]]; Table[a[n],{n,0,41}] (* goes into infinite loop for n > 41 *)
    a[n_] := -1; Do[m = Count[IntegerDigits[2^(n), 3], 2]; If[a[m] == -1, a[m] = n], {n, 0, 1000}]; Table[a[n], {n, 0, 59}] (* L. Edson Jeffery, Dec 08 2015 *)
  • PARI
    isok(n, k) = {d = digits(2^k, 3); sum(i=1, #d, d[i]==2) == n;}
    a(n) = {k = 0; while(! isok(n, k), k++); k;} \\ Michel Marcus, Dec 08 2015

Extensions

Corrected and extended by Sascha Kurz, Jan 31 2003
Zero prepended to sequence by L. Edson Jeffery, Dec 08 2015
New name from L. Edson Jeffery, Dec 08 2015
a(42) = -1 and following terms removed from data by Michel Marcus, Dec 09 2015