I have a list of lists made with
itertools.product(range(5), repeat=3)
which gives
[[0 0 0]
[0 0 1]
[0 0 2]
[0 0 3]
[0 0 4]
[0 1 0]
[0 1 1]
... etc]
I want to remove all lists that have common integer factors except the trivial cases of 0 and 1 because then that would match all lists. For example [0 0 2] is [0 0 1] multiplied by 2 so I'd want to remove [0 0 2]. Another example would be [3 3 3] which is [1 1 1] multiplied by 3 so I'd want to remove [3 3 3]. What is the most efficient way to do this?