login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A004489
Table of tersums m + n (answers written in base 10).
10
0, 1, 1, 2, 2, 2, 3, 0, 0, 3, 4, 4, 1, 4, 4, 5, 5, 5, 5, 5, 5, 6, 3, 3, 6, 3, 3, 6, 7, 7, 4, 7, 7, 4, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 6, 6, 0, 6, 6, 0, 6, 6, 9, 10, 10, 7, 1, 1, 7, 1, 1, 7, 10, 10, 11, 11, 11, 2, 2, 2, 2, 2, 2, 11, 11, 11, 12, 9, 9, 12, 0, 0, 3, 0, 0, 12, 9, 9, 12, 13, 13, 10, 13, 13, 1, 4, 4, 1, 13, 13, 10, 13, 13
OFFSET
0,4
LINKS
FORMULA
Tersum m + n: write m and n in base 3 and add mod 3 with no carries, e.g. 5 + 8 = "21" + "22" = "10" = 1.
EXAMPLE
Table begins:
0 1 2 3 4 5 6 ...
1 2 0 4 5 3 7 ...
2 0 1 5 3 4 8 ...
3 4 5 6 7 8 0 ...
4 5 3 7 8 6 1 ...
5 3 4 8 6 7 2 ...
6 7 8 0 1 2 3 ...
...
MAPLE
T:= proc(n, m) local t, h, r, i;
t, h, r:= n, m, 0;
for i from 0 while t>0 or h>0 do
r:= r +3^i *irem(irem(t, 3, 't') +irem(h, 3, 'h'), 3)
od; r
end:
seq(seq(T(n, d-n), n=0..d), d=0..12); # Alois P. Heinz, Sep 07 2011
MATHEMATICA
T[n_, m_] := Module[{t, h, r, i, remt, remh}, {t, h, r} = {n, m, 0}; For[i = 0, t>0 || h>0, i++, r = r + 3^i*Mod[({t, remt} = QuotientRemainder[t, 3 ]; remt) + ({h, remh} = QuotientRemainder[h, 3]; remh), 3]]; r]; Table[Table[T[n, d-n], {n, 0, d}], {d, 0, 13}] // Flatten (* Jean-François Alcover, Jan 07 2014, translated from Maple *)
PROG
(PARI) T(n, m) = fromdigits(Vec(Pol(digits(n, 3)) + Pol(digits(m, 3)))%3, 3); \\ Kevin Ryde, Apr 06 2021
(Python)
def T(n, m):
k, pow3 = 0, 1
while n + m > 0:
n, rn = divmod(n, 3)
m, rm = divmod(m, 3)
k, pow3 = k + pow3*((rn+rm)%3), pow3*3
return k
print([T(n, d-n) for d in range(14) for n in range(d+1)]) # Michael S. Branicky, May 04 2021
CROSSREFS
Similar to but different from A004481.
Main diagonal gives A004488.
Cf. A003987 (analogous sequence for base 2).
Sequence in context: A305383 A004481 A307296 * A305384 A112599 A347905
KEYWORD
nonn,base,tabl,look,easy,nice
EXTENSIONS
More terms from Larry Reeves (larryr(AT)acm.org), Jan 23 2001
STATUS
approved