Primes and Factors Calculator

This calculator finds prime numbers and you can check numbers for several conjectures about primes. You can also find all the divisors (factors) of a number or find the largest single divisor of a set of numbers (gcd) or the smallest number which has every number in the list as a divisor (lcm).
Numbers must be positive and are limited to the Javascript range of up to 16 digits ≈ 9×1015 or, more precisely, whole numbers ≤ 9007199254740991 = 253−1.
On this page, prime numbers are shown like this.

The Conjectures

These are statements about all numbers of a certain kind but they are conjectures or "open" statements because there is neither a proof that they are always true or a proof that they are not always true.
Perhaps you can find a pattern that you can prove always holds or perhaps you can find an example which shows it is not true for a particular number (a counter-example)?
Goldbach's conjecture
(as adapted by Euler) is that every even number ≥4 is the sum of 2 prime numbers and has been verified up to 4×1018 but there is as yet no proof. An odd number is the sum of two other odd numbers so our primes here are the odd ones and exclude 2.
This calculator will therefore not find a counter-example (which would prove the conjecture is false) but you can use it to spot patterns which is one way to approach finding a proof that it true.
For example:
6 = 3 + 3
38 = 7 + 31
389965026819938 = 5569 + 389965026814369
The "weak Goldbach conjecture"
is that all odd numbers≥9 are the sum of three odd primes This would automatically be true if the (strong) Goldbach conjecture above was true. How? Because we can take 3 (a prime) from any odd number and the even number remaining would be sum of 2 primes IF the (strong) Goldbach conjecture was true. So the odd number is a sum of 3 odd primes.
For example:
389965026819939 = 3 + 13 + 389965026819923 = 95 + 2389965026819749
But we do no know if the Goldbach conjecture is true and neither is a proof or disproof of this weaker form.
Lemoine's conjecture (sometimes called Levy's conjecture)
is that all odd numbers >6 are the sum of a prime number and twice a prime number.
For example:
39 = 29 + 2×5
41 = 37 + 2×2
43 = 37 + 2×3
It has been verified up to 109 so there is a possibility that you could find a counter-example using this Calculator!
Oppermann's Conjecture
is about the distribution of primes - another mystery that mathematicians do not fully understand. The conjecture from 1882 is that within a range of n numbers either side of n2 there is always at least one prime number.
More formally: There is always a prime number in the range N2 − N .. N2 and in the range N2 .. N2 + N for every number N>1.
For example, if N is 5 then the lower range is 20..25 which contains the prime 23 and in the range 25..30 there is a prime: 29.
Often, of course, there is more than one but Oppermann's conjecture is there is always at least 1.
The number of primes between N2−N and N2 for N≥2 is 2, 1, 1, 1, 1, 2, 2, 2, 1, 1, 2, ... A094189
The number of primes between N2 and N2+N is 1, 1, 1, 2, 1, 2, 1, 2, ... A089610
Legendre's Conjecture
is that there is always a prime between two neighbouring square numbers, that is between N2 and (N+1)2 but since N2+N < (N+1)2 = N2 + 2N + 1 then Oppermann's conjecture if proved true would immediately show that Legendre's conjecture is true also.
However there is no proof of either as yet.
The Twin Primes conjecture
The prime numbers begin 2, 3, 5, 7, 11, 13, 17, 19, 29, 31, ... and we notice that, after 2 and 3, there are several pairs here that have the minimum difference of 2, called "twin primes":
3,5; 5,7; 11,13; 17,19; 29,31; ... ; A001359,A006512.
Alternatively, we can find numbers n where n±1 are both prime. This list is 4, 6, 12, 18, 30, ..., A014574 and all entries after the first are multiples of 6.
The Twin Primes Conjecture is that there are infinitely many pairs of primes p and p+2.
Many records have been broken recently in looking for "the largest known twin primes".
In September 2016 it was proved that 2996863034895 × 21290000 ±1 were both prime and they have 388342 digits!
On 19 October 1994, Thomas Nicely, a professor of mathematics at Lynchburg College in Virginia USA, in the course of establishing that there are 135780321665 twin primes less than 1014 notoriously revealed an error in the Pentium computer chip's Floating Point Unit. It was corrected in later verisons of the chip.
Most mathematicians would suspect the list never ends, but there is no proof yet.

The Primes and Factors Calculator

Number N
up to


R E S U L T S Prime numbers are shown like this.


Further investigations

Lemoine's and Levy's Conjectures

In how many ways can we write n, an odd number, as n = p + 2 q for prime numbers p and q?
The number of ways to satisfy Lemoine's conjecture

n<200 n<2000 n<20000
The counts of the number of solutions for 1,3,5,7,... (the odd numbers) is 0, 0, 0, 1, 2, 2, 2, 2, 4, 2, 3, 3, 3, 4, ... A046927 and, if the conjecture is true, then there should be no further zeroes in the sequence apart from the first three (n<7).

A graph of the number of solutions of Lemoine's Conjecture for odd numbers up to 6000, is shown here. It has an interesting structure that invites further exploration.

7 is the first (odd) number with a solution: 7 = 3 + 2×2
9 is the first number with 2 solutions: 9 = 3 + 2×3 = 5 + 2×2
17 is the next with not 3 but 4 solutions: 17 = 3+2×7 = 7+2×5 = 11+2×3 = 13+2×2.
Continuing this list, the numbers that break records (they have more solutions than any earlier value) are
7, 9, 17, 33, 45, 51, 75, ... A194830.

Levy's conjecture of 1963 (see the reference below) is just Lemoine's but he also adds that if we can write the odd number 2N + 1 as 2P + Q for primes P and Q then he conjectures there is a Q in the range 1 < Q < (2N + 1)/3.
This is clearly false even for small N. It fails for 2N+1 = (3, 5,) 7, 9, 11, 15, 21, 23, 35, 83, ... .
However, if he meant P (the prime that is doubled) instead of Q, then it is almost certainly true for all odd numbers bigger than 7.

Links and References

© 2000-2019 Dr Ron Knott

updated 15 January 2019
Back to Dr Knott's Maths HOME page Valid HTML 4.01!