Farey sequence by hallvabo

a=0;b=c=1;d=n=input()
while a<n:print`a`+'/'+`b`;t=(n+b)/d;a,b,c,d=c,d,t*c-a,t*d-b

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

download

return to the top page