Count primes below n
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · 이 페이지는 최신 브라우저(SharedArrayBuffer 지원)가 필요합니다. Chrome, Edge, Firefox 또는 Safari를 최신 버전으로 업데이트해 주세요.
English
Count primes below n
Return how many prime numbers are strictly less than n. A prime has no divisors other than 1 and itself. For each candidate k, test divisors only up to √k (i.e. while d * d <= k) — once one divides k evenly, it isn't prime.
한국어
n 미만의 소수 세기
strictly less than n인 소수의 개수를 반환하세요. 소수는 1과 자신 외의 약수가 없습니다. 각 후보 k에 대해 약수 테스트를 √k까지만 수행하십시오(즉, d * d <= k일 때) — 한 번이라도 k를 나눈다면 소수가 아닙니다.
Complete countPrimes(int n) returning how many prime numbers are strictly less than n. Example: countPrimes(10) is 4 (2, 3, 5, 7).
Click Run to see the output here. · 출력을 보려면 '실행'을 클릭하세요.