![]() |
![]() |
#1 |
Mar 2021
22 Posts |
![]()
This C++ program https://pastebin.com/y2u9AYRW takes over 7 mins (before I terminated) to run the mpz_probab_prime_p function.
This python implementation(using pypy) can do this in 20 seconds for i in tqdm(a): if all(i % j for j in range(2, ((2**i)-1))): print(i) Is there something that I am missing? Also these are very large numbers ~(10^10000000) Last fiddled with by prime on 2021-03-08 at 15:42 Reason: added info |
![]() |
![]() |
![]() |
#2 | |
Sep 2002
Database er0rr
5·29·31 Posts |
![]() Quote:
Last fiddled with by paulunderwood on 2021-03-08 at 16:13 |
|
![]() |
![]() |
![]() |
#3 |
Mar 2021
22 Posts |
![]()
I have a few questions. Why does the python implementation seem to work at a reasonable(I think) speed? Also does GWNUM have the same license agreement as Prime95, where if you find a Mersenne prime you share the winnings?(this is not of much concern to me, just wondering) Also do gpus excel at these types of tasks?
Last fiddled with by prime on 2021-03-08 at 16:35 Reason: spelling |
![]() |
![]() |
![]() |
#4 |
Sep 2002
Database er0rr
118F16 Posts |
![]()
I don't know Python. I can't make heads nor tails of it. Someone else will chip in.
Yes GWNUM does have that license agreement about world record primes. If you don't want to get your hands dirty then OpenPFGW may be an option for you. It makes life easy, compared to writing your own GWNUM code GPUs running gpuOwl for Mersenne is very fast, particularly on AMD Radeon V II. For example that card takes a day to crunch a current wavefront test (107M bits long) whereas Prime95 on a fast CPU would take a week or two. Last fiddled with by paulunderwood on 2021-03-08 at 17:04 |
![]() |
![]() |
![]() |
#5 | |
"Ben"
Feb 2007
3,733 Posts |
![]() Quote:
Last fiddled with by bsquared on 2021-03-08 at 17:19 |
|
![]() |
![]() |
![]() |
#6 |
Mar 2021
22 Posts |
![]()
I think you are correct about the python implementation. Sorry for the silly question
|
![]() |
![]() |
![]() |
#7 |
"Ben"
Feb 2007
3,733 Posts |
![]()
No worries. The GMP function mpz_probab_prime_p performs the Baillie–PSW primality test followed by some Miller-Rabin tests. There are probably python implementations of those things around the web, if you would like to compare the speed of mpz_probab_prime_p with something equivalent in python. I would not recommend jumping to 10^10000000 right away! Start with smaller numbers and work your way up to understand how things scale.
|
![]() |
![]() |
![]() |
#8 |
Sep 2002
Database er0rr
10001100011112 Posts |
![]()
For Python: https://pypi.org/project/labmath/ for example has various tests including bpsw and fermat_prp.
Once you have tried out 10k digit numbers be amazed by the speed of OpenPFGW (which like LLR and Prime95 is based in GWNUM). Last fiddled with by paulunderwood on 2021-03-08 at 17:55 |
![]() |
![]() |
![]() |
#9 | |
Mar 2021
410 Posts |
![]() Quote:
Last fiddled with by prime on 2021-03-08 at 17:57 |
|
![]() |
![]() |
![]() |
#10 |
Sep 2002
Database er0rr
10001100011112 Posts |
![]()
A week or two for Mersenne. Other forms take longer because they are not so simple in form and there is a special "transform" for Mersenne numbers,
|
![]() |
![]() |
![]() |
#11 | |
"Viliam Furík"
Jul 2018
Martin, Slovakia
13×61 Posts |
![]() Quote:
If you would use some similar CPU, with more cores, the time needed would obviously get even shorter. |
|
![]() |
![]() |
![]() |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
32-80 core performance | aurashift | Hardware | 91 | 2015-04-24 05:23 |
64-bit performance of v25.6 | James Heinrich | PrimeNet | 11 | 2008-04-24 01:42 |
64 bit performance? | zacariaz | Hardware | 1 | 2007-05-10 13:08 |
LLR performance on k and n | robert44444uk | 15k Search | 1 | 2006-02-09 01:43 |
Performance | battlemaxx | Prime Sierpinski Project | 4 | 2005-06-29 20:32 |