20201203, 22:34  #1 
Dec 2017
2^{4}·3·5 Posts 
Prime Often 
Well after a certain amount of time of sitting on this formula I thought I would release the code to the world. Enter a prime number and the output at often times will be a different prime number, warning not always!
Here is the largest prime number produced by the prime exponent 127 using the LARGER PRIMES CODE: 56713727820156410577229101238628035243 I uploaded two sets of codes one that makes the large primes and the other which makes smaller primes. LARGER PRIMES: Code:
print('''Prime Often''') while True: r = int(input("Enter a Prime number to test if result is prime: ")) if r % 2 != 0: r = (2**r1) y = ((((r//3)+1))) print('Prime Often >>','', y,'') Code:
print('''Prime Often''') while True: r = int(input("Enter a Prime number to test if result is prime: ")) if r % 2 != 0: y = ((round((r/3)+1))) print('Prime Often >>','', y,'') Last fiddled with by Uncwilly on 20201203 at 23:38 
20201203, 22:52  #2 
"Viliam Furík"
Jul 2018
Martin, Slovakia
7·53 Posts 
Just lookup "Wagstaff prime" on the Wikipedia...

20201203, 22:57  #3 
Mar 2019
144_{10} Posts 
Prime early, prime often.
In all seriousness, I have no idea what you're trying to accomplish with this. 
20201203, 23:05  #4  
Dec 2017
2^{4}·3·5 Posts 
Quote:
I'm looking for a formula which can find huge primes and small primes. I wish I understood or knew the rule for which the prime gap is and if their is a universal formula. I'm starting to think there is no universal formula for prime gaps or we would always find any prime number with out any worry. 

20201203, 23:14  #5 
Dec 2017
360_{8} Posts 

20201204, 05:58  #6 
Aug 2006
1753_{16} Posts 
I tested this on the odd primes below 10^8 and found that it worked on 10.9% of them and failed on the balance. This is actually worse than you'd expect for a procedure that generates random odd numbers of their size.

20201204, 10:22  #7  
"Viliam Furík"
Jul 2018
Martin, Slovakia
7·53 Posts 
Quote:
1) Numbers (2^n  1) are congruent to 1 (mod 3) when n is odd. When it is even, they are congruent to 0 (mod 3). With that in mind, let's made a single edit to your formula: 2) y = r // 3 + 1 will become 3) y = (r // 3 + 1) * 3, which is equal to r // 3 * 3 + 3 4) That "// 3 * 3" part will guarantee that the number it spits out, not including the afterwards 3, will be divisible by 3, i.e. congruent to 0 (mod 3). 5) That number will be the nearest number from r divisible by 3, counting downwards. That will be, as we have shown in 1), r  1, because r is 2^n  1, which, for the odd n, is congruent 1 (mod 3), and r  1 is 0 (mod 3), which is 2^n  1  1 = 2^n  2. 6) When we add the final 3, we get 2^n  2 + 3 = 2^n + 1. If we take back the change in formula performed in 3), we will get the formula for y being (2^n + 1)/3, or (2 ** n + 1) // 3 in Python. By simply evaluating the terms after performing a single change in formula, which we removed in the end, we got the said formula. QED 

Thread Tools  
Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
(M48) NEW MERSENNE PRIME! LARGEST PRIME NUMBER DISCOVERED!  dabaichi  News  571  20201026 11:02 
How does one prove that a mersenne prime found with CUDALucas is really prime?  ICWiener  Software  38  20180609 13:59 
Twin Prime Days, Prime Day Clusters  cuBerBruce  Puzzles  3  20141201 18:15 
disk died, prime work lost forever? where to put prime? on SSD or HDD?  emily  PrimeNet  3  20130301 05:49 
Prime Cullen Prime, Rest in Peace  hhh  Prime Cullen Prime  4  20070921 16:34 