Number Theory & Precision · Formula v1.0

Prime Number Calculator

Find the smallest prime factor of a number, and the nearest primes above and below it.

LAST REVIEWEDSeptember 24, 2026Inputs stay in your browser
Live calculation

Enter your numbers

Calculated result
Smallest prime factor97
Next prime above101
Previous prime below89
Sensitivity check

What if whole number changes?

-10% input3
0% input97
+10% input107

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.

FreeNo sign-upInputs stay in-browserCSV exportReviewed September 24, 2026

Transparent method

The formula

Trial division by every integer up to √n finds the smallest factor; the next and previous primes are found the same wayAt the worked-example inputs the smallest prime factor is 97. It rises with whole number.

Check whether a number is prime and find its neighbors among the primes.

Worked example

Smallest prime factor97
Next prime above101
Previous prime below89

Example inputs

Whole number97

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.

Interpretation boundary

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.

Prime Number Calculator: smallest prime factor and next prime above and previous prime below across a range of whole number, every other input held at the worked-example value.
Whole numberSmallest prime factorNext prime abovePrevious prime below
7827973
8738983
97worked example9710189
107107109103
1162127113

Step by step

The worked example, input by input

Worked-example inputs and the results they produce for the prime number calculator.
InputValue usedWhat it means
Whole number97Any whole number up to 1,000,000,000.
Smallest prime factor97
Next prime above101
Previous prime below89

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

  1. 1Verify the inputs. Gather whole number from your own documents; the prefilled values are examples.
  2. 2Save a baseline. The worked example puts the smallest prime factor at 97. Store your own version of it as Scenario A.
  3. 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.
  4. 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.

All number theory & precision questions answered

Sources and evidence

Free Calculators Online is independent and is not affiliated with or endorsed by the source organizations. Educational estimates only.

Definitions

Terms used on this page

Greatest common factor (GCF) : glossary term
The largest number that divides two or more numbers evenly. It reduces fractions and ratios to their smallest whole-number form.
Least common multiple (LCM) : glossary term
The smallest number that two or more numbers all divide into evenly. Used for common denominators and for aligning repeating cycles.
Prime factorization : glossary term
Breaking a number down into the prime numbers that multiply together to produce it. Every whole number greater than 1 has exactly one such breakdown.
Percent error : glossary term
How far a measured value sits from the known or theoretical one. Expressed as a percentage of the theoretical value.