mersenneforum.org "My Prime Verify Code"
 Register FAQ Search Today's Posts Mark Forums Read

2020-11-15, 05:50   #1
ONeil

Dec 2017

F016 Posts
"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!
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

 2020-11-15, 06:07 #2 retina Undefined     "The unspeakable one" Jun 2006 My evil lair 32×23×29 Posts Do you know about Fermat's little theorem? That is what you have done.
2020-11-15, 06:27   #3
ONeil

Dec 2017

24·3·5 Posts

Quote:
 Originally Posted by retina 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

2020-11-15, 06:34   #4
VBCurtis

"Curtis"
Feb 2005
Riverside, CA

35·19 Posts

Quote:
 Originally Posted by ONeil Well my formula is not exactly like Fermat's right retina?
You tell us- how is it different?

2020-11-15, 07:00   #5
ONeil

Dec 2017

3608 Posts

Quote:
 Originally Posted by VBCurtis You tell us- how is it different?
+ 2**p-1 not much difference u right lol

 2020-11-15, 13:42 #6 Dr Sardonicus     Feb 2017 Nowhere 22·7·149 Posts What does this code do with the input value 1105?
2020-11-15, 14:45   #7
retina
Undefined

"The unspeakable one"
Jun 2006
My evil lair

32·23·29 Posts

Quote:
 Originally Posted by Dr Sardonicus 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.

2020-11-15, 15:20   #8
paulunderwood

Sep 2002
Database er0rr

353210 Posts

Quote:
 Originally Posted by retina 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

2020-11-15, 16:36   #9
Dr Sardonicus

Feb 2017
Nowhere

22×7×149 Posts

Quote:
 Originally Posted by retina 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?

2020-11-15, 17:58   #10
ONeil

Dec 2017

24×3×5 Posts

Quote:
 Originally Posted by Dr Sardonicus 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.

2020-11-15, 18:37   #11
VBCurtis

"Curtis"
Feb 2005
Riverside, CA

35·19 Posts

Quote:
 Originally Posted by ONeil 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?

 Similar Threads Thread Thread Starter Forum Replies Last Post marsik84 Miscellaneous Math 6 2020-04-30 20:27 pinhodecarlos Prime Gap Searches 170 2019-12-10 19:33 ssybesma Information & Answers 9 2018-12-13 13:42 Godzilla Miscellaneous Math 25 2018-09-28 17:10 MercPrime Information & Answers 5 2013-05-12 22:03

All times are UTC. The time now is 02:12.

Fri Jan 22 02:12:47 UTC 2021 up 49 days, 22:24, 0 users, load averages: 4.62, 4.60, 4.43