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”).

A071770
Tersum n + [n/3] (answer recorded in base 10).
2
0, 1, 2, 4, 5, 3, 8, 6, 7, 12, 13, 14, 16, 17, 15, 11, 9, 10, 24, 25, 26, 19, 20, 18, 23, 21, 22, 36, 37, 38, 40, 41, 39, 44, 42, 43, 48, 49, 50, 52, 53, 51, 47, 45, 46, 33, 34, 35, 28, 29, 27, 32, 30, 31, 72, 73, 74, 76, 77, 75, 80, 78, 79, 57, 58, 59, 61, 62, 60, 56, 54, 55, 69, 70
OFFSET
0,3
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. 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
Cf. A004482.
Inverse permutation to A370932.
Sequence in context: A099520 A327432 A159958 * A105529 A329454 A120237
KEYWORD
nonn,look
AUTHOR
Paul D. Hanna, Jun 04 2002
EXTENSIONS
a(27) corrected by Sean A. Irvine, Aug 06 2024
STATUS
approved