Largest prime below 100
- Input
- 97
- Expected output
- primo
97 is the 25th and last prime before 100; the factorization shows just the number itself, since no smaller factor exists.
prime number properties
There are infinitely many prime numbers, but they grow steadily rarer: there are 25 primes below 100 and 168 below 1000. The Sieve of Eratosthenes, from around 240 BC, is still the simplest way to list every one of them up to a limit N.
97 is the 25th and last prime before 100; the factorization shows just the number itself, since no smaller factor exists.
It is not divisible by 2, 3 or 5, the first tests, which is misleading; it only fails at divisor 7, one reason 91 is a common mistake on tests.
121 = 11 × 11 is not prime, but it has only one prime factor (11) squared, which also makes it a perfect square.
A prime number is an integer greater than 1 that has no positive integer divisors other than 1 and itself. The first primes are 2, 3, 5, 7, 11, 13…
No. Euclid proved around 300 BC that the list of primes never ends, with a proof by contradiction still taught today. The largest known primes today have tens of millions of digits and are of the form 2ᵖ − 1, the Mersenne primes.
Exactly 168. The Prime Number Theorem estimate, n/ln(n), gives about 145 for n=1000, a value below the real count: the formula underestimates in this range and only gets close to the exact value for much larger n.
It is enough to test divisors up to the square root: √97 ≈ 9.8 and √91 ≈ 9.5, so only 2, 3, 5 and 7 (and occasionally 9) need to be checked. 91 fails at 7 (91 = 7 × 13); 97 fails at none of them, which confirms it is prime.
Supports positive integers up to 10²⁴.
All calculations stay in your browser. No data is sent to any server.