mersenneforum.org  

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

Reply
 
Thread Tools
Old 2020-11-15, 18:55   #12
Dr Sardonicus
 
Dr Sardonicus's Avatar
 
Feb 2017
Nowhere

104316 Posts
Default

Quote:
Originally Posted by ONeil View Post
Quote:
Originally Posted by Dr Sardonicus View Post
What does this code do with the input value 1105?
My system will prove its a composite number.
Show me. Use 1105 as input. Copy the output and post it.

EDIT: Looks like the OP isn't forthcoming. Anyone?

FOLLOWUP EDIT: He has done what I asked.

I apologize to ONeil for my intemperate previous edit.

Last fiddled with by Dr Sardonicus on 2020-11-15 at 19:40 Reason: As indicated
Dr Sardonicus is offline   Reply With Quote
Old 2020-11-15, 19:04   #13
ONeil
 
Dec 2017

24×3×5 Posts
Angry

Warning some of these numbers which are Poulet and Carmichal can slip through. My method can catch some of them, but some get by so beware of these numbers.


Code:
Poulet 1 to 15
341	11 · 31
561	3 · 11 · 17
645	3 · 5 · 43
1105	5 · 13 · 17
1387	19 · 73
1729	7 · 13 · 19
1905	3 · 5 · 127
2047	23 · 89
2465	5 · 17 · 29
2701	37 · 73
2821	7 · 13 · 31
3277	29 · 113
4033	37 · 109
4369	17 · 257
4371	3 · 31 · 47
Poulet 16 to 30
4681	31 · 151
5461	43 · 127
6601	7 · 23 · 41
7957	73 · 109
8321	53 · 157
8481	3 · 11 · 257
8911	7 · 19 · 67
10261	31 · 331
10585	5 · 29 · 73
11305	5 · 7 · 17 · 19
12801	3 · 17 · 251
13741	7 · 13 · 151
13747	59 · 233
13981	11 · 31 · 41
14491	43 · 337
Poulet 31 to 45
15709	23 · 683
15841	7 · 31 · 73
16705	5 · 13 · 257
18705	3 · 5 · 29 · 43
18721	97 · 193
19951	71 · 281
23001	3 · 11 · 17 · 41
23377	97 · 241
25761	3 · 31 · 277
29341	13 · 37 · 61
30121	7 · 13 · 331
30889	17 · 23 · 79
31417	89 · 353
31609	73 · 433
31621	103 · 307
Poulet 46 to 60
33153	3 · 43 · 257
34945	5 · 29 · 241
35333	89 · 397
39865	5 · 7 · 17 · 67
41041	7 · 11 · 13 · 41
41665	5 · 13 · 641
42799	127 · 337
46657	13 · 37 · 97
49141	157 · 313
49981	151 · 331
52633	7 · 73 · 103
55245	3 · 5 · 29 · 127
57421	7 · 13 · 631
60701	101 · 601
60787	89 · 683
https://en.wikipedia.org/wiki/Fermat_pseudoprime
ONeil is offline   Reply With Quote
Old 2020-11-15, 19:15   #14
ONeil
 
Dec 2017

24·3·5 Posts
Quote:
Originally Posted by Dr Sardonicus View Post
Show me. Use 1105 as input. Copy the output and post it.

EDIT: Looks like the OP isn't forthcoming. Anyone?
I did a calculation for you and it works on some of the Poulet and Carmichal numbers. See attachment
Attached Thumbnails
Click image for larger version

Name:	1105 to be Composite.JPG
Views:	38
Size:	170.8 KB
ID:	23790  
ONeil is offline   Reply With Quote
Old 2020-11-15, 19:28   #15
Uncwilly
6809 > 6502
 
Uncwilly's Avatar
 
"""""""""""""""""""
Aug 2003
101×103 Posts

29·317 Posts
Default

Program output for prime testing should say:
Prime
or
Composite
It should not require the user to look at output and do any figuring.
Uncwilly is offline   Reply With Quote
Old 2020-11-15, 19:39   #16
ONeil
 
Dec 2017

3608 Posts
Default

Quote:
Originally Posted by Uncwilly View Post
Program output for prime testing should say:
Prime
or
Composite
It should not require the user to look at output and do any figuring.
Hi Uncwilly good to see you Happy Holidays.

Anyway I'm working on a way a little easy trick to find the composite Poulet and Carmichal numbers to be composite as well bear with me ok!

