Distinct Prime Factors
Return how many different prime numbers divide n. For example 12 = 2 * 2 * 3 has two different primes. For n = 1 return 0.
Example 1
n 12
returns 2
The primes are 2 and 3.
Example 2
n 49
returns 1
Only 7.
Constraints
1 <= n <= 5000
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.