![]() |
|
|
#56 | |
|
"NOT A TROLL"
Mar 2016
California
C516 Posts |
Quote:
|
|
|
|
|
|
|
#57 |
|
"Mike"
Aug 2002
100000001000002 Posts |
FWIW
Our wrapper script: until [ -e pfgw.log ]; do nice -19 ./program4.py > tmp && ../pfgw64 -f -k tmp; done; rm tmp && rm pfgw.ini program4.py is our (very lame) sieve program More craziness here: http://www.mersenneforum.org/showthread.php?t=21252 So far 50,000 digit PRPs have been (fairly easily?) found using our very slow NUC. We are slowly improving our sieve program before going larger. YMMV
|
|
|
|
|
|
#58 | |
|
"NOT A TROLL"
Mar 2016
California
197 Posts |
Quote:
|
|
|
|
|
|
|
#59 |
|
"Mike"
Aug 2002
100000001000002 Posts |
We forgot to mention this:
Our sieve program is most likely slower than just feeding pfgw the unsieved candidates, but we want to convince ourselves that we have done at least a little of the programming to find stuff. Perhaps it gives us the illusion of control? We are interested in improving our code but most suggestions will be beyond our math understanding. We hope to slowly remedy this. The following code is lame, but for us it represents a lot of hard work and learning: Code:
#!/usr/bin/python
from random import randint
from random import randrange
mp = 46
length = 50000
sievesize = 1000000
def quicktest(n):
for p in smallprimes:
if n % p == 0:
return False
return True
def sieve(n):
multiples = set()
for i in range(2, n + 1):
if i not in multiples:
yield i
multiples.update(range(i * i, n + 1, i))
smallprimes = list(sieve(sievesize))
with open(str(mp)) as f:
data = f.read()
flag = False
while flag == False:
start = randint(0, len(data) - length)
result = int(data[start:start + length])
if len(str(result)) == length:
if result % 10 == 1 or result % 10 == 3 or result % 10 == 7 or result % 10 == 9:
if quicktest(result) == True:
print result
flag = True
|
|
|
|
|
|
#60 |
|
"NOT A TROLL"
Mar 2016
California
3058 Posts |
The sieve size I can choose, but I hope I do not pick a large range with no primes, that's the worst, though composites are limited by maximum prime gaps.
Here is a sieve example: ABC2 233100857649...(200k+digits)...210016697705+$a a: from 1 to 1000000 "step 2" then auto-stop prp testing when one prime (prp) is found. (As I am confused at "step 2" though I think I am just locating another .txt file with my remaining candidates.) Last fiddled with by PawnProver44 on 2016-05-17 at 16:55 |
|
|
|
|
|
#61 |
|
"Dana Jacobsen"
Feb 2011
Bangkok, TH
22×227 Posts |
For generating a list of primes in python, RWH's python functions are short and very fast.
One thing I don't see in the docs is how to make PFGW stop once it finds a PRP. Your (Xyzzy) script would seem to make pfgw run on every value. Maybe that's ok -- you just find multiple PRPs. It does avoid the overhead of making the script call it one at a time. For something not too dissimilar to generate a random 50k digit number then sieve 100k to depth 1e8: Code:
perl -Mntheory=:all -E 'use bigint; my $n = join("",1+int(rand(9)),map { int(rand(10)) } 2..50000); say for Math::Prime::Util::GMP::sieve_primes($n,100000+$n,1e8);' >foo
Code:
perl -Mntheory=:all -E 'my $n = join("",1+int(rand(9)),map { int(rand(10)) } 2..50000); say "$n+$_" for sieve_range($n,100000,1e8);' >foo
Sieving to 1e9 on the 50k-digit random input with width 100k takes about 90 seconds. Sieving to 1e9 on 100k-digit random input with width 500k takes about 3 minutes. We would want deeper sieving for these sizes, but this shows the idea and gives an indication of time. It looks like your program generates many random results, while mine is generating one then sieving a range. This should be more efficient than the trial division on each candidate. Looks like PFGW is taking about 90-100 seconds for each 50k-digit candidate (with no trial factoring). For 100k-digits it is taking about 400 seconds. About 4x longer for 2x larger input, which is great vs. the ~6x longer time for GMP BPSW for doubling bits. That doesn't count the lowered expectations of finding a prime at the larger size, meaning more expected tests per PRP found. Last fiddled with by danaj on 2016-05-17 at 18:05 Reason: Note difference in scripts |
|
|
|
|
|
#62 |
|
Jun 2003
31×163 Posts |
|
|
|
|
|
|
#63 | |
|
Romulan Interpreter
Jun 2011
Thailand
7·1,373 Posts |
Quote:
hahaha ![]() BTW, couldn't he use +2*$a and avoid the "step 2" contraption? beside of the fact he said he is confused by it, the increment would be faster ![]() Told ye he is only trolling... |
|
|
|
|
|
|
#64 | |
|
"Mike"
Aug 2002
25×257 Posts |
Quote:
|
|
|
|
|
|
|
#65 |
|
"NOT A TROLL"
Mar 2016
California
197 Posts |
Sucess!!
![]() nextprime(233100857649...(200k+digits)...210016697705) = 233100857649...(200k+digits)...210016702491 ![]() My point: I actually had someone else give me an output example using everything suggested here to give me a sample output of a "random" prp that size. Last fiddled with by PawnProver44 on 2016-05-18 at 04:47 |
|
|
|
|
|
#66 | |
|
"Dana Jacobsen"
Feb 2011
Bangkok, TH
22×227 Posts |
Quote:
|
|
|
|
|
![]() |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Near- and quasi-repunit PRPs | Batalov | And now for something completely different | 10 | 2019-09-12 13:31 |
| OEIS - 2^n-5 - LLT-like algorithm for finding PRPs | T.Rex | Miscellaneous Math | 13 | 2015-09-01 13:09 |
| PRPs not prime | schickel | FactorDB | 1 | 2015-08-03 02:50 |
| Proven PRPs? | Random Poster | FactorDB | 0 | 2012-07-24 10:53 |
| PRPs that are composites | gd_barnes | Conjectures 'R Us | 57 | 2011-09-12 12:31 |