farey.py: initial commit