OFFSET
0,3
REFERENCES
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
LINKS
J.-P. Allouche and J. Shallit, The ring of k-regular sequences, Theoretical Computer Sci., 98 (1992), 163-197. [DOI]
J. H. Loxton and A. J. van der Poorten, An Awful Problem About Integers in Base Four, Acta Arithmetica, volume 49, 1987, pages 193-203.
J. H. Loxton and A. J. van der Poorten, Arithmetic properties of automata: regular sequences, J. Reine Angew. Math. 392 (1988), 57-69. Also second author's copy. See section 1 example.
A. J. van der Poorten, An Awful Problem about Integers in Base Four (and abstract), slides of a talk at University of Sydney CeNTRe for Number Theory Research, 2007.
FORMULA
Recurrence: a(3n) = 4a(n), a(3n-1) = 4a(n)-1, a(3n+1) = 4a(n)+1, starting 0,1. - Ralf Stephan, Jan 19 2014
EXAMPLE
1*4^2 + 0*4^1 + (-1)*4^0 = 15, so 15 is in sequence.
PROG
(PARI) a(n)=if(n<2, n>0, 4*a((n+1)\3)+(n+1)%3-1) \\ Ralf Stephan, Jan 19 2014
(PARI) a(n) = my(v=digits(n, 3), prev=0); forstep(i=#v, 1, -1, prev=(v[i]+=(v[i]>(prev<2)))); fromdigits(v, 4); \\ Kevin Ryde, Jun 03 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
EXTENSIONS
Offset changed to 0 and example added by Ralf Stephan, Jan 19 2014
STATUS
approved