![]() |
![]() |
#23 |
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)) |
![]() |
![]() |
![]() |
#24 |
Feb 2017
Nowhere
24·32·29 Posts |
![]()
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? |
![]() |
![]() |
![]() |
#25 | |
If I May
"Chris Halsall"
Sep 2002
Barbados
2·3·1,567 Posts |
![]() Quote:
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. |
|
![]() |
![]() |
![]() |
#26 |
Mar 2019
8F16 Posts |
![]()
Is the OP trying to reinvent a hard-to-read, inefficient version of Fermat's little theorem?
|
![]() |
![]() |
![]() |
#27 | ||
Feb 2017
Nowhere
24×32×29 Posts |
![]()
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:
Quote:
|
||
![]() |
![]() |
![]() |
#28 |
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! ![]() ![]() |
![]() |
![]() |
![]() |
#29 |
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 |
![]() |
![]() |
![]() |
#30 |
Mar 2019
11·13 Posts |
![]()
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. |
![]() |
![]() |
![]() |
#31 |
6809 > 6502
"""""""""""""""""""
Aug 2003
101×103 Posts
5×7×263 Posts |
![]() ![]() ![]() Exactly. |
![]() |
![]() |
![]() |
#32 | |
Dec 2017
3608 Posts |
![]() Quote:
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 |
|
![]() |
![]() |
![]() |
#33 | |
Mar 2019
11×13 Posts |
![]() Quote:
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 | |
![]() |
||||
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 |