Writing a Farey sequence in Mathematica.

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
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