OFFSET
0,3
COMMENTS
Loxton and van der Poorten's morphism (see A344893), or the way -1 digits cause borrows, shows that this sequence is base 4 digit strings with no digit pair 12, 13, 20, or 21, and least significant digit not 2.
The least significant digit can be any of 0,1,3, then each successive higher digit has three choices: 0,1,3 above a 0 or 1, or 0,2,3 above a 2 or 3. This allows a(n) to be calculated by mapping from the ternary digits of n to these choices, from least to most significant digit.
LINKS
Kevin Ryde, Table of n, a(n) for n = 0..6561
PROG
(PARI) a(n) = my(v=digits(n, 3), prev=0); forstep(i=#v, 1, -1, prev=(v[i]+=(v[i]>(prev<2)))); fromdigits(v);
CROSSREFS
KEYWORD
nonn,easy,base
AUTHOR
Kevin Ryde, Jun 01 2021
STATUS
approved