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.

Semiprimes

A semiprime is a number n that has just 2 prime factors p and q so n = p × q. It is therefore "almost" a prime (which has only one prime factor, itself!) or a semiprime.
They have two useful applications:
Encryption
Special algorithms are used to encode a transaction at a cash machine or anything that has to send important information over a public network (such as a phone line or internet connection) where we need a secure connection. RSA and other public-key cryptosystems use a VERY large semiprime. The sender and receiver at either end know one of two prime factors of the semiprime and so can work out the other and knowing both prime factors is essential to decoding the message.
If anyone intercepts the message and even if they know the semiprime but do not know the two prime factors then there is no way they can decode the message. This is because no one yet knows any fast and efficient method for finding the two prime factors of very large semiprimes.
Knowing both of the two large prime factors is absolutely essential to decoding the message in such systems so semiprimes play an important role everyday when you use a credit card or draw money out of a cash machine.
The unique size of a rectangle

In 1974 a message was beamed from the Arecibo radio telescope into space towards a galaxy 25000 light years away with the hope that an alien culture there might one day receive it and understand it.
It was a stream of 1679 bits (0s and 1s).

Why 1679?
Because 1679 is a semiprime: 1679 = 23 × 73 so there is just one rectangular shape into which we can fit the 1679 bits.
If we represent 1s as black dots and 0s as white dots we get the rectangular "picture" on the right of 73 rows and 23 columns.

However, a rectangle of 23 rows of 73 columns is not the same as a rectangle of 73 rows of 23 columns and gives a completely different arrangement of the bits! Use the button to see the other version (the bits go down the columns instead of across the rows first).

If our intelligent aliens manage to "see" this "picture" and not the other arrangement, then would they interpret it as it was meant to be "read"? I seriously doubt it! It seems to have more to say about the state of computer graphics in the early 1970's than it does about the intelligent humans that sent it, but see what you think....
Have a go yourself at interpreting the "picture" before looking up the intended meanings at revolvy.com.


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 + 2×389965026819749
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

C A L C U L A T O R
Range: N
up to
Primes



with difference =
Factors

of

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



 

Further investigations

Lemoine's Conjecture

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
Show counts for n≡3(mod 6) in red, 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.
If we plot in red the counts for the (odd) numbers leaving a remainder of 3 when divided by 6 and the others in blue, the split in the plot reveals one of its secrets.

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

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, ... .
For example:
7 = 3 + 2×2 but 3 exceeds 7/3
35 = 13 + 2×11 = 29 + 2×3 = 31 + 2×2 and again 13 exceeds 33/3.
However, if Levy meant P (the prime that is doubled) instead of Q, then it is an excellent conjecture and is almost certainly true for all odd numbers from 7 onwards.

Links and References


© 2000-2019 Dr Ron Knott

updated 18 February 2019
Back to Dr Knott's Maths HOME page Valid HTML 4.01!