login
A216430
(-1)^A081603(n), parity of the number of 2's in the ternary expansion of n.
1
1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1
OFFSET
1
LINKS
EXAMPLE
a(7) = -1 because 7 is 21 (has one 2s) in base 3, and (-1)^1 = -1.
a(8) = 1 because 8 is 22 (has two 2s) in base 3, and (-1)^2 = 1.
MAPLE
A081603 := proc(n)
local a, d ;
a := 0 ;
for d in convert(n, base, 3) do
if d = 2 then
a := a+1 ;
end if;
end do;
a;
end proc:
A216430 := proc(n)
(-1)^A081603(n) ;
end proc:
seq(A216430(n), n=1..90) ;
MATHEMATICA
Table[(-1)^DigitCount[n, 3, 2], {n, 90}] (* Alonso del Arte, Sep 08 2012 *)
CROSSREFS
Sequence in context: A209661 A033999 A000012 * A232544 A309873 A153881
KEYWORD
sign,easy,base
AUTHOR
R. J. Mathar, Sep 08 2012
STATUS
approved