mersenneforum.org Odds of prime / expected # of primes
 Register FAQ Search Today's Posts Mark Forums Read

 2010-10-14, 17:50 #12 mdettweiler A Sunny Moo     Aug 2007 USA (GMT-5) 3×2,083 Posts Great, and exceedingly handy! A couple requests: -Could the program be made to ignore ABC comments when a sieve depth is given on the command line? I have a lot of sieve files with headers like this: ABC $a*28^$b-1 //7500000000000:M:1:28:258 modified as such to permit loading into PRPnet, while preserving the sieve depth data. As is, passing the sieve depth on the command line is not enough to get calcPrimes to work with this kind of file; it still chokes on the unrecognized format. Sure, I can get it to work by modifying the comment to "Sieved to x with srsieve", but it would be much easier if it would simply ignore anything after the // when I give it a sieve depth on the command line. -One of the most personally useful figures from Gary's odds of prime spreadsheet is the "1 in x candidates" figure for a prime. Yours produces "1 in x" for the odds of prime in the entire file, which while still useful, is not quite the same thing. I'm assuming this would be an easy modification, but if it isn't, don't worry about it. Thanks, Max
2010-10-14, 19:24   #13
Mini-Geek
Account Deleted

"Tim Sorbera"
Aug 2006
San Antonio, TX USA

10000101011002 Posts

Quote:
 Originally Posted by mdettweiler Great, and exceedingly handy!
Glad to hear some other people find this cool and useful.
Quote:
 Originally Posted by mdettweiler -Could the program be made to ignore ABC comments when a sieve depth is given on the command line? I have a lot of sieve files with headers like this: ABC $a*28^$b-1 //7500000000000:M:1:28:258 modified as such to permit loading into PRPnet, while preserving the sieve depth data. As is, passing the sieve depth on the command line is not enough to get calcPrimes to work with this kind of file; it still chokes on the unrecognized format. Sure, I can get it to work by modifying the comment to "Sieved to x with srsieve", but it would be much easier if it would simply ignore anything after the // when I give it a sieve depth on the command line.
Hm, that's an unusual header. I never tested with that or figured anyone would have that (come to think of it, I may have seen it before, it just didn't come to mind). I moved some things to make the code sturdier (i.e. choke on fewer instances) for unusual things like that, made it skip the attempted parsing of the sieve depths when you specify it (previously, it always parsed, and then overwrote it with the supplied info), and then figured I could put in support for your format there. It can now read the sieve depth from a header like that (more specifically, anything like "ABC $a*28^$b-1 //7500000000000", and then there can be a colon and more info after the sieve depth)

It should now work and find the sieve depths on all of the following:
ABC $a*28^$b-1 //7500000000000
ABC $a*28^$b-1 //7500000000000:M:1:28:258
ABC $a*28^$b-1 // some words 7500000000000
ABC $a*28^$b-1 // sieved to 7500000000000 with srsieve
7500000000000:M:1:28:258
7500000000000:M:1:28:258 // ABC $a*28^$b-1
ABC $a*28^$b-1 // sieved to 7500000000000 with srsieve // {number_primes,$a,1} and probably fail (error if you don't specify the sieve depth manually) on these: ABC$a*28^$b-1 // 7500000000000 ABC$a*28^$b-1 // hi, this was sieved to 7500000000000 ABC$a*28^$b-1 // {number_primes,$a,1} // sieved to 7500000000000 with srsieve
Quote:
 Originally Posted by mdettweiler -One of the most personally useful figures from Gary's odds of prime spreadsheet is the "1 in x candidates" figure for a prime. Yours produces "1 in x" for the odds of prime in the entire file, which while still useful, is not quite the same thing. I'm assuming this would be an easy modification, but if it isn't, don't worry about it.
Added. It was pretty easy: just had to see how many candidates there were and divide accordingly at the end. Note that this is an average over the whole range, so the only point it's right on for is the average case (effectively the same as the spreadsheet taking the one number at what you guess is the average point).
Edit: guess it might help to actually attach the program.
Edit 2: I've just made a small update to it so ABC $a*28^$b-1 //7500000000000 will work, and uploaded a new version.
Edit 3: Oops, I left some debug code in. (hardwired file name and no help: not the best code for a release version ) New version again.
Attached Files
 calcPrimes.zip (5.6 KB, 134 views)

Last fiddled with by Mini-Geek on 2010-10-14 at 19:41

 2010-10-14, 19:48 #14 mdettweiler A Sunny Moo     Aug 2007 USA (GMT-5) 3×2,083 Posts Thanks--it works great!
2010-10-14, 19:53   #15
Mini-Geek
Account Deleted

"Tim Sorbera"
Aug 2006
San Antonio, TX USA

22×11×97 Posts

I updated the help text a bit. Since there were so many revisions posted on the last post, and I think I'm done editing it until something else comes up, I'm putting it in a new post here.
Attached Files
 calcPrimes.zip (5.6 KB, 144 views)

2010-10-14, 22:00   #16
Mini-Geek
Account Deleted

"Tim Sorbera"
Aug 2006
San Antonio, TX USA

22×11×97 Posts

To make it easier to use, I made it work either off of entering the info on the command line (like before), or being prompted to enter it after you run the program. I also made a batch file that runs "java -jar calcPrimes.jar" and passes arguments along to it (so it's not such a long line you have to type, and you can double click on the batch file instead of needing to open a command line). A similar bash script could be made just as easily (a very simple addition that makes it a lot easier to use - at least, my JVM doesn't run .jar's like that when I double click them). I also made lots of small updates to the messages it outputs, especially errors (so that it's a bit more helpful). Oh, and now "ABC $a*588^$b\$c // 1500000000000" should work too.
Attached Files
 calcPrimes.zip (6.9 KB, 186 views)

Last fiddled with by Mini-Geek on 2010-10-14 at 22:04

 Similar Threads Thread Thread Starter Forum Replies Last Post CRGreathouse PrimeNet 2 2018-01-10 06:13 Batalov Computer Science & Computational Number Theory 5 2016-08-11 01:17 ewmayer Probability & Probabilistic Number Theory 6 2015-11-10 16:33 mart_r Math 2 2010-10-29 17:31 robert44444uk Math 18 2008-04-02 21:19

All times are UTC. The time now is 07:25.

Sun Oct 17 07:25:29 UTC 2021 up 86 days, 1:54, 0 users, load averages: 0.86, 1.18, 1.28