 mersenneforum.org "My Prime Verify Code"
 Register FAQ Search Today's Posts Mark Forums Read  2020-11-15, 22:02 #23 ONeil   Dec 2017 F016 Posts Ok I know this has many rules to weed out composites for pseudo primes that register a 2 for prime, but this code should be the final answer. 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('1)If below multiplication number is an odd composite then number is composite') print('2)Also if number has a .5 and the number to left is 2 then PRIME') print('3)However if last counted number is prime and multiplication number is Prime then prime. Over rides all rules)') print('4)Exception for .5 numbers, Last counted number has to be prime for number to be prime, but remember to to multiply even number and divide!') 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('For .5, Multiplication number when doubled then added to lasted counted number is prime then inputed number is prime and when .5 it cannot be 5.5 to be 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))   2020-11-15, 22:03   #24
Dr Sardonicus

Feb 2017
Nowhere

24·32·29 Posts Quote:
 Originally Posted by ONeil Some adjustments to the rules here is new code!
Quote:
 Originally Posted by ONeil check above code again I made one small rule adjustment.
No. It's your code. You check it.

It's not for me (or anyone else) to look for counterexamples your latest "adjustments" haven't excluded. I'm not playing that game. IMO you don't understand what you're doing, other than in making your code gratuitously inefficient and hard to read. In that area, you've got some talent.

BTW, in the attachment you so kindly posted earlier in this thread, does it indicate, as it appears to, that it took three seconds to check my input 1105?   2020-11-15, 22:17   #25
chalsall
If I May

"Chris Halsall"
Sep 2002

2·3·1,567 Posts Quote:
 Originally Posted by Dr Sardonicus No. It's your code. You check it. It's not for me (or anyone else) to look for counterexamples your latest "adjustments" haven't excluded. I'm not playing that game.
A sincere question: What game are you playing?

What is the upside in the answer(s) given through this matrix?

I'm probably being rather stupid in not seeing the purpose. But, I don't.

Edification welcomed.   2020-11-15, 22:49 #26 mathwiz   Mar 2019 8F16 Posts Is the OP trying to reinvent a hard-to-read, inefficient version of Fermat's little theorem?   2020-11-15, 23:47   #27
Dr Sardonicus

Feb 2017
Nowhere

24×32×29 Posts Quote:
 Originally Posted by chalsall A sincere question: What game are you playing?
I don't accept the premise of your question. I said I was not playing a specific game. To wit, the crank's game of proposing something unjustified and demonstrably wrong, then, the wrongness being demonstrated, making some modifications and asserting the "new, improved" version is right, and challenging others to show it isn't. No. It's up to the claimant to justify his claims.

Quote:
 What is the upside in the answer(s) given through this matrix?
"This matrix? Huh? I don't understand the question.

Quote:
 I'm probably being rather stupid in not seeing the purpose. But, I don't. Edification welcomed.
The purpose of what?   2020-11-16, 00:59 #28 ONeil   Dec 2017 24·3·5 Posts I don't know why you guys are so hard on me! I have checked the code and it seems to defeat the composites yet if you find a number that proves it wrong let me know ok Thankyou!     2020-11-16, 01:34 #29 ONeil   Dec 2017 24×3×5 Posts ok this should be finished! lol 5.5 was giving me problems so if anyone finds issues please post the number if its not prime which skirts the rules. Here is the code again my brow is sweating! 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('1)If below multiplication number is an odd composite then number is composite') print('2)Also if number has a .5 and the number to left is 2 then PRIME') print('3)However if last counted number is prime and multiplication number is Prime then prime. Over rides all rules)') print('4)Exception for .5 numbers, Last counted number has to be prime for number to be prime, but remember to to multiply even number and divide!') 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('For .5, Multiplication number when doubled then added to lasted counted number is prime then inputed number is prime and when .5 if above the last counted number at 1 or 2 numbers and @ right the number is odd then number is 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-16 at 01:50 Reason: code   2020-11-16, 01:43   #30
mathwiz

Mar 2019

11·13 Posts Quote:
 Originally Posted by ONeil I don't know why you guys are so hard on me!

Because you post obvious snake-oil programs like the "twin prime finder", which is a glorified and hard to read way to add 2 to a number.

Because you ask US to test your code and find flaws, rather than testing it yourself.   2020-11-16, 01:50 #31 Uncwilly 6809 > 6502   """"""""""""""""""" Aug 2003 101×103 Posts 5×7×263 Posts   Exactly.   2020-11-16, 01:58   #32
ONeil

Dec 2017

3608 Posts Quote:
 Originally Posted by mathwiz Because you make fantastic claims about your code? Because you post obvious snake-oil programs like the "twin prime finder", which is a glorified and hard to read way to add 2 to a number. Because you ask US to test your code and find flaws, rather than testing it yourself.
Yo mathwiz,

Obviously people point out flaws anyway if they see one so why not ask for pointers? I'm not selling this code I'm just trying to help humanity reach the stars, because if we can find and easy way to factor we as humans have reached a milestone in math forcing the crypto environment to change. Then we all might have to share more often and with sharing humans will make it to the stars   2020-11-16, 02:03   #33
mathwiz

Mar 2019

11×13 Posts Quote:
 Originally Posted by ONeil Yo mathwiz, Obviously people point out flaws anyway if they see one so why not ask for pointers? I'm not selling this code I'm just trying to help humanity reach the stars, because if we can find and easy way to factor we as humans have reached a milestone in math forcing the crypto environment to change. Then we all might have to share more often and with sharing humans will make it to the stars
People on this forum generally aren't interested in posts of the form "this code is great, everyone now go test it".

It's not an unreasonable expectation for you to test your OWN code on a large range of primes and composites.

To be clear: primality testing and integer factorization have been studied extensively and it's really, really, really hard to beat the current state of the art methods. That's not to say that you won't or can't. But a small 20 or so line Python program that you expect others to test doesn't inspire much confidence that you've made progress.   Thread Tools Show Printable Version Email this Page 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:21.

Sat Jan 23 02:21:37 UTC 2021 up 50 days, 22:32, 0 users, load averages: 2.02, 1.77, 1.68