|
|
A338828
|
|
For any number with ternary representation (t(1), t(2), ..., t(k)), the ternary representation of a(n) is (abs(t(1)-t(k)), abs(t(2)-t(k-1)), ..., abs(t(k)-t(1))).
|
|
2
|
|
|
0, 0, 0, 4, 0, 4, 8, 4, 0, 10, 0, 10, 10, 0, 10, 10, 0, 10, 20, 10, 0, 20, 10, 0, 20, 10, 0, 28, 0, 28, 40, 12, 40, 52, 24, 52, 40, 12, 40, 28, 0, 28, 40, 12, 40, 52, 24, 52, 40, 12, 40, 28, 0, 28, 56, 28, 0, 68, 40, 12, 80, 52, 24, 68, 40, 12, 56, 28, 0, 68
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,4
|
|
COMMENTS
|
Leading zeros are ignored.
|
|
LINKS
|
|
|
FORMULA
|
a(n) = 0 iff n is a palindrome in base 3 (A014190).
|
|
MAPLE
|
a:= n-> (l-> (h-> add(h[j]*3^(j-1), j=1..nops(h)))([seq(
abs(l[i]-l[-i]), i=1..nops(l))]))(convert(n, base, 3)):
|
|
PROG
|
(PARI) a(n, base=3) = my (d=digits(n, base)); fromdigits(abs(d-Vecrev(d)), base)
|
|
CROSSREFS
|
|
|
KEYWORD
|
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|