Re: A Fun Recursive Prime Count Estimator
- From: "Celebrity Airhead" <none@xxxxxxxxxx>
- Date: Sat, 20 May 2006 03:17:32 GMT
<gjedwards@xxxxxxxxx>
(in plain text I don't know how you write that big pi-like symbolThat's an upper-case pi, which I guess comes from the word "product" in some
language or other.
In case I screwed this up here's the algorithm in C (returns
'probability' that N is prime):
double EstimatedPrimeProb(
double N
)
{
int i;
double prob = 1;
double rootN = sqrt(N);
if(N<=2)
return 1;
else
{
for(i=2; i<=rootN; i++)
{
prob = prob*( 1 - (EstimatedPrimeProb(i)/i ) );
}
return prob;
}
}
Looks reasonable to me. Funky identities in number theory are sometimes
intelligible in terms of probability.
.
- References:
- A Fun Recursive Prime Count Estimator
- From: gjedwards
- A Fun Recursive Prime Count Estimator
- Prev by Date: Re: A Fun Recursive Prime Count Estimator
- Next by Date: Re: JSH: Fraud question is pertinent
- Previous by thread: Re: A Fun Recursive Prime Count Estimator
- Next by thread: Re: A Fun Recursive Prime Count Estimator
- Index(es):