Writing a Farey sequence in Mathematica.

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 3K views
JohnMcBetty
Messages
12
Reaction score
0
I need some help writing a Farey Sequence in Mathematica, so far this is all I have:

FareySequence[n_] := GCD[a, b]; While b : a, b = b, a % b;
result := a

Simplify[a, b];
g := GCD[a, b]
result := (a/g, b/g)

I am very new to programming, please help!
 
Physics news on Phys.org