Code-Golf: Farey sequence (I) Challenge


  In this task you would be given an integer N
  (less than 10^5), output the Farey
  sequence of order N.


The input N is given in a single line,the inputs are terminated by EOF.

Input

4
3
1
2


Output

F4 = {0/1, 1/4, 1/3, 1/2, 2/3, 3/4, 1/1}
F3 = {0/1, 1/3, 1/2, 2/3, 1/1}
F1 = {0/1, 1/1}
F2 = {0/1, 1/2, 1/1}


Constraints


The number of inputs would not exceed 10^6 values
You can use any language of your choice
Shortest solution wins!
J, 96

('F',],' = {0/1',', 1/1}',~('r';'/')rplc~', ',"1":"0@(3 :'}./:~~.,(%~}:\)i.1x+y')&amp;".);._2(1!:1)3


( /:~~.,(%~}:\)i.&gt;:x:y gives the list; the rest is I/O and formatting (with bad style))

E.g:

4
3
1
2
F4 = {0/1, 1/4, 1/3, 1/2, 2/3, 3/4, 1/1}
F3 = {0/1, 1/3, 1/2, 2/3, 1/1}          
F1 = {0/1, 1/1}                         
F2 = {0/1, 1/2, 1/1}  


Edits


(114 → 106)  Clearer appending ,
(106 → 105)  Cap [: to At @
(105 → 101)  Delete superfluous ": conversion
(101 → 99)  Use infix \ for the list
(99 → 96)