![]() |
![]() |
#1 | |
Dec 2017
F016 Posts |
![]() Quote:
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 |
|
![]() |
![]() |
![]() |
#2 |
Undefined
"The unspeakable one"
Jun 2006
My evil lair
2·34·37 Posts |
![]() |
![]() |
![]() |
![]() |
#3 | |
Dec 2017
24·3·5 Posts |
![]() Quote:
![]() Well my formula is not exactly like Fermat's right retina? Last fiddled with by ONeil on 2020-11-15 at 06:32 |
|
![]() |
![]() |
![]() |
#4 |
"Curtis"
Feb 2005
Riverside, CA
460410 Posts |
![]() |
![]() |
![]() |
![]() |
#5 |
Dec 2017
3608 Posts |
![]() |
![]() |
![]() |
![]() |
#6 |
Feb 2017
Nowhere
2·33·7·11 Posts |
![]()
What does this code do with the input value 1105?
|
![]() |
![]() |
![]() |
#7 |
Undefined
"The unspeakable one"
Jun 2006
My evil lair
599410 Posts |
![]() |
![]() |
![]() |
![]() |
#8 | |
Sep 2002
Database er0rr
3,527 Posts |
![]() Quote:
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 |
|
![]() |
![]() |
![]() |
#9 | |
Feb 2017
Nowhere
103E16 Posts |
![]() Quote:
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') 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? |
|
![]() |
![]() |
![]() |
#10 |
Dec 2017
111100002 Posts |
![]()
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. |
![]() |
![]() |
![]() |
#11 |
"Curtis"
Feb 2005
Riverside, CA
22·1,151 Posts |
![]()
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?
|
![]() |
![]() |
![]() |
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 |