mersenneforum.org  

Go Back   mersenneforum.org > Prime Search Projects > Riesel Prime Search

Reply
 
Thread Tools
Old 2007-12-01, 03:14   #1
gd_barnes
 
gd_barnes's Avatar
 
May 2007
Kansas; USA

101001000000012 Posts
Default Odds of prime / expected # of primes

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
Attached Files
File Type: zip odds of prime.zip (3.0 KB, 244 views)
gd_barnes is offline   Reply With Quote
Old 2007-12-01, 09:45   #2
em99010pepe
 
em99010pepe's Avatar
 
Sep 2004

2·5·283 Posts
Default

That's a very useful tool. Thanks!
em99010pepe is offline   Reply With Quote
Old 2007-12-01, 21:33   #3
jasong
 
jasong's Avatar
 
"Jason Goatcher"
Mar 2005

3·7·167 Posts
Default

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.
jasong is offline   Reply With Quote
Old 2007-12-01, 21:44   #4
AES
 
Jul 2007
Tennessee

60810 Posts
Default

OpenOffice spreadsheet?
AES is offline   Reply With Quote
Old 2007-12-02, 21:43   #5
gd_barnes
 
gd_barnes's Avatar
 
May 2007
Kansas; USA

3×3,499 Posts
Default

Quote:
Originally Posted by jasong View Post
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.
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.
gd_barnes is offline   Reply With Quote
Old 2007-12-03, 04:23   #6
mdettweiler
A Sunny Moo
 
mdettweiler's Avatar
 
Aug 2007
USA (GMT-5)

3·2,083 Posts
Default

Quote:
Originally Posted by gd_barnes View Post
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.
It seems to work fine for me with OpenOffice on Linux (Ubuntu 7.10).
mdettweiler is offline   Reply With Quote
Old 2010-10-13, 13:47   #7
Mini-Geek
Account Deleted
 
Mini-Geek's Avatar
 
"Tim Sorbera"
Aug 2006
San Antonio, TX USA

102538 Posts
Default

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 ). 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.
Attached Files
File Type: zip calcPrimes.zip (4.9 KB, 244 views)
Mini-Geek is offline   Reply With Quote
Old 2010-10-13, 17:04   #8
henryzz
Just call me Henry
 
henryzz's Avatar
 
"David"
Sep 2007
Cambridge (GMT/BST)

23×257 Posts
Default

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

Last fiddled with by henryzz on 2010-10-13 at 17:48
henryzz is offline   Reply With Quote
Old 2010-10-13, 20:33   #9
Mini-Geek
Account Deleted
 
Mini-Geek's Avatar
 
"Tim Sorbera"
Aug 2006
San Antonio, TX USA

426710 Posts
Default

Quote:
Originally Posted by henryzz View Post
Nice program. Could you make it ignore header lines(or read the stuff from them)?
Done, attached, along with cleaner and slightly-commented code. 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.
Attached Files
File Type: zip calcPrimes.zip (5.0 KB, 173 views)
Mini-Geek is offline   Reply With Quote
Old 2010-10-14, 06:36   #10
henryzz
Just call me Henry
 
henryzz's Avatar
 
"David"
Sep 2007
Cambridge (GMT/BST)

23·257 Posts
Default

Quote:
Originally Posted by Mini-Geek View Post
Done, attached, along with cleaner and slightly-commented code. 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.
Brilliant that's a lot less fiddling.
henryzz is offline   Reply With Quote
Old 2010-10-14, 11:27   #11
Thomas11
 
Thomas11's Avatar
 
Feb 2003

77416 Posts
Default

That's a really useful tool!
Thank you, Mini-Geek!
Thomas11 is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Status page with expected number of Mersenne primes in each interval? CRGreathouse PrimeNet 2 2018-01-10 06:13
The expected number of primes Batalov Computer Science & Computational Number Theory 5 2016-08-11 01:17
Expected number of primes in OEIS A007908 ewmayer Probability & Probabilistic Number Theory 6 2015-11-10 16:33
I get 13% less primes than I expected:-( mart_r Math 2 2010-10-29 17:31
Twin primes expected first k formula robert44444uk Math 18 2008-04-02 21:19

All times are UTC. The time now is 21:27.


Mon Sep 27 21:27:59 UTC 2021 up 66 days, 15:56, 3 users, load averages: 2.54, 2.55, 2.33

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.