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.

Showing 1-2 of 2 results.

A120613 a(n) = floor(phi*floor(n/phi)) where phi=(1+sqrt(5))/2.

Original entry on oeis.org

0, 1, 1, 3, 4, 4, 6, 6, 8, 9, 9, 11, 12, 12, 14, 14, 16, 17, 17, 19, 19, 21, 22, 22, 24, 25, 25, 27, 27, 29, 30, 30, 32, 33, 33, 35, 35, 37, 38, 38, 40, 40, 42, 43, 43, 45, 46, 46, 48, 48, 50, 51, 51, 53, 53, 55, 56, 56, 58, 59, 59, 61, 61, 63, 64, 64, 66, 67, 67, 69, 69, 71, 72
Offset: 1

Views

Author

Benoit Cloitre, Jun 17 2006

Keywords

Crossrefs

Cf. A001622, A120614 (first differences), A120615 (partial sums), A003842.

Programs

  • Magma
    [Floor((1+Sqrt(5))*Floor(2*n/(1+Sqrt(5)))/2): n in [1..100]]; // G. C. Greubel, Oct 23 2018
    
  • Mathematica
    Table[Floor[GoldenRatio*Floor[n/GoldenRatio]], {n,1,100}] (* G. C. Greubel, Oct 23 2018 *)
  • PARI
    f=(1+sqrt(5))/2;a(n)=floor(f*floor(n/f))
    
  • Python
    from math import isqrt
    def A120613(n): return (m:=(n+isqrt(5*n**2)>>1)-n)+isqrt(5*m**2)>>1 # Chai Wah Wu, Aug 26 2022

Formula

a(n) = n - A003842(n-2) for n >= 2. [Corrected by Georg Fischer, Jan 31 2019]
In particular, a(n) = n-1 or a(n) = n-2. - Charles R Greathouse IV, Aug 26 2022

Extensions

Offset changed by Michel Dekking, Oct 23 2018

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

Original entry on oeis.org

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, 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, 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
Offset: 1

Views

Author

Benoit Cloitre, Jun 17 2006

Keywords

Comments

From Michel Dekking, Oct 29 2018: (Start)
Here is a proof that (a(n)) is fixed point of the morphism 0->102, 1->102, 2->02.
Let alpha:=phi-1. Then alpha*phi = 1. So
g(k) = floor(phi*floor(k*alpha)).
Write k*alpha = floor(k*alpha) + {k*alpha}, i.e., {k*alpha} is the fractional part of k*alpha. Then
g(k) = floor(phi*(k*alpha-{k*alpha})) = k + floor(-phi*{k*alpha}).
Thus
a(n) = n+1 +floor(-phi*{(n+1)*alpha})-n -floor(-phi*{n*alpha}).
It follows that
a(n) = 1 - floor(phi*{(n+1)*alpha}) + floor(phi*{n*alpha}).
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.
In fact, phi*{n*alpha} can only take values between 0 and 1.619, and floor(phi*{n*alpha}) = 0 if and only if
{n*alpha} < 1/phi = alpha.
This is the same (putting rho:=1-alpha) as requiring
{n*alpha+rho} < 1-alpha.
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
a(n+1)=0 iff xF(n)=0, xF(n+1)=1,
a(n+1)=1 iff xF(n)=0, xF(n+1)=0,
a(n+1)=2 iff xF(n)=1, xF(n+1)=0.
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)

Crossrefs

Programs

  • Magma
    [Floor((1+Sqrt(5))*Floor(2*(k+1)/(1+Sqrt(5)))/2) -
    Floor((1+Sqrt(5))*Floor(2*k/(1+Sqrt(5)))/2): k in [1..100]]; // G. C. Greubel, Oct 23 2018
    
  • Maple
    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
  • Mathematica
    #[[2]]-#[[1]]&/@Partition[Table[Floor[GoldenRatio*Floor[n/GoldenRatio]],{n,0,110}],2,1] (* Harvey P. Dale, Dec 14 2012 *)
  • PARI
    {phi=(1+sqrt(5))/2; g(k)=floor(phi*floor(k/phi))};
    vector(100, n, g(n+1)-g(n)) \\ G. C. Greubel, Oct 23 2018
    
  • Python
    from math import isqrt
    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

Formula

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.
(a(n)) is a fixed point of the morphism 02-->10202 and 102-->10210202. [Corrected by Michel Dekking, Oct 29 2018]
Fixed point of the morphism 0->102, 1->102, 2->02. - Michel Dekking, Oct 21 2018

Extensions

Initial 0 removed from data by Michel Dekking, Oct 22 2018
Showing 1-2 of 2 results.