|
|
A065364
|
|
Alternating sum of balanced ternary digits in n. Replace 3^k with (-1)^k in balanced ternary expansion of n.
|
|
5
|
|
|
1, -2, -1, 0, 1, 2, 3, 0, 1, 2, -1, 0, 1, -2, -1, 0, -3, -2, -1, -4, -3, -2, -1, 0, 1, -2, -1, 0, -3, -2, -1, 0, 1, 2, -1, 0, 1, -2, -1, 0, 1, 2, 3, 0, 1, 2, -1, 0, 1, 2, 3, 4, 1, 2, 3, 0, 1, 2, 3, 4, 5, 2, 3, 4, 1, 2, 3, 0, 1, 2, -1, 0, 1, -2, -1, 0, 1, 2, 3, 0, 1, 2, -1, 0, 1, 2, 3, 4, 1, 2, 3, 0, 1, 2, -1, 0, 1, -2, -1, 0, -3, -2, -1, 0
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
Notation: (3)<n>(-1).
|
|
LINKS
|
|
|
EXAMPLE
|
5 = +1(9)-1(3)-1(1) -> +1(+1)-1(-1)-1(+1) = +1 = a(5).
|
|
MATHEMATICA
|
Array[Total@ MapIndexed[#1 (2 Mod[First[#2], 2] - 1) &, Reverse@ #] &[Prepend[IntegerDigits[#, 3], 0] //. {a___, b_, 2, c___} :> {a, b + 1, -1, c}] &, 104] (* Michael De Vlieger, Jun 27 2020 *)
|
|
CROSSREFS
|
|
|
KEYWORD
|
base,easy,sign
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|