Farey sequence by hirose

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

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

download

return to the top page