### PROBLEM LINK:

[Contest] T22

**Author:** Nandishwar Garg

### DIFFICULTY:

SIMPLE

### PREREQUISITES:

Looping Knowledge

### PROBLEM:

You are given array of size **N**. You have to find product of each ai and aj. Now you have to check whether ai*aj is smallest prime number or not? If it the smallest prime number exists then print it otherwise print -1.

### EXPLANATION:

Suppose the size of array is 3 and the elements of array are 1, 2 and 3. You have to find the product (ai*aj) of elements. So, in this case product will be 2,3,6.

Now you need to find the prime numbers among the products. Here, the prime numbers are 2 and 3. Further you need to find the smallest number among the prime numbers. In this case, the smallest prime number is 2. So, you need to print 2.

We take another example, the size of array is 4 and elements are 5, 5, 5 and 2. Their products will be 25, 25, 10, 25,10,10. This product set doesn’t contain any prime number so you are required to print -1.

### AUTHOR’S SOLUTION:

Author’s solution can be found here