This is a simple search tool to find commas between intervals (maybe even irrational ones, though it would try to show them as fractions). You just specify a list of basis intervals to measure against each other, an upper bound in cents to filter interval combinations through, and the desired count. The code then iterates over suitable combinations from smaller to larger taxicab distances in the lattice spanned by the basis, ensuring simpler commas show first. (But which is simpler depends on your basis! 3/2 and 4/3 is one thing, 3 and 2 is another, 9/8 and 32/27 is yet another still.)
The output of
show_commas(['4/3', '5/4', '6/5', '7/6'], under_cents=25, count=15)here in main is:
7.712c = 225/224 = (4/3)^-1 (5/4)^2 (6/5)^0 (7/6)^-1
21.902c = 875/864 = (4/3)^0 (5/4)^1 (6/5)^-2 (7/6)^1
21.506c = 81/80 = (4/3)^-2 (5/4)^1 (6/5)^2 (7/6)^0
13.795c = 126/125 = (4/3)^-1 (5/4)^-1 (6/5)^2 (7/6)^1
13.074c = 1728/1715 = (4/3)^1 (5/4)^0 (6/5)^1 (7/6)^-3
14.191c = 245/243 = (4/3)^1 (5/4)^-1 (6/5)^-2 (7/6)^2
19.553c = 2048/2025 = (4/3)^3 (5/4)^-3 (6/5)^-1 (7/6)^0
5.362c = 6144/6125 = (4/3)^2 (5/4)^-2 (6/5)^1 (7/6)^-2
0.396c = 4375/4374 = (4/3)^2 (5/4)^0 (6/5)^-4 (7/6)^1
8.107c = 15625/15552 = (4/3)^1 (5/4)^2 (6/5)^-4 (7/6)^0
6.083c = 3136/3125 = (4/3)^0 (5/4)^-3 (6/5)^2 (7/6)^2
20.785c = 2430/2401 = (4/3)^0 (5/4)^2 (6/5)^1 (7/6)^-4
15.423c = 50625/50176 = (4/3)^-2 (5/4)^4 (6/5)^0 (7/6)^-2
19.157c = 110592/109375 = (4/3)^1 (5/4)^-3 (6/5)^3 (7/6)^-1
8.433c = 1029/1024 = (4/3)^-3 (5/4)^1 (6/5)^1 (7/6)^3
Use iter_commas to have more control (say, sorting or displaying the results in another manner). It generates pairs of cent values and coordinates in the lattice.
For a suitable count, the algorithm should visit all the intervals under the size bound at a given taxicab distance away from the unison. If you somehow find that’s not the case, please comment here and let me know. (I have no rigorous proof, it’s just an intuition, but if this doesn’t always work, then most probably it’s a bug in this implementation and not in the idea itself.)