A071770 Tersum n + [n/3] (answer recorded in base 10).
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
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.
- Index entries for sequences that are permutations of the nonnegative integers
Programs
-
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
-
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
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.
Extensions
a(27) corrected by Sean A. Irvine, Aug 06 2024