values. Imagine multiplying all of its elements together. How many different prime numbers divide that product?
The product itself can be enormous, so actually computing it is not a good idea.values=[12, 35, 9] → 4
12 = 2²·3, 35 = 5·7 and 9 = 3². The product contains the primes 2, 3, 5 and 7, which makes four.
values=[49, 7, 343] → 1
Every number is a power of 7, so there is only one prime factor.
values=[997] → 1
values=[12, 35, 9]
4
Run checks the first 3 tests in your browser. Submit checks all 114 tests on the server, hidden ones included.