import IPython P0 = range(1, 2 ** 8) M = range(1, 2 ** 16) P1 = range(1, 2 ** 5) P0 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 16, 24] M = [ 3, 4, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 41, 43, 47, 49, 53, 55, 59, 61, 65, 67, 71, 73, 77, 79, 83, 85, 89, 91, 95, 97, ] M = range(3, 98) M = range(1, 256) P1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 16, 18, 24, 30] P0 = range(1, 11) M = range(1, 256) P1 = range(1, 33) sel = 12 presettings = [((sel / p0) * m, p0, m) for p0 in P0 for m in M] valid_presettings = [_ for _ in presettings if 275 <= _[0] <= 550] settings = [(x / 2 / p1, p0, m, p1) for (x, p0, m) in valid_presettings for p1 in P1] print(f"generated {len(settings)} settings") def weight(s): return s[1] * s[2] * s[3] sols = {} for i in range(5, 151): solutions = [s for s in settings if s[0] == i] best = min(solutions, key=weight) print(best) sols[i] = best IPython.embed() """ Outcome: for 4-100 Mhz, can find solution with 1 <= p0 <= 3 1 <= m <= 100 1 <= p1 <= """ (5.0, 1, 25, 30) (6.0, 1, 23, 23) (7.0, 1, 28, 24) (8.0, 1, 24, 18) (9.0, 1, 24, 16) (10.0, 1, 25, 15) (11.0, 1, 33, 18) (12.0, 1, 24, 12) (13.0, 1, 26, 12) (14.0, 1, 28, 12) (15.0, 1, 25, 10) (16.0, 1, 24, 9) (17.0, 1, 34, 12) (18.0, 1, 24, 8) (19.0, 1, 38, 12) (20.0, 1, 30, 9) (21.0, 1, 28, 8) (22.0, 1, 33, 9) (23.0, 1, 23, 6) (24.0, 1, 24, 6) (25.0, 1, 25, 6) (26.0, 1, 26, 6) (27.0, 1, 27, 6) (28.0, 1, 28, 6) (29.0, 1, 29, 6) (30.0, 1, 25, 5) (31.0, 1, 31, 6) (32.0, 1, 32, 6) (33.0, 1, 33, 6) (34.0, 1, 34, 6) (35.0, 1, 35, 6) (36.0, 1, 24, 4) (37.0, 1, 37, 6) (38.0, 1, 38, 6) (39.0, 1, 26, 4) (40.0, 1, 40, 6) (41.0, 1, 41, 6) (42.0, 1, 28, 4) (43.0, 1, 43, 6) (44.0, 1, 44, 6) (45.0, 1, 30, 4) (46.0, 1, 23, 3) (47.0, 2, 47, 3) (48.0, 1, 24, 3) (49.0, 2, 49, 3) (50.0, 1, 25, 3) (51.0, 1, 34, 4) (52.0, 1, 26, 3) (53.0, 2, 53, 3) (54.0, 1, 27, 3) (55.0, 2, 55, 3) (56.0, 1, 28, 3) (57.0, 1, 38, 4) (58.0, 1, 29, 3) (59.0, 2, 59, 3) (60.0, 1, 30, 3) (61.0, 2, 61, 3) (62.0, 1, 31, 3) (63.0, 1, 42, 4) (64.0, 1, 32, 3) (65.0, 2, 65, 3) (66.0, 1, 33, 3) (67.0, 2, 67, 3) (68.0, 1, 34, 3) (69.0, 1, 23, 2) (70.0, 1, 35, 3) (71.0, 2, 71, 3) (72.0, 1, 24, 2) (73.0, 2, 73, 3) (74.0, 1, 37, 3) (75.0, 1, 25, 2) (76.0, 1, 38, 3) (77.0, 2, 77, 3) (78.0, 1, 26, 2) (79.0, 2, 79, 3) (80.0, 1, 40, 3) (81.0, 1, 27, 2) (82.0, 1, 41, 3) (83.0, 2, 83, 3) (84.0, 1, 28, 2) (85.0, 2, 85, 3) (86.0, 1, 43, 3) (87.0, 1, 29, 2) (88.0, 1, 44, 3) (89.0, 2, 89, 3) (90.0, 1, 30, 2) (91.0, 2, 91, 3) (92.0, 3, 92, 2) (93.0, 1, 31, 2) (94.0, 3, 94, 2) (95.0, 3, 95, 2) (96.0, 1, 32, 2) (97.0, 3, 97, 2) (98.0, 3, 98, 2) (99.0, 1, 33, 2) (100.0, 3, 100, 2)