![]() |
|
|
#661 | |
|
"James Heinrich"
May 2004
ex-Northern Ontario
23·149 Posts |
Quote:
This is what I have in PHP: Code:
function ECMeffortExpected() {
return array(
20 => array( 11000, 100),
25 => array( 50000, 280),
30 => array( 250000, 640),
35 => array( 1000000, 1580),
40 => array( 3000000, 4700),
45 => array( 11000000, 9700),
50 => array( 44000000, 17100),
55 => array(110000000, 46500),
60 => array(260000000, 112000),
65 => array(800000000, 360000),
);
}
function ECMeffort($curves) {
// https://www.mersenneforum.org/showpost.php?p=573887&postcount=569
// https://github.com/sethtroisi/misc-scripts/blob/main/mersenne/ecm_progress/test.py
// Try to convert list of <B1, B2, number_of_curves> to t40, t45, t50 progress
// original code by SethTro <https://www.mersenneforum.org/member.php?u=15870> 2021-03-16
// translated to PHP by James Heinrich <james@mersenne.ca> 2021-03-17
$completed = array();
foreach (ECMeffortExpected() as $digits => $B1curvesNeeded) {
$complete = 0;
$curvecount = 0;
list($min_B1, $curves_needed) = $B1curvesNeeded;
foreach ($curves as $curvedata) {
list($B1, $B2, $count) = $curvedata;
if (($B1 >= $min_B1) && ($B2 >= (20 * $min_B1))) {
$complete += ($count / $curves_needed);
$curvecount += $count;
}
}
if ($complete > 0.001) {
$completed[$digits] = array($complete, $curvecount);
}
}
return $completed;
}
function ECMprobabilityMissedSmallerFactor($curves_complete, $needed_curves) {
// https://www.mersenneforum.org/showpost.php?p=573952&postcount=574
// Probability of missed (smaller) factor is
// (1 - 1/needed_curves) ^ curves_complete
// which can be transformed to
// math.exp(curve_count * math.log(1 - 1/curve_count))
// or approximated by
// (1/e)^(complete)
//return exp($curves_complete * log(1 - (1 / $needed_curves)));
return pow(1 - (1 / $needed_curves), $curves_complete);
}
|
|
|
|
|
|
|
#662 | |
|
"Seth"
Apr 2019
13×23 Posts |
Quote:
https://gist.github.com/sethtroisi/6...8d6372579f09bd The output is $complete, $FacMissed |
|
|
|
|
|
|
#663 |
|
"James Heinrich"
May 2004
ex-Northern Ontario
23·149 Posts |
Thanks for the revised code. For now I have placed the old and new calculations side-by-side so you can compare and review them and see if the new numbers appear to make sense.
However with the new calculation method and lookup table I wasn't able to figure out how to replicate the B1 and Curves columns. I have left in the B1 calculated from the old lookup table but removed the Curves column. I don't understand this stuff quite well enough to be certain this makes sense, so please review and suggest changes. |
|
|
|
![]() |
| Thread Tools | |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Small inconsistencies between mersenne.org and mersenne.ca factor databases | GP2 | mersenne.ca | 44 | 2016-06-19 19:29 |
| mersenne.ca (ex mersenne-aries.sili.net) | LaurV | mersenne.ca | 8 | 2013-11-25 21:01 |
| Gaussian-Mersenne & Eisenstein-Mersenne primes | siegert81 | Math | 2 | 2011-09-19 17:36 |
| Mersenne Wiki: Improving the mersenne primes web site by FOSS methods | optim | PrimeNet | 13 | 2004-07-09 13:51 |