InterviewBit Academy is now Scaler!
InterviewBit Academy is now Scaler Academy!

Distinct Primes

You have given an array A having N integers. Let say G is the product of all elements of A.

You have to find the number of distinct prime divisors of G.

Input Format

The first argument given is an Array A, having N integers.

Output Format

Return an Integer, i.e number of distinct prime divisors of G.


1 <= N <= 1e5
1 <= A[i] <= 1e5

For Example

    A = [1, 2, 3, 4]
    here G = 1 * 2 * 3 * 4 = 24
    and distinct prime divisors of G are [2, 3]
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving Distinct Primes on Interview Code Editor
Sign Up
to access hints and editorial solutions for Distinct Primes


Click here to start solving coding interview questions