mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Blogorrhea > ONeil

Reply
 
Thread Tools
Old 2020-12-03, 22:34   #1
ONeil
 
Dec 2017

24·3·5 Posts
minus 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**r-1)
		y = ((((r//3)+1)))
		print('Prime Often >-->','|', y,'|')
SMALLER PRIMES:

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 2020-12-03 at 23:38
ONeil is offline   Reply With Quote
Old 2020-12-03, 22:52   #2
Viliam Furik
 
"Viliam Furík"
Jul 2018
Martin, Slovakia

7·53 Posts
Default

Just lookup "Wagstaff prime" on the Wikipedia...
Viliam Furik is offline   Reply With Quote
Old 2020-12-03, 22:57   #3
mathwiz
 
Mar 2019

14410 Posts
Default

Prime early, prime often.

In all seriousness, I have no idea what you're trying to accomplish with this.
mathwiz is offline   Reply With Quote
Old 2020-12-03, 23:05   #4
ONeil
 
Dec 2017

24·3·5 Posts
Default

Quote:
Originally Posted by mathwiz View Post
Prime early, prime often.

In all seriousness, I have no idea what you're trying to accomplish with this.
I had no idea about wagstaff primes and also I just edited the smaller primes code using round so it produces more primes. mathwiz I'm trying to forecast primes without a prime generator or do it in a non-conventional manner.

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.
ONeil is offline   Reply With Quote
Old 2020-12-03, 23:14   #5
ONeil
 
Dec 2017

3608 Posts
Default

Quote:
Originally Posted by Viliam Furik View Post
Just lookup "Wagstaff prime" on the Wikipedia...
Hey Villiam Furik can you be sure my formula is exactly using the the Wagstaff formula?

I don't think you are correct.
ONeil is offline   Reply With Quote
Old 2020-12-04, 05:58   #6
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

175316 Posts
Default

Quote:
Originally Posted by ONeil View Post
SMALLER PRIMES:

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,'|')
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.
CRGreathouse is online now   Reply With Quote
Old 2020-12-04, 10:22   #7
Viliam Furik
 
"Viliam Furík"
Jul 2018
Martin, Slovakia

7·53 Posts
Default

Quote:
Originally Posted by ONeil View Post
Hey Villiam Furik can you be sure my formula is exactly using the the Wagstaff formula?

I don't think you are correct.
Yeah, I am sure you are using the Wagstaff formula.

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
Viliam Furik is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
(M48) NEW MERSENNE PRIME! LARGEST PRIME NUMBER DISCOVERED! dabaichi News 571 2020-10-26 11:02
How does one prove that a mersenne prime found with CUDALucas is really prime? ICWiener Software 38 2018-06-09 13:59
Twin Prime Days, Prime Day Clusters cuBerBruce Puzzles 3 2014-12-01 18:15
disk died, prime work lost forever? where to put prime? on SSD or HDD? emily PrimeNet 3 2013-03-01 05:49
Prime Cullen Prime, Rest in Peace hhh Prime Cullen Prime 4 2007-09-21 16:34

All times are UTC. The time now is 18:44.

Wed Feb 24 18:44:47 UTC 2021 up 83 days, 14:56, 0 users, load averages: 1.24, 1.75, 1.85

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.