This page expores patterns in the equation (P1n + P2m) modulo P3, where P1, P2 and P3 are prime numbers.
For an example we can look at P1 = 2, P2 = 3 and P3 = 5.
Note that the cells that are divisible by 5 form a pattern.
You can use the following form to create tables for other combinations of primes (or other numbers). (Note. The table algorithm uses javascript's built-in integers which, at the time of writing, are limited to 9007199254740991 (253 - 1)).
P1 : P2 : P3 :
We can explore further by working with moduli rather than the values. For powers of a single prime, 'p', when calculating pn mod p2 we see that
pn mod p2 = ((pn-1 mod p2) x p) mod p2.
and
p0 mod p2 = 1.
We can use this to generate a sequence of moduli for a given pair of primes, for instance 3n mod 31 gives:
[1, 3, 9, 27, 19, 26, 16, 17, 20, 29, 25, 13, 8, 24, 10, 30, 28, 22, 4, 12, 5, 15, 14, 11, 2, 6, 18, 23, 7, 21, 1]
Which has 30 members. So 3n mod 31 = 3(n mod 30) mod 31.
Calculate your own sequence: P1 : P2 :
If you experiment with this custom sequence generator you will discover that the number of members in the sequence is always a factor of (P2 − 1). Which leads to the equation
p1(p2-1) mod p2 = 1.
An equation which is very useful in proving that big numbers aren't prime. Unfortunately it can't be used to prove that big numbers are prime as there are some false positives. If you tried the table generator above you will have noticed that it overflows quite quickly if you choose numbers over 25. Instead we can explore the patterns using these moduli instead.
P1 : P2 : P3 :
The unit cell is determined by the number of entries in the two remainder series. There are three main possibilities:
(c) John Whitehouse 2014 - 2021