cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A120614 a(n) = g(n+1) - g(n) where g(k) = floor(phi*floor(k/phi)) and phi = (1+sqrt(5))/2.

This page as a plain text file.
%I A120614 #51 May 22 2025 16:57:48
%S A120614 1,0,2,1,0,2,0,2,1,0,2,1,0,2,0,2,1,0,2,0,2,1,0,2,1,0,2,0,2,1,0,2,1,0,
%T A120614 2,0,2,1,0,2,0,2,1,0,2,1,0,2,0,2,1,0,2,0,2,1,0,2,1,0,2,0,2,1,0,2,1,0,
%U A120614 2,0,2,1,0,2,0,2,1,0,2,1,0,2,0,2,1,0,2,1,0,2,0,2,1,0,2,0,2,1,0,2,1,0,2,0
%N A120614 a(n) = g(n+1) - g(n) where g(k) = floor(phi*floor(k/phi)) and phi = (1+sqrt(5))/2.
%C A120614 From _Michel Dekking_, Oct 29 2018: (Start)
%C A120614 Here is a proof that (a(n)) is fixed point of the morphism 0->102, 1->102, 2->02.
%C A120614 Let alpha:=phi-1. Then alpha*phi = 1. So
%C A120614       g(k) = floor(phi*floor(k*alpha)).
%C A120614 Write k*alpha = floor(k*alpha) + {k*alpha}, i.e., {k*alpha} is the fractional part of k*alpha. Then
%C A120614       g(k) = floor(phi*(k*alpha-{k*alpha})) = k + floor(-phi*{k*alpha}).
%C A120614 Thus
%C A120614       a(n) = n+1 +floor(-phi*{(n+1)*alpha})-n -floor(-phi*{n*alpha}).
%C A120614 It follows that
%C A120614       a(n)  = 1 - floor(phi*{(n+1)*alpha})  + floor(phi*{n*alpha}).
%C A120614 The difference -floor(phi*{(n+1)*alpha}) + floor(phi*{n*alpha}) is equal to -1, 0 or 1, since floor(phi*{n*alpha}) is equal to 0 or 1.
%C A120614 In fact, phi*{n*alpha} can only take values between 0 and 1.619, and floor(phi*{n*alpha}) = 0 if and only if
%C A120614       {n*alpha} < 1/phi = alpha.
%C A120614 This is the same (putting rho:=1-alpha) as requiring
%C A120614       {n*alpha+rho} < 1-alpha.
%C A120614 Via the rotation description of Sturmian sequences (see, e.g., Lothaire), one sees that this sequence is the inhomogeneous Sturmian sequence s(alpha, rho), but with offset 1, and with 0 and 1 exchanged. Since rho+alpha=1, it follows that s(alpha, rho) with offset 2 equals  s(1-alpha, 1-alpha), the classical Fibonacci sequence xF:=A003849, fixed point of 0->01, 1->0. We have found that
%C A120614       a(n+1)=0 iff xF(n)=0, xF(n+1)=1,
%C A120614       a(n+1)=1 iff xF(n)=0, xF(n+1)=0,
%C A120614       a(n+1)=2 iff xF(n)=1, xF(n+1)=0.
%C A120614 This means that (a(n+1)) equals the 3-symbol Fibonacci sequence A270788 on the alphabet {0,2,1}. Then Proposition 5 in "Morphisms, Symbolic Sequences, and Their Standard Forms" yields that (a(n)) is fixed point of the morphism 0->102, 1->102, 2->02. (End)
%H A120614 Muniru A Asiru, <a href="/A120614/b120614.txt">Table of n, a(n) for n = 1..1000</a>
%H A120614 F. Michel Dekking, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL19/Dekking/dekk4.html">Morphisms, Symbolic Sequences, and Their Standard Forms</a>, Journal of Integer Sequences, Vol. 19 (2016), Article 16.1.1.
%H A120614 M. Lothaire, <a href="http://www-igm.univ-mlv.fr/~berstel/Lothaire/">Algebraic Combinatorics on Words</a>, Cambridge, 2002.
%F A120614 a(floor(k*phi)+k+1)=0; a(floor(k*phi)+k+2)=2, if n is not in {floor(k*phi)+k+1}U{floor(k*phi)+k+2}_{k>=1} a(n)=1.
%F A120614 (a(n)) is a fixed point of the morphism 02-->10202 and 102-->10210202. [Corrected by _Michel Dekking_, Oct 29 2018]
%F A120614 Fixed point of the morphism 0->102, 1->102, 2->02. - _Michel Dekking_, Oct 21 2018
%p A120614 g:=k->floor((1+sqrt(5))/2*floor(k/((1+sqrt(5))/2))): seq(g(n+1)-g(n),n=1..110); # _Muniru A Asiru_, Oct 21 2018
%t A120614 #[[2]]-#[[1]]&/@Partition[Table[Floor[GoldenRatio*Floor[n/GoldenRatio]],{n,0,110}],2,1] (* _Harvey P. Dale_, Dec 14 2012 *)
%o A120614 (PARI) {phi=(1+sqrt(5))/2; g(k)=floor(phi*floor(k/phi))};
%o A120614 vector(100, n, g(n+1)-g(n)) \\ _G. C. Greubel_, Oct 23 2018
%o A120614 (Magma) [Floor((1+Sqrt(5))*Floor(2*(k+1)/(1+Sqrt(5)))/2) -
%o A120614 Floor((1+Sqrt(5))*Floor(2*k/(1+Sqrt(5)))/2): k in [1..100]]; // _G. C. Greubel_, Oct 23 2018
%o A120614 (Python)
%o A120614 from math import isqrt
%o A120614 def A120614(n): return ((m:=(n+1+isqrt(5*(n+1)**2)>>1)-n-1)+isqrt(5*m**2)>>1)-((k:=(n+isqrt(5*n**2)>>1)-n)+isqrt(5*k**2)>>1) # _Chai Wah Wu_, May 22 2025
%Y A120614 Cf. A003849, A120613, A120615, A270788.
%K A120614 nonn
%O A120614 1,3
%A A120614 _Benoit Cloitre_, Jun 17 2006
%E A120614 Initial 0 removed from data by _Michel Dekking_, Oct 22 2018