Fixes to rhythms.py handling prime numbers and edge case