OFFSET
0,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..19682
P. Mathonet, M. Rigo, M. Stipulanti and N. Zénaïdi, On digital sequences associated with Pascal's triangle, arXiv:2201.06636 [math.NT], 2022.
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. See A004482 for references.
MAPLE
a:= n-> (l-> add(irem(l[i]+l[i-1], 3)*3^(i-2),
i=2..nops(l)))([convert(n, base, 3)[], 0]):
seq(a(n), n=0..73); # Alois P. Heinz, Aug 07 2024
PROG
(PARI) a(n)={if(n==0, 0, fromdigits((digits(n, 3) + concat([0], digits(n\3, 3)))%3, 3))} \\ Andrew Howroyd, Aug 06 2024
(Python)
from sympy.ntheory import digits
def a(n):
d = digits(n, 3)[1:]
return int(str(d[0]) + "".join(str((d[i]+d[i-1])%3) for i in range(1, len(d))), 3)
print([a(n) for n in range(75)]) # Michael S. Branicky, Aug 07 2024
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Paul D. Hanna, Jun 04 2002
EXTENSIONS
a(27) corrected by Sean A. Irvine, Aug 06 2024
STATUS
approved