Download or view primeCountTest.frink in plain text format
/** This program counts the prime numbers less than or equal to
10^n for integer values of n. This can be used to reproduce
the table at:
http://mathworld.wolfram.com/PrimeCountingFunction.html
It also compares it to the Riemann prime count estimate.
*/
use RiemannPrime.frink
nextExp = 1
nextNum = 10^nextExp
count = 0
println["Exp\ttrue\testimate\terror"]
for p = primes[]
{
if p > nextNum
{
estimate = round[primeCount[nextNum]]
error = 1. (estimate-count)/count
println["$nextExp\t$count\t$estimate\t" + formatSci[error, 1, 3]]
nextExp = nextExp + 1
nextNum = 10^nextExp
}
count = count + 1
}
Download or view primeCountTest.frink in plain text format
This is a program written in the programming language Frink.
For more information, view the Frink
Documentation or see More Sample Frink Programs.
Alan Eliasen was born 20218 days, 0 hours, 24 minutes ago.