I'm trying to solve a challenge coding problem and the question is described below

Given N integers A1, A2, …, AN, count the number of triplets (x, y,

z) (with 1 ≤ x <y <z ≤ N) so that at least one of the following is

true:Ax = Ay × Az, and / or

Ay = Ax × Az, and / or

Az = Ax × Ay

5 2 4 6 3 1

In the case of sample n. ° 1, the only triplet that satisfies the condition given in the statement of the problem is (2, 4, 5). The triplet is valid because the second, fourth and fifth integers are 2, 6 and 3, and 2 × 3 = 6. Therefore, the answer here is

one2 4 8 16 32 64

The six triplets that satisfy the condition given in the statement of the problem are: (1, 2, 3), (1, 3, 4), (1, 4, 5), (1, 5, 6), (2, 3, 5), (2, 4, 6). so the answer here is 6

My Code in python:

```
import itertools
account = 0
for t in itertools.combinations (1, 3):
yes t[0]* t[1]== t[2] or t[1]* t[2]== t[0] or t[0]* t[2]== t[1]:
account + = 1
print (count)
```

So this is the naive way to generate all possible combinations of 3 lengths and verify the condition. This works well for a smaller entry, but when the complexity of the increase time of the entry size increases. I'm assuming for an example that has `1,2,3,6,8`

the combinations generated are `(2,3,6), (2,3,8)`

2,3,6 satisfy the condition, so the check of 2,3,8 is unnecessary and can be avoided. How can I modify my code to take advantage of this observation?