Skip to content

Instantly share code, notes, and snippets.

View fgdorais's full-sized avatar

François G. Dorais fgdorais

View GitHub Profile

Keybase proof

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:

@fgdorais
fgdorais / mo301110.py
Created May 30, 2018 01:07
Comment to MathOverflow question
# for python2/python3 portability
from __future__ import (print_function, division)
# parameters
limit = 10000000 # Check up to limit
trace = False # Show trace of positives
# code
@fgdorais
fgdorais / fracenum.py
Created October 29, 2016 02:14
Handy ways to enumerate fractions
# 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"""