/** 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 }