1 | initial version |
Do you want something like this... ?!
def f(a):
return ZZ(a).is_prime()
L = [True]
# we search all partitions of 17 in pieces $\ge 4$, which are each prime
for z in Compositions(17, min_part=4):
f_values = {f(a) for a in z}
if f_values.issubset(L):
print(f"{z} is well")
Results:
[17] is well
[7, 5, 5] is well
[5, 7, 5] is well
[5, 5, 7] is well