mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Riesel Prime Search (https://www.mersenneforum.org/forumdisplay.php?f=59)
-   -   Odds of prime / expected # of primes (https://www.mersenneforum.org/showthread.php?t=9675)

gd_barnes 2007-12-01 03:14

Odds of prime / expected # of primes
 
1 Attachment(s)
To all,

This might be useful for some of you...

I created the attached spreadsheet shortly after I found RPS and have been using it to determine the odds that a prime will be found within a sieved file. It also tells you about how many primes that you can expect for a sieved file and calculates the odds of finding a twin, triplet, or quadruplet. I used it to determine how large of a range to sieve for the twin and quads that I found.

You just plug in the k, base, avg. n, sieve depth, and # of candidates and it does the rest.

The base crux of the formulas came from Axn1 in a thread here at RPS. I just took it a little further to account for changes in k and base and to add the twin/triplet/quad odds calculations. (The k makes very little difference except at very low values of n.)


Gary

em99010pepe 2007-12-01 09:45

That's a very useful tool. Thanks!

jasong 2007-12-01 21:33

If I may ask a stupid question, what is the best way to run this? I've tried various things in Linux and none of them worked. Googling was an exercise in frustration, there's lot's of php stuff but I'm not totally sure what I'm looking for.

AES 2007-12-01 21:44

[SIZE=-1] OpenOffice [/SIZE][SIZE=-1]spreadsheet?
[/SIZE]

gd_barnes 2007-12-02 21:43

[quote=jasong;119699]If I may ask a stupid question, what is the best way to run this? I've tried various things in Linux and none of them worked. Googling was an exercise in frustration, there's lot's of php stuff but I'm not totally sure what I'm looking for.[/quote]

It's a Microsoft Excel spreadsheet. If you have Excel, just open the zip file and double-click the spreadsheet and it should open. If you don't have Excel, you would need to get it.

mdettweiler 2007-12-03 04:23

[quote=gd_barnes;119760]It's a Microsoft Excel spreadsheet. If you have Excel, just open the zip file and double-click the spreadsheet and it should open. If you don't have Excel, you would need to get it.[/quote]
It seems to work fine for me with OpenOffice on Linux (Ubuntu 7.10).

Mini-Geek 2010-10-13 13:47

1 Attachment(s)
The odds of prime spreadsheet is very useful, but when the n (or, to a lesser extent, the k) varies greatly, (as is common in CRUS work, or over large areas of any work) it is hard to choose the right average n to get accurate results.
I've made a simple command line Java app that has the same function as the odds of prime spreadsheet, but instead of making you pick the average k and n, it reads each k/n pair and works off of that. It reports relevant numbers for primes and twin primes (not triplet or quadruplet).
It is attached as a .jar, along with the source (it's not commented, and it includes some other code unused here, but I figured better messy source than no source :smile:). Run it without any arguments (or with -h or whatever) to get help on how to use it ("java -jar calcPrimes.jar" will do it).
Note that it is pretty picky with the sieve depth and sieve file. The sieve depth parser is extremely simple: first replace "G" with 9 zeroes and "T" with 12 zeroes, then use Java's Long.parseLong (e.g. 1.5*10^12, 1.5T, and 15M are all invalid, while 1T, 1500G, and 15000000 are valid). And the sieve file must be in NewPGen format ("k n" on each line) with no header of any sort, just the k and n.
This has had very little testing, but I've checked it against the spreadsheet on one file, and the results seems to be accurate.

henryzz 2010-10-13 17:04

Nice program. Could you make it ignore header lines(or read the stuff from them)?

Mini-Geek 2010-10-13 20:33

1 Attachment(s)
[QUOTE=henryzz;233321]Nice program. Could you make it ignore header lines(or read the stuff from them)?[/QUOTE]

Done, attached, along with cleaner and slightly-commented code. :smile: Run it without any arguments to see how it works now. In short, "java -jar calcPrimes.jar filePath [sieveDepth]" where filePath is a NewPGen-like file with a header with the necessary info, and the sieve depth can optionally be manually set by sieveDepth.

henryzz 2010-10-14 06:36

[QUOTE=Mini-Geek;233344]Done, attached, along with cleaner and slightly-commented code. :smile: Run it without any arguments to see how it works now. In short, "java -jar calcPrimes.jar filePath [sieveDepth]" where filePath is a NewPGen-like file with a header with the necessary info, and the sieve depth can optionally be manually set by sieveDepth.[/QUOTE]
Brilliant that's a lot less fiddling.

Thomas11 2010-10-14 11:27

That's a really useful tool!
Thank you, Mini-Geek! :bow:


All times are UTC. The time now is 08:22.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.