![]() |
[QUOTE=SethTro;584341]I coded this up in python at [URL="https://github.com/sethtroisi/misc-scripts/blob/main/mersenne/ecm_progress/test2.py#L48"]ecm_progress/test2.py[/URL][/QUOTE]I'm not sure I understand what you're trying to do with that lookup table in your code. But I don't speak Python well (or at all).
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); }[/code]If you could, please explain in more detail what your new code is doing, and what the bits of the lookup table are for. If you're real ambitious, feel free to rewrite your code in PHP so I can just plug it in. :smile: |
[QUOTE=James Heinrich;584362]I'm not sure I understand what you're trying to do with that lookup table in your code. But I don't speak Python well (or at all).
<CODE> If you could, please explain in more detail what your new code is doing, and what the bits of the lookup table are for. If you're real ambitious, feel free to rewrite your code in PHP so I can just plug it in. :smile:[/QUOTE] Thanks for including the code it made it very easy to adapt. [URL]https://gist.github.com/sethtroisi/60cfd68ad24770d7048d6372579f09bd[/URL] The output is $complete, $FacMissed |
[QUOTE=SethTro;584364]Thanks for including the code it made it very easy to adapt.[/QUOTE]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. |
Minor bug report: [URL="https://www.mersenne.ca/exponent/836683"]M836683[/URL] has a factor with a single, prime k but it shows up as P-1 smooth in the "P+1 section" because it has an "empty list" of factors.
|
[QUOTE=gLauss;584484]Minor bug report: [URL="https://www.mersenne.ca/exponent/836683"]M836683[/URL] has a factor with a single, prime k but it shows up as P-1 smooth in the "P+1 section" because it has an "empty list" of factors.[/QUOTE]Thanks for finding that, fixed.
|
| All times are UTC. The time now is 05:16. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.