![]() |
![]() |
#34 |
Dec 2017
24×3×5 Posts |
![]()
Uncwilly can u fix my youtube to make it show plz thanks
|
![]() |
![]() |
![]() |
#35 |
6809 > 6502
"""""""""""""""""""
Aug 2003
101×103 Posts
22×3×13×59 Posts |
![]()
My VBA code running in Excel beat the speed of this code by a large margin. If I can find it (not before Tuesday evening UTC), I will benchmark it and post the results. Let's see how much faster it is checking numbers. I bet my code could factor numbers as fast as this could can determine it a number was prime.
|
![]() |
![]() |
![]() |
#36 | |
Dec 2017
111100002 Posts |
![]() Quote:
![]() |
|
![]() |
![]() |
![]() |
#37 |
Dec 2017
24·3·5 Posts |
![]()
Uncwilly brought up timing so I had to fix where I placed the start timer that's important for code.
Code:
import 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: start_time = time.time() 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)) |
![]() |
![]() |
![]() |
#38 |
Dec 2017
3608 Posts |
![]()
Also I want to be up front
Some pseudo primes will get past the rules I just am not creative enough right now to rule them out!!!!!!!!!!!!! |
![]() |
![]() |
![]() |
#39 |
Undefined
"The unspeakable one"
Jun 2006
My evil lair
32·23·29 Posts |
![]()
Here is something for free to help you "make it faster".
There is a three operand form of pow in Python. It is much faster than ** for large p with a small modulus. Now have at it, and beat Uncwilly. ![]() And of course, all of this is completely useless. There are programs out there that a many orders of magnitude faster than this silly Python code. But whatever. |
![]() |
![]() |
![]() |
#40 | |
Feb 2017
Nowhere
52·167 Posts |
![]() Quote:
What I don't understand is, why you think any of your "rules" might work. Not that I want to, since they don't. Why you might think that devising a small number, or even a finite number, of "creative rules" to exclude composites that "pass" a simple base-2 Fermat test, based on arithmetic properties of the integer part of their base-2 logs, might actually exclude them all, is another question whose answer I don't really need. What you need to do before offering any code with such "rules" is to work out a mathematical justification for why they "should" work. Numerology is not a reason. There is no computationally cheap way known to determine primality. There are many cheap compositeness tests that identify most -- but not all -- composite numbers as being composite. I also don't understand why you encode expressions in what appears to be a deliberately inefficient manner. I really don't want to know that answer, either. IMO you do have a real talent for this, though. Although I could produce composite numbers that flout rules you give that "guarantee" primality, I am much more concerned with the following: Code:
print('1)If below multiplication number is an odd composite then number is composite') Last fiddled with by Dr Sardonicus on 2020-11-16 at 03:37 Reason: Forgot a clause |
|
![]() |
![]() |
![]() |
#41 | |
Dec 2017
24×3×5 Posts |
![]() Quote:
Code:
import time print('''First prime Verify ever, if a One its prime! Also here is the catch 2047 is a One 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 One. 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. © Tom O'Neil''') while True: start_time = time.time() p = int(input("Enter a Prime Number: ")) if p % 2 !=0: j = (pow(2, (p-1), 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 1 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(j,'<--< A ONE 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)) |
|
![]() |
![]() |
![]() |
#42 | |
Dec 2017
24×3×5 Posts |
![]() Quote:
What I understand about primes is when the digits grow the prime gaps grow. I'm trying to find a simple way when now a Composite registers through my code if there is a secret short cut for us to use that's easy for us to determine Mersenne Primes this is my soul mission here and I know its tedious, because I make mistakes................... .......but the easy answer might be staring us all in the face and I think that's why we are all here ![]() Last fiddled with by ONeil on 2020-11-16 at 03:51 |
|
![]() |
![]() |
![]() |
#43 | |
"Curtis"
Feb 2005
Riverside, CA
31×149 Posts |
![]() Quote:
Ignorance is no excuse for thinking you've discovered something. You're ignorant, but very proud of the wrong things you think you've discovered. You could try learning some math. You could try humility when you post code, as well as all the other times you make foolish claims. You could try pretending you're trying to learn algorithms, rather than make new discoveries. "Look! I did something new!" headlining a simple algorithm that has been known longer than you've been alive is not a way to make friends. It just shows your ignorance of simple mathematics. Trying new things doesn't make you wrong, but claiming they're things other people haven't tried makes you a troll. |
|
![]() |
![]() |
![]() |
#44 | ||
Feb 2017
Nowhere
10000010011112 Posts |
![]() Quote:
If you are composing your posts in a "Reply to Thread" window and then hitting "Submit Reply," I suggest you instead compose replies in a text editor offline. After you've polished a reply, open a reply window and copy-paste it in. That's what I do. It saves me a lot of editing of posts I've already submitted. But I'm such a terrible typist, I often wind up having to correct some typos I missed before posting. I am giving you a homework assignment. Please address the following point from my last post to this thread: Quote:
|
||
![]() |
![]() |
![]() |
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 |