|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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
|
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:
end proc:
|
|
MATHEMATICA
|
Table[(-1)^DigitCount[n, 3, 2], {n, 90}] (* Alonso del Arte, Sep 08 2012 *)
|
|
CROSSREFS
|
|
|
KEYWORD
|
sign,easy,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|