1: When N>=6 and N-1 and n+1 are twin primes, then n must be a multiple of 6.
Proof: Because N-1 and n+1 are prime----①
So n-1 and n+1 are odd----②
So n is an even number is a multiple of 2--③
Assuming that n is not a multiple of 3, get:
N=3x+1 or N=3x+2,
If n=3x+1 n-1=3x this and ①, so n≠3x+1
If N=3x+2,zen+1=3 (x+1) and ① violate
So the hypothesis is not established, both n is a multiple of 3 and ② conclusion N is a multiple of 6.
The following conclusions can be drawn from the above rules:
such as X>=1 and n=6x+1 or n=6x+1, then n must not be multiples of 2 and 3
Prove.
Because N=6x-1 and n=6x+1, i.e. n=2* (3x) +1 or n=3* (2x)-1
So n must not be multiples of 2 and three
The occurrence of prime numbers:
When N>=5 is, if n is a prime number then n mod 6=1 or n mod6=5, i.e. n must appear on either side of 6x (x>=1).
Prove:
When X>=1 is, it is like the following representation method:
~~~~~~~6x,6x+1,6x+2,6x+3,6x+4,6 (x+1), 6 (x+1) +1,~~~~~
So no longer 6x on both sides of the number of 6x+2,6x+3,6x+4 namely 2 (3x+1), 3 (x2+1), 2 (2x+2), they must not be prime, so the prime numbers appear on both sides of 6x.
The following is a quick way to determine if a number is prime.
1 BOOLIsPrime (intnum)2 { 3 if(num = =2|| num = =3) 4 { 5 return true; 6 } 7 if(num%6!=1&& num%6!=5) 8 { 9 return false; Ten } One for(inti =5; I*i <= num; i + =6) A { - if(num% i = =0|| Num% (i+2) ==0) - { the return false; - } - } - return true; +}
A fast method for judging ———————————————— primes ————————————————————