OFFSET
0,3
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, ...
REFERENCES
Ilan Vardi, "Computational Recreations in Mathematica," Addison-Wesley Publishing Co., Redwood City, CA, 1991, page 20.
LINKS
Brian Hayes, Third Base, November-December 2001, Volume 89, Number 6, Page 490.
EXAMPLE
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.
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 *)
PROG
(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
CROSSREFS
KEYWORD
nonn,base,more
AUTHOR
Robert G. Wilson v, Mar 17 2001
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
STATUS
approved