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))).
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
Offset: 0
Links
- Rémy Sigrist, Table of n, a(n) for n = 0..6561
Programs
-
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)): seq(a(n), n=0..70); # Alois P. Heinz, Nov 12 2020
-
PARI
a(n, base=3) = my (d=digits(n, base)); fromdigits(abs(d-Vecrev(d)), base)
Formula
a(n) = 0 iff n is a palindrome in base 3 (A014190).
Comments