![]() |
|
|
#12 | |
|
"Victor de Hollander"
Aug 2011
the Netherlands
22308 Posts |
Quote:
Code:
function FactorProbability($exponent, $B1, $B2, $HowFarFactoredBits=false) {
// adapted from guess_pminus1_bounds() in ecm.c in Prime95 source
if ($B1 < 30) {
return 0;
}
$B2 = max($B2, $B1);
if (!$HowFarFactoredBits) {
//$HowFarFactoredBits = FactorBits($exponent);
$HowFarFactoredBits = FactorBits($exponent) - 1; // last level of TF is now done *after* P-1 by default
}
$ProbabilityThreshold = 0.0001;
$log2 = log(2);
$logB1 = log($B1);
$logB2 = log($B2);
$k = 1; /* K in K*B^N+C. Must be a positive integer. */
$b = 2; /* B in K*B^N+C. Must be two. */
$c = -1; /* C in K*B^N+C. */
$kk = 1.5 * pow(2.0, $HowFarFactoredBits);
if (($k == 1.0) && ($b == 2) && ($c == -1)) {
$kk = $kk / 2.0 / $exponent;
}
$LogKK = log($kk);
$temp = $kk / (($B1 + $B2) / 2);
$LogTemp = log($temp);
$FactorProbability = 0;
$H = $HowFarFactoredBits;
while (true) {
/* If $temp < 1.0, then there are no factor to find in this bit level */
if ($LogTemp > 0) {
/* See how many smooth k's we should find using B1 */
/* Using Dickman's function (see Knuth pg 382-383) we want k^a <= B1 */
$Prob1 = DickmansFunction($logB1 / $LogKK);
/* See how many smooth k's we should find using B2 */
/* Adjust this slightly to eliminate k's that have two primes > B1 and < B2 */
/* Do this by assuming the largest factor is the average of B1 and B2 */
/* and the remaining cofactor is B1 smooth */
$Prob2 = $Prob1 + ((DickmansFunction($logB2 / $LogKK) - $Prob1) * (DickmansFunction($logB1 / $LogTemp) / DickmansFunction($logB2 / $LogTemp)));
if ($Prob2 < $ProbabilityThreshold) {
break;
}
/* Add this data in to the total chance of finding a factor */
$FactorProbability += $Prob2 / ($H + 0.5);
}
$H++;
$LogKK += $log2;
$LogTemp += $log2;
}
return $FactorProbability;
}
|
|
|
|
|
|
|
#13 |
|
Basketry That Evening!
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88
3·29·83 Posts |
|
|
|
|
|
|
#14 |
|
Einyen
Dec 2003
Denmark
35×13 Posts |
It claimed that I got credit when I submitted the P-1 line even with no factor. I did not check if my P-1 credit was raised by that amount, but I will check next time.
|
|
|
|
|
|
#15 |
|
"/X\(‘-‘)/X\"
Jan 2013
55648 Posts |
|
|
|
|
|
|
#16 |
|
"Victor de Hollander"
Aug 2011
the Netherlands
23×3×72 Posts |
James's site is mainly serving pages created from a database, so PHP makes a lot of sense. What is wrong with using PHP for this case?
Code:
// adapted from guess_pminus1_bounds() in ecm.c in Prime95 source Code:
/* Determine the probability of P-1 finding a factor */
/* This code was pulled from guess_pminus1_bounds */
double guess_pminus1_probability (
struct work_unit *w)
{
double log2, logB1, logB2, h, kk, logkk, temp, logtemp, prob;
/* Constants */
log2 = log ((double) 2.0);
logB1 = log (w->B1);
logB2 = log (w->B2);
/* What is the "average" value that must be smooth for P-1 to succeed? */
/* Ordinarily this is 1.5 * 2^how_far_factored. However, for Mersenne */
/* numbers the factor must be of the form 2kp+1. Consequently, the */
/* value that must be smooth (k) is much smaller. */
kk = 1.5 * pow (2.0, w->sieve_depth);
if (w->k == 1.0 && w->b == 2 && w->c == -1) kk = kk / 2.0 / w->n;
logkk = log (kk);
/* Set temp to the number that will need B1 smooth if k has an */
/* average-sized factor found in stage 2 */
temp = kk / ((w->B1 + w->B2) / 2);
logtemp = log (temp);
/* Loop over increasing bit lengths for the factor */
prob = 0.0;
for (h = w->sieve_depth; ; ) {
double prob1, prob2;
/* If kk < 1.0, then there are no factors to find in this bit level */
if (logkk > 0.0) {
/* See how many smooth k's we should find using B1 */
/* Using Dickman's function (see Knuth pg 382-383) we want k^a <= B1 */
prob1 = F (logB1 / logkk);
/* See how many smooth k's we should find using B2 (if temp < 1.0 then we should find them all) */
/* Adjust this slightly to eliminate k's that have two primes > B1 and < B2 */
/* Do this by assuming the largest factor is the average of B1 and B2 */
/* and the remaining cofactor is B1 smooth */
if (logtemp <= 0.0) prob2 = 1.0;
else prob2 = prob1 + (F (logB2 / logkk) - prob1) *
(F (logB1 / logtemp) / F (logB2 / logtemp));
if (prob2 < 0.0001) break;
/* Add this data in to the total chance of finding a factor */
prob += (1.0 - prob) * prob2 / (h + 0.5);
}
/* Move to next bit level */
h += 1.0;
logkk += log2;
logtemp += log2;
}
/* Return the final probability */
return (prob);
}
|
|
|
|
|
|
#17 | |
|
Aug 2002
Buenos Aires, Argentina
2×683 Posts |
Quote:
Up to this moment, Prime95 ran up to 2300300 (13 numbers) and it found three new factors, for exponents 2300017, 2300057 and 2300153. If it is true that I can find factors only 1 of every 68 numbers, that means that I'm very lucky. |
|
|
|
|
|
|
#18 |
|
"Victor de Hollander"
Aug 2011
the Netherlands
49816 Posts |
If anybody wants my P95 P-1 savefiles (B=10e6, B2=200e6) from exponents in the range 1.5M-1.7M (on 2500+ exponents without factors) to extend them for instance, let me know.
Note that the exponents in question also have had 280 ECM curves @B1=50,000 done since the P-1 runs. Somebody better educated in the subject can probably calculate if it still is useful to run more P-1 or just ECM. |
|
|
|
|
|
#19 | |
|
"Kieren"
Jul 2011
In My Own Galaxy!
100111101011102 Posts |
The Black Speech of Mordor:
Quote:
|
|
|
|
|
|
|
#20 | |
|
Aug 2002
Buenos Aires, Argentina
25268 Posts |
Quote:
|
|
|
|
|
|
|
#21 | |
|
Jun 2003
13BB16 Posts |
Quote:
|
|
|
|
|
|
|
#22 | |
|
Aug 2002
Buenos Aires, Argentina
2×683 Posts |
Quote:
|
|
|
|
|
![]() |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| p4 - 1.8 ghz - LL tests? | joblack | Hardware | 12 | 2009-08-26 20:40 |
| More P-1 tests | dave_0273 | Marin's Mersenne-aries | 1 | 2006-03-23 00:03 |
| PRP => LL-tests? | Holmes | Math | 1 | 2005-05-13 17:18 |
| Yet another set of 20 P-1 tests | GP2 | Completed Missions | 5 | 2003-09-30 22:10 |
| Bad LL Tests | outlnder | Lounge | 8 | 2002-10-21 00:12 |