primeCountTest.frink

View or download 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
*/


nextExp = 1
nextNum = 10^nextExp
count = 0

for p = primes[]
{
    if p > nextNum
    {
       println["$nextExp\t$count"]
       nextExp = nextExp + 1
       nextNum = 10^nextExp
    }
    count = count + 1
}


View or download 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 18354 days, 2 hours, 25 minutes ago.