Farey sequence by twobit

a=0
b=1
c=1
d=io.read"*n"n=d
repeat
print(a.."/"..b)k=(n+b)/d;k=k-k%1;a,b,c,d=c,d,k*c-a,k*d-b
until a>b

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page