20201116, 02:35  #34 
Dec 2017
240_{10} Posts 
Uncwilly can u fix my youtube to make it show plz thanks

20201116, 02:36  #35 
6809 > 6502
"""""""""""""""""""
Aug 2003
101×103 Posts
5×19×97 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.

20201116, 02:41  #36  
Dec 2017
2^{4}×3×5 Posts 
Quote:


20201116, 02:55  #37 
Dec 2017
360_{8} 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^111, because this formula uses ((2^p1)+(2^p1))%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**p1) 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)) 
20201116, 02:56  #38 
Dec 2017
2^{4}·3·5 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!!!!!!!!!!!!! 
20201116, 03:04  #39 
Undefined
"The unspeakable one"
Jun 2006
My evil lair
2^{2}×3^{2}×167 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. 
20201116, 03:34  #40  
Feb 2017
Nowhere
7·599 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 base2 Fermat test, based on arithmetic properties of the integer part of their base2 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 20201116 at 03:37 Reason: Forgot a clause 

20201116, 03:44  #41  
Dec 2017
11110000_{2} 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^111, because this formula uses ((2^p1)+(2^p1))%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, (p1), 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)) 

20201116, 03:50  #42  
Dec 2017
2^{4}·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 20201116 at 03:51 

20201116, 06:11  #43  
"Curtis"
Feb 2005
Riverside, CA
2^{2}·13·89 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. 

20201116, 14:22  #44  
Feb 2017
Nowhere
7·599 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 copypaste 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  
Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Prime numbers code broken  marsik84  Miscellaneous Math  6  20200430 20:27 
Prime Gap Search latest version of the c code  pinhodecarlos  Prime Gap Searches  170  20191210 19:33 
picking a prime to VERIFY below M(57,885,161)  ssybesma  Information & Answers  9  20181213 13:42 
Verify the existence of a large enough prime number?  Godzilla  Miscellaneous Math  25  20180928 17:10 
Code for testing a prime other than form 2^n1  MercPrime  Information & Answers  5  20130512 22:03 