Farey Sequence Generator
Enter an order n to generate its Farey sequence.
Result
How it is calculated
The tool starts from the first two neighbours 0/1 and 1/n and produces each next fraction from the previous two with the neighbour recurrence: k = floor((n + b) / d), then next = (k·c − a) / (k·d − b), where a/b and c/d are the last two fractions. It stops when it reaches 1/1. Because of this recurrence every fraction comes out already in lowest terms and in increasing order, with no sorting or gcd step. The order n is rounded to the nearest whole number and must be between 1 and 50; anything outside that range gives no result. The count it reports is the number of fractions, which equals 1 + φ(1) + φ(2) + … + φ(n), where φ is Euler's totient.
Worked example
Take n = 5. The sequence begins at 0/1 and 1/5. The next terms follow from the recurrence and the list is: 0/1, 1/5, 1/4, 1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5, 1/1. Count them: 11 fractions. Check with the totient formula: φ(1..5) = 1, 1, 2, 2, 4, which sums to 10, plus 1 for the starting 0/1 gives 11. Neighbours such as 2/5 and 1/2 satisfy 1·5 − 2·2 = 1.
Common mistakes
- Expecting fractions that are not in lowest terms. 2/4 or 3/6 never appear because 1/2 already covers them, so the count is smaller than all pairs a/b with b ≤ n.
- Confusing the order n with the number of terms. F_5 has 11 terms, not 5; the count grows roughly with n².
- Entering a decimal such as 4.6. The tool rounds it to 5, so you get F_5.
- Entering an order above 50 and expecting a list. The tool only handles 1 to 50 and returns nothing beyond that.
- Forgetting that both 0/1 and 1/1 are included, which matters when you compare the count with a totient sum.
About this calculator
The Farey sequence of order n, F_n, lists every fraction a/b in lowest terms with 0 ≤ a ≤ b ≤ n, arranged in increasing order between 0/1 and 1/1 — F_3, for instance, is 0/1, 1/3, 1/2, 2/3, 1/1. Consecutive fractions in the sequence always satisfy the property that their cross-multiplied difference (bc − ad for neighbors a/b and c/d) equals exactly 1.
Number theory students and enthusiasts use Farey sequences to study rational approximation, the Stern-Brocot tree, and the distribution of fractions with bounded denominators, and they show up in problems involving continued fractions, the Riemann hypothesis's Franel-Landau reformulation, and generating all reduced fractions up to a given denominator without duplicates.
Was this helpful?
You can pick up to 3 reactions.
Popular calculators
Loan Calculator
Monthly payment, total interest and full amortization schedule.
Percentage Calculator
Percent change, percent of, and ratio calculations.
Discount Calculator
Calculate final price, savings, and discount amount.
BMI Calculator
Body mass index from height and weight (metric or imperial).
Age Calculator
Compute your exact age in years, months and days from a birth date.
Compound Interest Calculator
Calculate the final amount and interest earned with compounding.
All Calculators
- Loan Calculator
- Profit Calculator
- Discount Calculator
- BMI Calculator
- Percentage Calculator
- Ideal Weight Calculator
- Age Calculator
- Pregnancy Due Date Calculator
- Compound Interest Calculator
- BMR Calculator (Basal Metabolic Rate)
- Tip Calculator
- Fuel Cost Calculator
- Date Difference Calculator
- Sleep Cycle Calculator
- Daily Water Intake Calculator
- Simple Interest Calculator
- Heart Rate Zones Calculator
- Running Pace Calculator
- Pet Age Calculator
- Calories Burned Calculator
- Macro Calculator
- TDEE Calculator (Total Daily Energy Expenditure)
- Waist-to-Hip Ratio Calculator
- Honor Roll Calculator
- One Rep Max (1RM) Calculator
- Ovulation Calculator
- Electricity Cost Calculator
- Unit Price Calculator
- Savings Goal Calculator
- Break-Even Point Calculator
- Paint Calculator
- Course Grade Average Calculator
- Business Days Calculator
- Time Duration Calculator
- Fuel Economy Calculator
- Temperature Converter
- Tile Calculator
- Aspect Ratio Calculator
- Roman Numeral Converter
- Goal Weight Timeline Calculator
- Salary Converter (Hourly to Annual)
- Credit Card Validator (Luhn)
- Body Surface Area (BSA) Calculator
- Feels-Like Temperature Calculator
- Ohm’s Law Calculator
- PPI (Pixel Density) Calculator
- Molar Mass Calculator
- Zodiac Sign Calculator (Western + Chinese)
- IBAN Validator
- Shoe Size Converter
- Country Info & Dialing Code Lookup
- Time Zone Difference (World Clock)
- CAGR (Compound Annual Growth Rate) Calculator
- Rule of 72 Calculator
- Blood Alcohol Content (BAC) Calculator
- Lean Body Mass (LBM) Calculator
- Pythagorean Theorem Calculator
- Speed Converter
- Download Time Calculator
- Date Calculator (Add/Subtract)
No calculators found
Comments