OFFSET
1,2
COMMENTS
LINKS
A. Fraenkel and C. Kimberling, Generalized Wythoff arrays, shuffles and interspersions, Discrete Mathematics 126 (1994) 137-149.
PROG
(PARI)
\\ Row i of the generalized Wythoff array W(h),
\\ where h is an irrational number between 1 and 2,
\\ and m is the number of terms in the vectors b and c.
row(h, i, m) = {
if(h<=1 || h>=2, print("Invalid value for h"); return);
my(
b=vector(m, n, floor(n*h)), \\ Beatty sequence for h
c=vector(m, n, floor(n*h/(h-1))), \\ Complement of b
w=[b[b[i]], c[b[i]]],
j=3
);
while(1,
if(j%2==1,
if(w[j-1]<=#b, w=concat(w, b[w[j-1]]), return(w))
,
if(w[j-2]<=#c, w=concat(w, c[w[j-2]]), return(w))
);
j++
)
}
allocatemem(10^9)
default(realprecision, 100)
row(log(Pi), 1, 10^7)
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Colin Barker, Dec 03 2014
STATUS
approved