# COUNTPRIMES --- count primes in an interval # Use counprimes(2,100) to count the number # of primes in the interval [a,b]. countprimes := proc(a,b) local i, N; N := 0; for i from a to b do if isprime(i) then N := N + 1; fi; od; RETURN( N ); end: # jac, 6/10/2001