Answer first
What this calculator tells you
Find the smallest prime factor of a number, and the nearest primes above and below it. Check whether a number is prime and find its neighbors among the primes. Formula: Trial division by every integer up to √n finds the smallest factor; the next and previous primes are found the same way. At the worked-example inputs, the smallest prime factor is 97. Holding every other input steady, moving whole number from 78 to 116 moves the result from 2 to 107.
Transparent method
The formula
Check whether a number is prime and find its neighbors among the primes.
Worked example
Example inputs
How to interpret the result
A prime has no factors other than 1 and itself, so the smallest prime factor of a prime is the number itself. For 97 the search up to its square root finds nothing, which proves it prime. The neighbors are 89 below and 101 above. Primes thin out as numbers grow but never run out, and the gaps between them are irregular, which is why they show up in encryption.
At the worked-example inputs the smallest prime factor is 97. It rises with whole number.
These are exact arithmetic operations; results are limited only by floating-point precision.
Before you rely on it
What to check
Look at the smallest factor. If it equals the number, the number is prime. Otherwise it names the first divisor that breaks it apart.
The common error
Where people go wrong with prime number calculator
Calling 1 a prime. It has only one factor, and by convention primes must have exactly two, so 2 is the first prime.
Sensitivity evidence
How whole number changes the smallest prime factor
Holding every other input at the worked-example value, moving whole number from 78 to 116 moves the smallest prime factor from 2 to 107: a spread of 105, or 108% of the worked-example result.
| Whole number | Smallest prime factor | Next prime above | Previous prime below |
|---|---|---|---|
| 78 | 2 | 79 | 73 |
| 87 | 3 | 89 | 83 |
| 97worked example | 97 | 101 | 89 |
| 107 | 107 | 109 | 103 |
| 116 | 2 | 127 | 113 |
Step by step
The worked example, input by input
| Input | Value used | What it means |
|---|---|---|
| Whole number | 97 | Any whole number up to 1,000,000,000. |
| Smallest prime factor | 97 | |
| Next prime above | 101 | |
| Previous prime below | 89 | |
Inputs, definitions and assumptions
Whole number
Any whole number up to 1,000,000,000. The prefilled worked-example value is 97.
How to use this calculator
- 1Verify the inputs. Gather whole number from your own documents; the prefilled values are examples.
- 2Save a baseline. The worked example puts the smallest prime factor at 97. Store your own version of it as Scenario A.
- 3Test one change. Start with whole number, the input with the biggest effect here: moving whole number from 87 to 107 takes the smallest prime factor from 3 to 107, a swing of 107% of the worked-example figure.
- 4Check the extremes. At half the example whole number (48.5) the smallest prime factor is 7; at double (194) it is 2.
People also ask
Frequently asked questions
How do you calculate prime number?
Trial division by every integer up to √n finds the smallest factor; the next and previous primes are found the same way. At the worked-example inputs the smallest prime factor is 97.
What does the prime number result mean?
Check whether a number is prime and find its neighbors among the primes. At the worked-example inputs the smallest prime factor is 97. It rises with whole number.
How much does whole number change the smallest prime factor?
Holding every other input at the worked-example value, moving whole number from 78 to 116 moves the smallest prime factor from 2 to 107, a spread of 105.
What are the limits of this prime number calculator?
These are exact arithmetic operations; results are limited only by floating-point precision. The tables on this page test whole number only from 78 to 116; a value outside that range is not tabulated here.
If I double whole number in the prime number calculator, does the smallest prime factor double?
Doubling it from 97 to 194 takes the smallest prime factor from 97 to 2, which is 0.02 times the worked-example figure. So it falls instead of rising. Halving it to 48.5 gives 7.
Which inputs change the next prime above in the prime number calculator?
At the worked-example inputs it is 101. Whole number takes it from 89 to 109.
Which inputs change the previous prime below in the prime number calculator?
At the worked-example inputs it is 89. Whole number takes it from 83 to 103.
Is there a limit to how large a number these calculators can handle?
Yes: JavaScript's number type loses exact precision past about 9 quadrillion (2^53), and factorial-style growth hits that ceiling fast. A calculator that would silently return a wrong answer past that point refuses instead, rather than showing a confident but incorrect result.
What is special about the Fibonacci sequence?
Each term is the sum of the two before it, and the ratio of neighboring terms approaches the golden ratio, about 1.618. The sequence shows up in counting problems and in some natural growth patterns.
How can I check whether a number is prime by hand?
Divide it by every prime up to its square root. If none divides evenly, it is prime. For 97 you only need to test 2, 3, 5 and 7, since 11 squared is already 121.
Sources and evidence
Free Calculators Online is independent and is not affiliated with or endorsed by the source organizations. Educational estimates only.