Farey sequence by hos

a,b,d,e;main(n){for(scanf("%d",&n);printf("%d/%d\n",a,++b),a<b;a=e/b,b=d)for(d=n;(e=a*d--+1)%b;);}

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

download

return to the top page