mersenneforum.org  

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

Reply
 
Thread Tools
Old 2020-11-15, 05:50   #1
ONeil
 
Dec 2017

24·3·5 Posts
minus "My Prime Verify Code"

Quote:
First prime Verify ever, if a Two its prime! Also here is the catch
2047 is a two and here is why 2^11-1, because this formula uses
((2^p-1)+(2^p-1))%p so a prime was used in the formula, therefore a two.
Note important! There is a way to show its a
composite number! If through division the counted number
does not equal itself then the number used was composite like
2047 even tho the formula contained 11 and if the number
contains a .5 it is 100% PRIME as long as a two is present!
© Tom O'Neil
I call this the Prime Verify Code. Now a number like 2047 will show it to be a TWO and it is a composite number however I found a way and there is a tool through simple multiplication and division which will show numbers like this to be composite and weed them out so your true prime for TWO will not lose there value. I stated it in the above text!


I believe this code is the first which can verify a prime which was used on input or if it was in the formula. So what I'm saying is this code will yield a 2 for 11 and a 2 for 2047 and I know 2047 is not prime however the formula uses ((2^11-1)+(2^11-1))%p and so 2047 is in there and was built by the prime number 11 so therefore a 2 so it is really for the 11.

So if you happen to find a composite which yields a 2 then that composite number was built with a prime number any other 2's that are not composite are definitely prime!

Very large numbers will cause memory issues, so if any python programmer out there know how to make this code work with a GPU which can utilize faster memory or more memory maybe that's is a work around. Maybe someone can optimize the code!
https://youtu.be/_kRhgwg4258






Code:
import time
start_time = time.time()

