!Program to calculate all primes below a certain value program sieveOfEratosthenes !define variables int::n n=10000 int dimension(10001)::checks int::i int::j !initialise array do i=2,n checks(i)=1 end do i=2 !search for primes do while(i<root(n)) if checks(i)==1 then j=i**2 do while(j<n) checks(j)=0 j=j+i end do end if i=i+1 end do !output primes found print*,"Primes below ",n do i=2,n-1 if checks(i)==1 then print*,i end if end do end program sieveOfEratosthenes !Function to find the square root of a value function real root(int value) real::result result=1 int::count do count=0,10 result =(result+value/result)/2 end do return result end