/* Fun with primes! Reads in a limit L, and
then prints out all primes between <= L
twice -- first by checking each number
individually from 2 to L to see if it has
more than one factor, then by using the
sieve of Eratosthenes */
boolean divides(int x, int y) {
if (((x / y) * y) == x)
return true;
else
return false;
}
int sqrt(int x) {
int i;
for (i=1; i x)
return i-1;
}
boolean prime(int x) {
int i;
for(i=2; i