mersenneforum.org  

Go Back   mersenneforum.org > Great Internet Mersenne Prime Search > Math

Reply
 
Thread Tools
Old 2004-11-30, 18:26   #12
marc
 
marc's Avatar
 
Jun 2004
UK

139 Posts
Default

Um use elif.

If your bounds are say 1,5,10,20 then you'd write:

if x < 1: blah
elif x < 5: blah2
elif x < 10: blah3
elif x < 20: blah4

And you don't need to declare secs before you use it.

If you just want to see less code you could do something like:

if blah: mul = 0.xxx
elif blah: mul = 1.xxx

return exp * mul / 31536000
marc is offline   Reply With Quote
Old 2004-11-30, 18:57   #13
leifbk
 
leifbk's Avatar
 
May 2004
Oslo, Norway

23×3×5 Posts
Default

There are surely a hundred ways to write this code, but that's a little beside the point. If I wanted to write a pure Python program, I could for instance have used one of Python's list constructs, stuffed the threshold values and coefficients into it, and run a foreach ... on it. However, I wanted to write a program that's easy to understand by a casual programmer, and that might easily be ported into Perl, PHP, C, Basic or whatever.

As I've already suggested, I'm more interested in if the results matches the values that people get in their reports, or if anyone can spot an error in the actual numbers.

But thanks for your response anyway

-Leif.
leifbk is offline   Reply With Quote
Old 2004-12-19, 20:41   #14
James Heinrich
 
James Heinrich's Avatar
 
"James Heinrich"
May 2004
ex-Northern Ontario

2·29·59 Posts
Default

Thanks for the LL -> P90 code, just what I was looking for :)

Next question: What would the equivalent code look like for calculating P90 time for trial factoring and P-1?
James Heinrich is online now   Reply With Quote
Old 2004-12-20, 08:34   #15
leifbk
 
leifbk's Avatar
 
May 2004
Oslo, Norway

23×3×5 Posts
Default

Don't know about TF, but the P-1 testing seems to get a credit of 0.001 P90 year regardless of size.

I've just got one more thing to say about this code: The reports from mersenne.org that write CPU P90 years with 3 decimals, seem to do the intermediates with 4 decimals internally. I discovered it by summing up this row:

Code:
24373073  3.299   3.299
12798427  0.830   4.129
23643479  3.200   7.329
23207629  3.141  10.470
11783371  0.764  11.234
25936913  4.225  15.459
25988381  4.233  19.692
25028371  3.387  23.079
23913157  3.236  26.315
23153183  3.133  29.448
However, the sum came out as 29.449 in the reports. The same series written with 4 decimals reveals why:

Code:
24373073  3.2986   3.2986
12798427  0.8303   4.1289
23643479  3.1998   7.3287
23207629  3.1409  10.4696
11783371  0.7645  11.2341
25936913  4.2249  15.4590
25988381  4.2333  19.6923
25028371  3.3873  23.0796
23913157  3.2363  26.3159
23153183  3.1335  29.4494
With 5 decimals the sum is 29.44950, and with 6 decimals it's 29.449505, both of which should have been rounded to 29.450 using 3 decimals.

regards, Leif.
leifbk is offline   Reply With Quote
Old 2004-12-20, 16:23   #16
James Heinrich
 
James Heinrich's Avatar
 
"James Heinrich"
May 2004
ex-Northern Ontario

2×29×59 Posts
Default

Quote:
Originally Posted by leifbk
Don't know about TF, but the P-1 testing seems to get a credit of 0.001 P90 year regardless of size.
What it gets credited as doesn't concern me, I'm interested in calculating how much P90 CPU time it actually takes to do the work. I assume TF would be calculated based on the exponent and the bits, whereas P-1 depends on the exponent and B1/B2, and I suppose whether or not stage 2 was run at all (if a factor was found in stage 1, then no time was spent doing stage 2). Are there any benchmark numbers out there for TF and/or P-1, similar to http://www.mersenne.org/bench.htm ?
James Heinrich is online now   Reply With Quote
Old 2005-02-06, 14:14   #17
James Heinrich
 
