login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

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

%I #38 Aug 17 2024 22:51:02

%S 0,1,3,12,9,16,15,19,27,30,44,40,55,52,65,60,51,75,73,80,86,82,81,77,

%T 98,85,95,79,118,141,162,107,129,105,158,145,155,143,138,152,203,176

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

%C Previous name was: First power of 2 which has n 2's in its base 3 expansion, or -1 if no such power exists.

%C "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."

%C 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.

%C 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, ...

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

%H Brian Hayes, <a href="https://doi.org/10.1511/2001.40.490">Third Base</a>, November-December 2001, Volume 89, Number 6, Page 490.

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

%e 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.

%p for m from 0 to 1000 do

%p r:= numboccur(2,convert(2^m,base,3));

%p if not assigned(A[r]) then A[r]:= m fi;

%p od:

%p seq(A[i],i=0..41); # _Robert Israel_, Dec 08 2015

%t 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 *)

%t 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 *)

%o (PARI) isok(n, k) = {d = digits(2^k, 3); sum(i=1, #d, d[i]==2) == n;}

%o a(n) = {k = 0; while(! isok(n, k), k++); k;} \\ _Michel Marcus_, Dec 08 2015

%Y Cf. A104321, A375472.

%K nonn,base,more

%O 0,3

%A _Robert G. Wilson v_, Mar 17 2001

%E Corrected and extended by _Sascha Kurz_, Jan 31 2003

%E Zero prepended to sequence by _L. Edson Jeffery_, Dec 08 2015

%E New name from _L. Edson Jeffery_, Dec 08 2015

%E a(42) = -1 and following terms removed from data by _Michel Marcus_, Dec 09 2015