OFFSET
0,2
COMMENTS
LINKS
Kevin Ryde, Table of n, a(n) for n = 0..8192
John Loxton and Alf van der Poorten, Arithmetic Properties of Automata: Regular Sequences, Journal für die Reine und Angewandte Mathematik, volume 392, 1988, pages 57-69. Also second author's copy. Section 1 example beta_n = a(n).
FORMULA
a(n) = 0 if n in base 4 has a digit pair 12, 13, 20, or 21; otherwise a(n) = 1,3,2,1 according as n == 0,1,2,3 (mod 4).
MATHEMATICA
Nest[Flatten[ReplaceAll[#, {0->{0, 0, 0, 0}, 1->{1, 3, 2, 1}, 2->{0, 0, 2, 1}, 3->{1, 3, 0, 0}}]]&, {1}, 4] (* Paolo Xausa, Nov 09 2023 *)
PROG
(PARI) my(table=[9, 8, 9, 0, 0, 8, 6, 2, 4]); a(n) = my(s=2); if(n, forstep(i=bitor(logint(n, 2), 1), 0, -1, (s=table[s-bittest(n, i)])||break)); s>>1;
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Kevin Ryde, Jun 01 2021
STATUS
approved