OFFSET
0,3
LINKS
EXAMPLE
a(9) = 13 since Ternary 100 (9 decimal) interpreted as Ternary Gray code = 13.
MATHEMATICA
a[n_] := Module[{v = IntegerDigits[n, 3]}, Do[v[[i]] = Mod[v[[i]]+v[[i-1]], 3], {i, 2, Length[v]}]; FromDigits[v, 3]];
Table[a[n], {n, 0, 62}] (* Jean-François Alcover, Jun 26 2023, after Kevin Ryde *)
PROG
(PARI) a(n) = my(v=digits(n, 3)); for(i=2, #v, v[i]=(v[i]+v[i-1])%3); fromdigits(v, 3); \\ Kevin Ryde, May 23 2020
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Gary W. Adamson, Apr 11 2005
EXTENSIONS
More terms from Sean A. Irvine, Feb 09 2012
Comments by Gary W. Adamson moved to A105530 where they better apply. - Kevin Ryde, May 30 2020
STATUS
approved