Some of them my method works but I'm working on another method for all of them!

Last fiddled with by ONeil on 2020-11-15 at 19:41
ONeil is offline   Reply With Quote
Old 2020-11-15, 19:50   #17
Dr Sardonicus
 
Dr Sardonicus's Avatar
 
Feb 2017
Nowhere

104316 Posts
Default

Quote:
Originally Posted by ONeil View Post
I did a calculation for you and it works on some of the Poulet and Carmichal numbers. See attachment
Thank you. Your attachment shows what your code does. I don't know Python so I wasn't sure about some of what it was supposed to be doing.

I note that it did do one of the things I was sure it would do with my input. It calculated a value of 2 for the variable "prime," and subsequently printed that that indicated my number was prime. BTW "prime" may be a reserved word in some packages.

I may have another input for you in a bit.

EDIT: The code you previously posted says
Code:
print('If below multiplication number is Prime then entered number is prime')
but your attachment has the printed statement
Code:
If below multiplication number is Prime then it has to sit next to a prime for input to be prime
which in the first place means you've altered your code after you posted it, and in the second place is nonsense. The only primes that "sit next to" each other are 2 and 3.

I also note that this statement contradicts another statement:
Code:
print('If below multiplication number is odd then number is composite')

Last fiddled with by Dr Sardonicus on 2020-11-15 at 20:20
Dr Sardonicus is offline   Reply With Quote
Old 2020-11-15, 20:31   #18
Batalov
 
Batalov's Avatar
 
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2

47×197 Posts
Lightbulb Matthew 7:6

The only sensible part is the (terribly executed parody of a) Fermat test. Which is one line.
The rest of the code is numerology. In essence OP thinks that some Carmichaels are prime and some are composite (and the criterion is "whether the digital log2 is odd or even" which is of course hogwash).

But more generally - I think everyone can benefit from J.B.Peterson's advice (come for this a propos advice, stay for the whole talk). Or you can go straight to the source which is Matthew 7:6.
Batalov is offline   Reply With Quote
Old 2020-11-15, 21:21   #19
ONeil
 
Dec 2017

24·3·5 Posts
Red face

Some adjustments to the rules for Poulets and Carmichal numbers WoW! So the rules should figure out all numbers when 2 to be composite and when the number is truly prime the rule should not affect it!


here is new code!

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('Multiplication number when added cannot be composite to be 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))

Last fiddled with by ONeil on 2020-11-15 at 21:32
ONeil is offline   Reply With Quote
Old 2020-11-15, 21:32   #20
ONeil
 
Dec 2017

24·3·5 Posts
Thumbs up

check above code again I made one small rule adjustment.
ONeil is offline   Reply With Quote
Old 2020-11-15, 21:33   #21
Dr Sardonicus
 
Dr Sardonicus's Avatar
 
Feb 2017
Nowhere

23·181 Posts
Default

Quote:
Originally Posted by Batalov View Post
The only sensible part is the (terribly executed parody of a) Fermat test. Which is one line.
The rest of the code is numerology. In essence OP thinks that some Carmichaels are prime and some are composite (and the criterion is "whether the digital log2 is odd or even" which is of course hogwash).
It's even funnier than that IMO. The "below multiplication number" in
Code:
print('If below multiplication number is odd then number is composite')
is, if I interpret correctly what his posted code does, 2k+1 for

24k< n < 24k+1,

which means that, according to his program, every prime in that interval is composite. OTOH there's another statement that says if 2k+1 is prime, the number is prime.

But every prime p, 2^16 < p < 2^17, is composite according to the statement printed by the above statement, and 2k+1 = 9 is composite so the other statement does not apply.

I note that I am casting my pearls not just before the OP, but also before the other denizens of the forum. Besides, in trying to analyze the OP's code I actually have learned a certain amount, however small, about Python.
Dr Sardonicus is offline   Reply With Quote
Old 2020-11-15, 21:40   #22
bhelmes
 
bhelmes's Avatar
 
Mar 2016

23×37 Posts
Default

Code:
m = (2**p-1) 
prime = ((m + m)%p)
how about fast exponention modulo p, described in
http://rosettacode.org/wiki/Modular_exponentiation
bhelmes 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 09:47.

Tue Jan 19 09:47:58 UTC 2021 up 47 days, 5:59, 0 users, load averages: 1.82, 1.79, 2.00

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.