Farey sequence by pooq(hirose)

a=0;b=1;d=n=scan("stdin");while(a<=b){cat(a,"/",b,"
",sep="");a=(a*d)%/%b+1;w=b;b=d;d=n-(n+w)%%d}

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

download

return to the top page