Baseline Bit Manipulation · Advanced Maths O(n log log n) · O(n) for the sieve array
A data center audits how many access levels below a threshold n remain 'prime' — held by exactly one badge. Starting from level 2, each surviving holder's multiples are struck from the roster (their access is shared, not unique), and sweeping from the survivor's own square onward avoids re-striking. The audit closes with the count of levels never struck.
Input: An integer n.
Output: The number of primes strictly less than n.
0 <= n <= 5 * 10^6Input: {"n":10}
Output: 4
2, 3, 5, 7 survive the strike-off below 10.
Input: {"n":1}
Output: 0
No levels exist below 1, let alone prime ones.