mersenneforum.org "My Prime Verify Code"
 User Name Remember Me? Password
 Register FAQ Search Today's Posts Mark Forums Read

 2020-11-16, 02:35 #34 ONeil   Dec 2017 111100002 Posts Uncwilly can u fix my youtube to make it show plz thanks
2020-11-16, 02:36   #35
Uncwilly
6809 > 6502

"""""""""""""""""""
Aug 2003
101×103 Posts

217448 Posts

Quote:
 Originally Posted by mathwiz 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.
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.

2020-11-16, 02:41   #36
ONeil

Dec 2017

24·3·5 Posts

Quote:
 Originally Posted by Uncwilly 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.
Thats fast I'd like to see Uncwilly

 2020-11-16, 02:55 #37 ONeil   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))
 2020-11-16, 02:56 #38 ONeil   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!!!!!!!!!!!!!
 2020-11-16, 03:04 #39 retina Undefined     "The unspeakable one" Jun 2006 My evil lair 2·34·37 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.
2020-11-16, 03:34   #40
Dr Sardonicus

Feb 2017
Nowhere

23×181 Posts

Quote:
 Originally Posted by ONeil 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!!!!!!!!!!!!!
Well, that's refreshing!

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')
According to this rule, every one of the 5709 primes between 2^16 and 2^17 is composite, because for each and every one of them the "below multiplication number" is 9, an odd composite number.

Last fiddled with by Dr Sardonicus on 2020-11-16 at 03:37 Reason: Forgot a clause

2020-11-16, 03:44   #41
ONeil

Dec 2017

24×3×5 Posts

Quote:
 Originally Posted by retina 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.
Thanks to retina the code can now fit larger numbers and I adjusted it to be like Fermat's test and I'm still trying to work out some annoying pseudo primes but they are less. Here is the fast code which enables larger numbers.

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))

2020-11-16, 03:50   #42
ONeil

Dec 2017

24×3×5 Posts

Quote:
 Originally Posted by Dr Sardonicus Well, that's refreshing! 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') According to this rule, every one of the 5709 primes between 2^16 and 2^17 is composite, because for each and every one of them the "below multiplication number" is 9, an odd composite number.
Dear Dr Sardonicus,

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

2020-11-16, 06:11   #43
VBCurtis

"Curtis"
Feb 2005
Riverside, CA

17×271 Posts

Quote:
 Originally Posted by ONeil What I understand about primes is when the digits grow the prime gaps grow.
But your previous program found twin primes. If the gaps always grow when the digits grow, how are there twin primes?

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.

2020-11-16, 14:22   #44
Dr Sardonicus

Feb 2017
Nowhere

23×181 Posts

Quote:
 Originally Posted by ONeil 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
Uh,... to me, this doesn't look like just a run-on sentence, but more like a wild blue streak of gibberish, or "word salad." It's far too incoherent for me to address.

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:
 Code: print('1)If below multiplication number is an odd composite then number is composite') According to this rule, every one of the 5709 primes between 2^16 and 2^17 is composite, because for each and every one of them the "below multiplication number" is 9, an odd composite number.
Please post your completed assignment to this thread before you post anything else. Please confine your response post to this single topic.

 Thread Tools

 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 08:18.

Mon Jan 18 08:18:25 UTC 2021 up 46 days, 4:29, 0 users, load averages: 1.44, 1.79, 1.93

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.