Farey sequence by recursive

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

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

download

return top