Farey sequence by pooq(hirose)

n:stdin.get_i8-48;a:0;b:1;d:n;while(a<=b){a.to_s~"/"~b.to_s .p;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