James Heinrich's Avatar
 
"James Heinrich"
May 2004
ex-Northern Ontario

2·29·59 Posts
Default

If anyone out there wants to help me build a database of trial factoring time, you can do so by adding this line into worktodo.ini:
Code:
Factor=1000003,32
and (important!) set Options|Preferences|Iterations between screen ouputs to 5000. That will give you output similar to this:
http://mersenne-aries.sili.net/temp/...1000003-32.gif
Then please email or PM me the times for each iteration (better yet just send me a screenshot) and I'll add it to my database. Of course, please also tell me what kind of CPU it is, stock clock speed, actual clock speed if overclocked, HyperThreading enabled/disabled (if appropriate).
James Heinrich is online now   Reply With Quote
Old 2005-02-06, 18:34   #18
marc
 
marc's Avatar
 
Jun 2004
UK

139 Posts
Default

Code:
Mersenne number primality test program version 24.6
Starting factoring M1000003 to 2^62
[Feb  6 18:27] Factoring M1000003 to 2^54 is 54.54% complete.  Time: 78.946 sec.
[Feb  6 18:28] Factoring M1000003 to 2^55 is 27.27% complete.  Time: 51.302 sec.
[Feb  6 18:28] Factoring M1000003 to 2^55 is 54.54% complete.  Time: 28.003 sec.
[Feb  6 18:29] Factoring M1000003 to 2^55 is 81.80% complete.  Time: 27.718 sec.
[Feb  6 18:29] Factoring M1000003 to 2^56 is 13.64% complete.  Time: 45.614 sec.
[Feb  6 18:30] Factoring M1000003 to 2^56 is 27.28% complete.  Time: 27.247 sec.
[Feb  6 18:30] Factoring M1000003 to 2^56 is 40.92% complete.  Time: 27.295 sec.
[Feb  6 18:31] Factoring M1000003 to 2^56 is 54.56% complete.  Time: 27.270 sec.
[Feb  6 18:31] Factoring M1000003 to 2^56 is 68.20% complete.  Time: 27.386 sec.
[Feb  6 18:32] Factoring M1000003 to 2^56 is 81.84% complete.  Time: 27.335 sec.
[Feb  6 18:32] Factoring M1000003 to 2^56 is 95.48% complete.  Time: 27.237 sec.
This is an Athlon XP 2500+ which runs at 1830MHz.
marc is offline   Reply With Quote
Old 2005-02-07, 01:54   #19
JuanTutors
 
JuanTutors's Avatar
 
Mar 2004

22×33×5 Posts
Default

Quote:
Originally Posted by James Heinrich
[...]set Options|Preferences|Iterations between screen ouputs to 5000.[...]
Wouldn't it work to just set Options|Preferences|Iterations between results file ouputs to 5000 and then just copy and paste?
JuanTutors is offline   Reply With Quote
Old 2005-02-07, 02:52   #20
James Heinrich
 
James Heinrich's Avatar
 
"James Heinrich"
May 2004
ex-Northern Ontario

2×29×59 Posts
Default

Sure, whatever works for you, as long as you can give me the numbers as marc did above is perfect.
James Heinrich is online now   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is more sieving power needed? jasong jasong 4 2012-03-25 19:11
Result Not Needed Error on assigned exponent Christenson PrimeNet 2 2011-05-27 05:24
Predicting the needed time for high n-values? Rincewind Sierpinski/Riesel Base 5 4 2009-06-11 12:24
Stability Test for Cool'n'Quiet and Power-Supply Mark.S Hardware 5 2004-05-12 10:16
amount of memory needed for Stage 2 (factor) pin Software 13 2003-03-18 19:54

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


Mon Aug 2 15:07:21 UTC 2021 up 10 days, 9:36, 0 users, load averages: 2.89, 3.03, 3.23

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.