OFFSET
1,3
COMMENTS
See comments section of A345877.
MATHEMATICA
a[1] = 1; a[n_] := a[n] = If[Divisible[a[n - 1], 3], a[n - 1]/3, n - a[n - 1]]; Array[a, 100] (* Amiram Eldar, Jun 29 2021 *)
PROG
(PARI) q=vector(100); q[1]=1; for(n=2, #q, q[n] = if(q[n-1]%3, n-q[n-1], q[n-1]/3)); q
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Altug Alkan, Jun 28 2021
STATUS
approved