Farey sequence by inaniwa

n;g(a,b,e,f){b+f>n?:g(a,b,a+e,b+f)|printf("%d/%d\n",a+e,b+f)|g(a+e,b+f,e,f);}main(){puts("0/1");g(0,1,1,scanf("%d",&n));puts("1/1");}

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

download

return to the top page