print('''First prime Verify ever, if a Two its prime! Also here is the catch
2047 is a two and here is why 2^11-1, because this formula uses
((2^p-1)+(2^p-1))%p so a prime was used in the forumla therfore a two.  
Note important!  There is a way to show its a
composite number! If through division the counted number
does not equal itself then the number used was composite like
2047 even tho the formula contained 11 and if the number
contains a .5 it is 100% PRIME as long as a two is present!
© Tom O'Neil''')
while True:
	

	p = int(input("Enter a Prime Number: "))
	if p % 2 !=0:
		
		m = (2**p-1)
		
		prime = ((m + m)%p)
		result = 1

	
		while p >= 1 :
			print(f'{result: <2}), {p}')
			p //= 2
	    
			result += 1
		print('^Last counted number @ up arrow!')
		print('----------------------------------')
		print('If below multiplication number is odd then number is composite')
		print('Also if number has a .5 and the number to left is 2 then PRIME')
		print('If below multiplication number is Prime then entered number is prime')
		print('----------------------------------')

	    
		print ((result/2 ,'Multiply this number if EVEN, by the last counted number, then divide by 2 until  it equals the last counted number and if it equals the last counted number then prime' ))
		print('____________________________________')
		print(prime,'<--< A two its prime or the number used was made by a prime')
		e = int(time.time() - start_time)
		print('{:02d}:{:02d}:{:02d}'.format(e // 3600, (e % 3600 // 60), e % 60))

Last fiddled with by ONeil on 2020-11-15 at 05:55 Reason: vid not showing
ONeil is offline   Reply With Quote
Old 2020-11-15, 06:07   #2
retina
Undefined
 
retina's Avatar
 
"The unspeakable one"
Jun 2006
My evil lair

135658 Posts
Default

Do you know about Fermat's little theorem?

That is what you have done.
retina is offline   Reply With Quote
Old 2020-11-15, 06:27   #3
ONeil
 
Dec 2017

24×3×5 Posts
Default

Quote:
Originally Posted by retina View Post
Do you know about Fermat's little theorem?

That is what you have done.
Hi retina I did not know about Fermat's theorem, but I like my method for breaking composite numbers that show as a two. I feel someone will complain about the memory error unless they have tons of memory on hand.

Well my formula is not exactly like Fermat's right retina?

Last fiddled with by ONeil on 2020-11-15 at 06:32
ONeil is offline   Reply With Quote
Old 2020-11-15, 06:34   #4
VBCurtis
 
VBCurtis's Avatar
 
"Curtis"
Feb 2005
Riverside, CA

53×37 Posts
Default

Quote:
Originally Posted by ONeil View Post
Well my formula is not exactly like Fermat's right retina?
You tell us- how is it different?
VBCurtis is offline   Reply With Quote
Old 2020-11-15, 07:00   #5
ONeil
 
Dec 2017

24·3·5 Posts
Default

Quote:
Originally Posted by VBCurtis View Post
You tell us- how is it different?
+ 2**p-1 not much difference u right lol
ONeil is offline   Reply With Quote
Old 2020-11-15, 13:42   #6
Dr Sardonicus
 
Dr Sardonicus's Avatar
 
Feb 2017
Nowhere

105B16 Posts
Default

What does this code do with the input value 1105?
Dr Sardonicus is offline   Reply With Quote
Old 2020-11-15, 14:45   #7
retina
Undefined
 
retina's Avatar
 
"The unspeakable one"
Jun 2006
My evil lair

5×1,201 Posts
Default

Quote:
Originally Posted by Dr Sardonicus View Post
What does this code do with the input value 1105?
I think you misunderstand the genius of the code.

It says right near the beginning "Enter a Prime Number: ". So you see, you are not permitted to enter composite numbers.
retina is offline   Reply With Quote
Old 2020-11-15, 15:20   #8
paulunderwood
 
paulunderwood's Avatar
 
Sep 2002
Database er0rr

2×3×19×31 Posts
Default

Quote:
Originally Posted by retina View Post
I think you misunderstand the genius of the code.

It says right near the beginning "Enter a Prime Number: ". So you see, you are not permitted to enter composite numbers.
LMAO. The OP has developed some amazing programs recently:

1. Rubbish trial division of Mersennes
2. Enter a prime p and print out p+2 which might be a twin.
3. Enter a prime and do a fermat test on it.

Wonders from the OP will never cease!

Last fiddled with by paulunderwood on 2020-11-15 at 15:28
paulunderwood is offline   Reply With Quote
Old 2020-11-15, 16:36   #9
Dr Sardonicus
 
Dr Sardonicus's Avatar
 
Feb 2017
Nowhere

53·79 Posts
Default

Quote:
Originally Posted by retina View Post
I think you misunderstand the genius of the code.

It says right near the beginning "Enter a Prime Number: ". So you see, you are not permitted to enter composite numbers.
The "genius" of this stuff is reminiscent of an old radio program my parents liked to talk about: It Pays to Be Ignorant.

But to address your (presumably tongue-in-cheek) point: The code doesn't forbid composite input. In fact, it has at least one instruction
Code:
print('If below multiplication number is odd then number is composite')
that allows for the input being composite.

Good thing, too. Otherwise, someone could enter a composite value, and the whole universe might wink out of existence.

So my question stands: What does this code do with the input 1105?
Dr Sardonicus is offline   Reply With Quote
Old 2020-11-15, 17:58   #10
ONeil
 
Dec 2017

F016 Posts
Default

Quote:
Originally Posted by Dr Sardonicus View Post
What does this code do with the input value 1105?
My system will prove its a composite number.

the last counted number is 11

multiply by 6

6x11=66

Now divide by 2 till you get 11 if you don't get 11 then 1105 is composite

66/2 = 33 | 33/2= 16.5 this shows that 1105 is composite. Please try better to break this program Dr Sardonicus I really think I found a way to show primes in a different way as well as defeat large composites. I know 1105 with mod 5 would should show 0 but I'm using my method right now.
ONeil is offline   Reply With Quote
Old 2020-11-15, 18:37   #11
VBCurtis
 
VBCurtis's Avatar
 
"Curtis"
Feb 2005
Riverside, CA

53·37 Posts
Default

Quote:
Originally Posted by ONeil View Post
I really think I found a way to show primes in a different way as well as defeat large composites.
When asked what was different a few posts ago, you agreed nothing was different from a fermat test. So, when you now say "in a different way", do you just mean that your code is crap but the test is the same as Fermat?
VBCurtis is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Prime numbers code broken marsik84 Miscellaneous Math 6 2020-04-30 20:27
Prime Gap Search latest version of the c code pinhodecarlos Prime Gap Searches 170 2019-12-10 19:33
picking a prime to VERIFY below M(57,885,161) ssybesma Information & Answers 9 2018-12-13 13:42
Verify the existence of a large enough prime number? Godzilla Miscellaneous Math 25 2018-09-28 17:10
Code for testing a prime other than form 2^n-1 MercPrime Information & Answers 5 2013-05-12 22:03

All times are UTC. The time now is 20:09.

Mon Jan 25 20:09:22 UTC 2021 up 53 days, 16:20, 0 users, load averages: 2.38, 2.08, 2.01

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.