I am now working on RSA and DES encryption algorithm (college project..) Well when i was generating prime numbers i noticed one thing
3 x 3 =9 where 3 is a prime number
now the result 9-2 =7 where 7 is a primenumber
7 x 7 = 49 where 7 is a prime number
the result 49 - 2 = 47 is a prime number
13 x 13 = 169
the result 169 - 2 = 167 which is a prime number
373 X 373 = 139129
and the result 139129 - 2 =139127 which is not a prime
because 6049 x 23 = 139127
but 50 % of the time the result for big numbers like this yeilds another primenumber... So is there anyway i can use this method to always generate big primenumbers by eliminating the non posibility numbers as 373 x 373 shown above.. And is these any theorem or study regarding the generation of prime this way.. Please help...
thanx in advance
Here this is true for most of the smaller numbers and some bigger numbers.. But this does not work for all big numbers.... But you can say i got a 40 to 50 % sucess with bigger numbers in this way.....
Forget your home brew prime generation technique, it won't hold water when numbers get bigger.
Thank you very much.. Well i am now using this technique
conside i want to find wheather 40001 is a prime number then...
I use only odd numbers that is incerement i=i+2 starting from 3 thus saving 50 time and then dividing then original number by 2 that is 40001/2.. and trying all posibilities from 3 * 3, 3* 4 till 3 * 40001/2 and 4 * 3, 4* 4 till 4 * 40001/2 and so on...... So can i add more constraints here and make my code faster....