![]() |
![]() |
#12 | |
Feb 2017
Nowhere
4,177 Posts |
![]() Quote:
EDIT: 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 |
|
![]() |
![]() |
![]() |
#13 |
Dec 2017
24·3·5 Posts |
![]()
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 |
![]() |
![]() |
![]() |
#14 |
Dec 2017
24×3×5 Posts |
I did a calculation for you and it works on some of the Poulet and Carmichal numbers. See attachment
|
![]() |
![]() |
![]() |
#15 |
6809 > 6502
"""""""""""""""""""
Aug 2003
101×103 Posts
920510 Posts |
![]()
Program output for prime testing should say:
Prime or Composite It should not require the user to look at output and do any figuring. |
![]() |
![]() |
![]() |
#16 | |
Dec 2017
24×3×5 Posts |
![]() Quote:
![]() 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 |
|
![]() |
![]() |
![]() |
#17 | |
Feb 2017
Nowhere
4,177 Posts |
![]() Quote:
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') Code:
If below multiplication number is Prime then it has to sit next to a prime for input to be prime 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 |
|
![]() |
![]() |
![]() |
#18 |
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2
2·11·421 Posts |
![]()
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. |
![]() |
![]() |
![]() |
#19 |
Dec 2017
24×3×5 Posts |
![]()
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 |
![]() |
![]() |
![]() |
#20 |
Dec 2017
24·3·5 Posts |
![]()
check above code again I made one small rule adjustment.
|
![]() |
![]() |
![]() |
#21 | |
Feb 2017
Nowhere
10000010100012 Posts |
![]() Quote:
Code:
print('If below multiplication number is odd then number is composite') 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. |
|
![]() |
![]() |
![]() |
#22 |
Mar 2016
23×37 Posts |
![]() Code:
m = (2**p-1) prime = ((m + m)%p) http://rosettacode.org/wiki/Modular_exponentiation |
![]() |
![]() |
![]() |
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 |