#K50037. Unique Prime Factors of Factorial
Unique Prime Factors of Factorial
Unique Prime Factors of Factorial
Given a positive integer \(N\), your task is to compute the number of unique prime factors of \(N!\) (i.e., the factorial of \(N\)).
Recall that \(N! = 1 \times 2 \times 3 \times \cdots \times N\), and the unique prime factors of \(N!\) are exactly the prime numbers that are less than or equal to \(N\). Thus, the problem reduces to counting the number of prime numbers \(p\) such that \(p \le N\).
inputFormat
The input is given via stdin
and consists of a single integer \(N\) (\(N \ge 1\)).
outputFormat
Output, to stdout
, a single integer which is the number of unique prime numbers that divide \(N!\) (i.e., the count of primes \(\le N\)).
2
1