primes2.pl : Prime numbers (faster variant)
Generate prime numbers by Sieve of Eratosthenes.
By generating candidates in ascending order, inappropriate ones are sorted
out earlier, so fewer candidates are checked against others.
How to use:
For an integer N, you enter
upto(N),
and get all primes P1,P2,..,Pm up to N
prime(P1), prime(P2), prime(Pm).