OFFSET
1
COMMENTS
Suppose r is a positive irrational number and k is a positive integer, so that the sequence given by a(n)=[nr]-[nr-kr]-[kr] consists of zeros and ones. Let b(n)=(position of n-th 0) and c(n)=(position of n-th 1), so that b and c are a complementary pair of sequences.
Examples of a, b, c using r=(1+sqrt(5))/2:
Example using r=sqrt(2):
Returning to arbitrary positive irrational r, let s(n)=[nr]-[nr-r]-[r], this being a(n) when k=1. For k>=2, the sequence a(n)=[nr]-[nr-kr]-[kr] is a shifted sum of shifted copies of s:
a(n)=s(n)+s(n-1)+...+s(n-k+1)-(constant). This sum matches the sum s(n)+s(n+1)+...+s(n+k-1)-(constant) at A187950.
Ratio of number of zeros to number of ones tends to sqrt(5)/2=1.118. Any (simple) proof? [Zak Seidov, Feb 14 2012] According to Charles R Greathouse IV (see formula), a(n)=1 if the fractional part of nr is less than w(1)=4r-6,and 0 otherwise, where r=(1+sqrt(5))/2. It means that probability of ones and zeros is, respectively, w(1) and w(0)=1-w(1). In the long run, number of ones and zeros is, respectively, w(1)*n and w(0)*n and, finally, the ratio of number of zeros to number of ones tends to w(0)/w(1)=sqrt(5)/2, qed. [Zak Seidov, Feb 17 2012]
Essentially the same as A187950. - Michel Dekking, Sep 17 2016
LINKS
Ivan Panchenko, Table of n, a(n) for n = 1..1000
FORMULA
a(n) = [nr]-[nr-4r]-[4r], where r=(1+sqrt(5))/2.
a(n) = 1 if the fractional part of nr is less than 4r - 6, and 0 otherwise. [Charles R Greathouse IV, Feb 14 2012]
a(n+4) = A187950(n) for n>=1. - Michel Dekking, Sep 17 2016
EXAMPLE
r=(1+sqrt(5))/2 and k=4:
a......0..1..0..0..1..0..1..0..0..1..0..1..1...
b......1..3..4..6..8..9..11..14.. (positions of 0 in a)
c......2..5..7..10..12..13..15... (positions of 1 in a).
As noted in Comments, a(n)=[nr]-[nr-4r]-[4r] is also obtained in another way: by adding right shifts of the infinite Fibonacci word s=A096270 (after left-extending it) and then down shifting:
s(n)......0..1..0..1..1..0..1..0..1..1..0..1..1..
s(n-1)....1..0..1..0..1..1..0..1..0..1..1..0..1..
s(n-2)....1..1..0..1..0..1..1..0..1..0..1..1..0..
s(n-3)....0..1..1..0..1..0..1..1..0..1..0..1..1..
sum.......2..3..2..2..3..2..3..2..2..3..2..3..3..
sum-2.....0..1..0..0..1..0..1..0..0..1..0..1..1..
MATHEMATICA
PROG
(PARI) a(n)=my(r=(1+sqrt(5))/2); n*r-n*r\1<4*r-6 \\ Charles R Greathouse IV, Feb 14 2012
(Python)
from __future__ import division
from gmpy2 import isqrt
def A188014(n):
return int((isqrt(5*n**2)+n)//2 -(isqrt(5*(n-4)**2)+n)//2 - 4) if n > 3 else 1-(n % 2) # Chai Wah Wu, Oct 07 2016
CROSSREFS
KEYWORD
nonn
AUTHOR
Clark Kimberling, Mar 19 2011
STATUS
approved