I hereby claim:
- I am fgdorais on github.
- I am fgdorais (https://keybase.io/fgdorais) on keybase.
- I have a public key ASA6dp-29_h50jj4Zbe4id-U073p5WOKmjT0B89KgYkotQo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
# for python2/python3 portability | |
from __future__ import (print_function, division) | |
# parameters | |
limit = 10000000 # Check up to limit | |
trace = False # Show trace of positives | |
# code |
# Generate fractions based on Farey sequences [1] and the Stern-Brocot tree [2]. | |
# | |
# [1] https://www.wikiwand.com/en/Farey_sequence | |
# [2] https://www.wikiwand.com/en/Stern-Brocot_tree | |
from fractions import Fraction | |
def next_farey(n,a,b): | |
"""Find the smallest fraction after a/b with denominator at most n""" |