%I M2312 #34 Jun 08 2021 02:29:58
%S 0,1,3,4,5,11,12,13,15,16,17,19,20,21,43,44,45,47,48,49,51,52,53,59,
%T 60,61,63,64,65,67,68,69,75,76,77,79,80,81,83,84,85,171,172,173,175,
%U 176,177,179,180,181,187,188,189,191,192,193,195,196,197,203,204,205,207,208,209
%N Loxton-van der Poorten sequence: base-4 representation contains only -1, 0, +1.
%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H J.-P. Allouche and J. Shallit, <a href="http://www.cs.uwaterloo.ca/~shallit/Papers/as0.ps">The ring of k-regular sequences</a>, Theoretical Computer Sci., 98 (1992), 163-197. <a href="http://dx.doi.org/10.1016/0304-3975(92)90001-V">[DOI]</a>
%H J. H. Loxton and A. J. van der Poorten, <a href="https://doi.org/10.4064/aa-49-2-193-203">An Awful Problem About Integers in Base Four</a>, Acta Arithmetica, volume 49, 1987, pages 193-203.
%H J. H. Loxton and A. J. van der Poorten, <a href="http://dx.doi.org/10.1515/crll.1988.392.57">Arithmetic properties of automata: regular sequences</a>, J. Reine Angew. Math. 392 (1988), 57-69. Also <a href="http://web.archive.org/web/20040405090654id_/http://www-centre.mpce.mq.edu.au/alfpapers/a083.pdf">second author's copy</a>. See section 1 example.
%H A. J. van der Poorten, <a href="https://www.maths.usyd.edu.au/u/donaldc/gbrown/alf.pdf">An Awful Problem about Integers in Base Four</a> (and <a href="http://www.maths.usyd.edu.au/u/donaldc/gbrown/abstractsse8.html">abstract</a>), slides of a talk at University of Sydney CeNTRe for Number Theory Research, 2007.
%F 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
%e 1*4^2 + 0*4^1 + (-1)*4^0 = 15, so 15 is in sequence.
%o (PARI) a(n)=if(n<2,n>0,4*a((n+1)\3)+(n+1)%3-1) \\ _Ralf Stephan_, Jan 19 2014
%o (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
%Y Cf. A344892 (in base 4), A344893 (morphism).
%Y Cf. A023713, A023717.
%K nonn
%O 0,3
%A _N. J. A. Sloane_
%E Offset changed to 0 and example added by _Ralf Stephan_, Jan 19 2014