mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Blogorrhea > ONeil

Reply
 
Thread Tools
Old 2020-11-15, 22:02   #23
ONeil
 
Dec 2017

F016 Posts
Lightbulb

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))
ONeil is offline   Reply With Quote
Old 2020-11-15, 22:03   #24
Dr Sardonicus
 
Dr Sardonicus's Avatar
 
Feb 2017
Nowhere

11×379 Posts
Default

Quote:
Originally Posted by ONeil View Post
Some adjustments to the rules

here is new code!
Quote:
Originally Posted by ONeil View Post
check above code again I made one small rule adjustment.
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?
Dr Sardonicus is offline   Reply With Quote
Old 2020-11-15, 22:17   #25
chalsall
If I May
 
chalsall's Avatar
 
"Chris Halsall"
Sep 2002
Barbados

2·3·1,567 Posts
Default

Quote:
Originally Posted by Dr Sardonicus View Post
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.
A sincere question: What game are you playing?

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.
chalsall is online now   Reply With Quote
Old 2020-11-15, 22:49   #26
mathwiz
 
Mar 2019

100011112 Posts
Default

Is the OP trying to reinvent a hard-to-read, inefficient version of Fermat's little theorem?
mathwiz is offline   Reply With Quote
Old 2020-11-15, 23:47   #27
Dr Sardonicus
 
Dr Sardonicus's Avatar
 
Feb 2017
Nowhere

11·379 Posts
Default

Quote:
Originally Posted by chalsall View Post
A sincere question: What game are you playing?
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:
What is the upside in the answer(s) given through this matrix?
"This matrix? Huh? I don't understand the question.

Quote:
I'm probably being rather stupid in not seeing the purpose. But, I don't.

Edification welcomed.
The purpose of what?
Dr Sardonicus is offline   Reply With Quote
Old 2020-11-16, 00:59   #28
ONeil
 
Dec 2017

3608 Posts
Default

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!




ONeil is offline   Reply With Quote
Old 2020-11-16, 01:34   #29
ONeil
 
Dec 2017

24×3×5 Posts
Default

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
ONeil is offline   Reply With Quote
Old 2020-11-16, 01:43   #30
mathwiz
 
Mar 2019

11·13 Posts
Default

Quote:
Originally Posted by ONeil View Post
I don't know why you guys are so hard on me!
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.
mathwiz is offline   Reply With Quote
Old 2020-11-16, 01:50   #31
Uncwilly
6809 > 6502
 
Uncwilly's Avatar
 
"""""""""""""""""""
Aug 2003
101×103 Posts

2·4,597 Posts
Default


Exactly.
Uncwilly is online now   Reply With Quote
Old 2020-11-16, 01:58   #32
ONeil
 
Dec 2017

111100002 Posts
Default

Quote:
Originally Posted by mathwiz View Post
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.
Yo mathwiz,

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
ONeil is offline   Reply With Quote
Old 2020-11-16, 02:03   #33
mathwiz
 
Mar 2019

14310 Posts
Default

Quote:
Originally Posted by ONeil View Post
Yo mathwiz,

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
People on this forum generally aren't interested in posts of the form "this code is great, everyone now go test it".

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.
mathwiz is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
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

All times are UTC. The time now is 19:16.

Tue Jan 19 19:16:38 UTC 2021 up 47 days, 15:27, 0 users, load averages: 2.81, 2.88, 2.75

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.