OFFSET
0,5
COMMENTS
a(0), a(2) and a(8) are the conjectured to be the only terms equal to 0.
LINKS
Antti Karttunen, Table of n, a(n) for n = 0..16384
Eric Weisstein's World of Mathematics, Ternary
EXAMPLE
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.
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 *)
PROG
(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
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Eric W. Weisstein, Apr 06 2006
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
STATUS
approved