OFFSET
1,3
COMMENTS
Let {p_i, i >= 0} = {1,3,7,17,41,99,...} denote the numerators of successive convergents to sqrt(2) (see A001333). Then any n >= 0 has a unique representation as n = Sum_{i >= 0} d_i*p_i, with 0 <= d_i <= 2, d_{i+1}=2 => d_i=0. Sequence gives a(n+1) = d_0.
From Michel Dekking, Feb 11 2018: (Start)
(a(n)) is the unique fixed point of the morphism alpha given by
alpha: 0 -> 012, 1 -> 012, 2 -> 0.
To see this, note first that the p_i satisfy p_{i+2}=2p_{i+1}+p_i for all i=1,2,... Then define a sequence of words by
w(0) = 0, w(1) = 012, w(i+2) = w(i+1)w(i+1)w(i).
The length of w(i) is equal to p_i. In the numeration system, the representation of n = p_i is d = 10..0, and the representation of n = 2p_i is d = 20..0. By unicity of the representation, the numbers n = p_i +m have the representation d = 1c, where c is the representation of m for m = 1,...,p_{i-1}. Similarly, because the digit 2 is required to be followed by the digit 0, the numbers n = 2p_i + m have the representation d =20c, where c is the representation of m for m = 1,...,p_{i-2}. It follows from this that the d_0 digits in the range 0 to p_{i+2} have to satisfy the equation w(i+2) = w(i+1)w(i+1)w(i). But alpha(0)=alpha(1)=w(1), and alpha(2)=w(0), which implies by induction that w(i) = alpha^i(0):
w(i+1) = w(i)w(i)w(i-1) = alpha^i(0) alpha^i(0) alpha^{i-1}(0) =
alpha^i(0) alpha^i(1)alpha^i(2) = alpha^i(012) = alpha^{i+1}(0).
LINKS
Michel Dekking, Table of n, a(n) for n = 1..5000
Aviezri S. Fraenkel, On the recurrence f(m+1)= b(m)*f(m)-f(m-1) and applications, Discrete Mathematics 224 (2000), pp. 273-279.
A. S. Fraenkel, An exotic ternary representation of the first few positive integers (Table 2 from Fraenkel (2000).)
F. Michel Dekking, Morphisms, Symbolic Sequences, and Their Standard Forms, Journal of Integer Sequences, Vol. 19 (2016), Article 16.1.1.
FORMULA
a(n) = floor((n+2)r) + floor((n+1)r) - 2*floor(nr), where r = 1 - 1/sqrt(2). - Michel Dekking, Feb 11 2018
EXAMPLE
See the link to Table 2 of Fraenkel (2000).
MATHEMATICA
Table[Floor[(n + 2) (1 - 1/Sqrt[2])] + Floor[(n + 1) (1 - 1/Sqrt[2])] - 2 Floor[n (1 - 1/Sqrt[2])], {n, 100}] (* Vincenzo Librandi, Feb 12 2018 *)
PROG
(Magma) [Floor((n+2)*(1-1/Sqrt(2)))+Floor((n+1)*(1-1/Sqrt(2)))- 2*Floor(n*(1-1/Sqrt(2))): n in [1..100]]; // Vincenzo Librandi, Feb 12 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Nov 06 2015
EXTENSIONS
More terms and new offset from Michel Dekking, Feb 11 2018
STATUS
approved