If you multiply consecutive prime numbers starting from 2, to get a
number like 2x3x5==30, and then look at prime numbers modulo 30 you see
there are only certain possible values.
Since 30 is a multiple of 2, n%2 == (n-30*k)%2.
By choosing k so that (n-30*k)==n%30 we know n%2==(n%30)%2.
Ditto for 3 and 5.
So if n isn't divisible by 2 or 3 or 5, n%30 still isn't divisible by 2
or 3 or 5.
Here are the numbers less than 30 that aren't divisible by 2, 3 or 5:
1, 7, 11, 13, 17, 19, 23, 29
As you can see they are all prime! ... except for 1. And some prime
numbers mod 30 are 1, such as 31. It's only always prime if you count 1
as prime.
That's because all the numbers less than 30 are either divisible by 2, 3
or 5, or they are prime. The first non-prime number that isn't divisible
by one of those is 49, which is 7x7.
Why only 30? What happens if we try a different modulus? Instead of mod
2x3x5 we can try mod 2x3 or mod 2x3x5x7.
If you take away 5 and try mod 6 (2x3) it works: all prime numbers mod 6
are either 1, or 5 (which is prime).
If you also take away 3 and try mod 2 it almost works, since 2%2==0. But
that's the only exception - all other primes mod 2 are 1.
If you try adding more primes and try mod 210 (2x3x5x7) it doesn't work.
It still works that all the mods aren't divisible by 2, 3, 5 or 7 (and
that will keep working as you add more primes - any primes, not just
consecutive ones) but it doesn't work that those are the only prime
numbers. 121 (11x11) is a number less than 210 which isn't divisible by
2, 3, 5 or 7.
541 is a prime number and 541%210==121.
2x3x5==30 is the only sweet spot where all the numbers less than 30 that
aren't divisible by 2, 3, or 5 are prime (or 1).
What if we skip over some, e.g. do 3x5 instead of 2x3x5? Well then the
numbers that aren't divisible by them aren't all prime, either. E.g. 14
isn't divisible by 3 or 5, but it's less than 15 and not prime. 29 is a
prime and 29%15==14.