Farey sequence by pooq(hirose)

m:-prompt1(''),readln(N),0:1:N:N.
A:B:D:N:-A=<B,format("~d/~d
",[A,B]),E is A*D//B+1,F is N-(N+B)mod D,E:D:F:N.

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

download

return to the top page