Writing a Farey sequence in Mathematica.

Click For Summary
SUMMARY

The discussion focuses on creating a Farey sequence in Mathematica, specifically using the function FareySequence[n_]. The user attempts to implement the sequence by utilizing the GCD function and simplification techniques. Key components include the use of While loops and the GCD function to reduce fractions. The conversation highlights the need for clarity in programming syntax and logic when working with Mathematica.

PREREQUISITES
  • Understanding of Mathematica syntax and functions
  • Familiarity with the concept of Farey sequences
  • Knowledge of the GCD (Greatest Common Divisor) algorithm
  • Basic programming concepts such as loops and conditionals
NEXT STEPS
  • Research the implementation of Farey sequences in Mathematica
  • Learn about the GCD function in Mathematica and its applications
  • Explore the use of While loops in Mathematica for iterative processes
  • Study simplification techniques for rational numbers in Mathematica
USEFUL FOR

Beginner programmers, Mathematica users, and anyone interested in number theory and Farey sequences.

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

Similar threads

  • · Replies 8 ·
Replies
8
Views
5K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 13 ·
Replies
13
Views
3K