Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.mrao.cam.ac.uk/~rachael/compphys/examples/eratosthenes.f90
Дата изменения: Tue Sep 13 13:07:38 2005
Дата индексирования: Tue Oct 2 12:33:14 2012
Кодировка:

Поисковые слова: arp 220
integer i,j,imax,prime_max
integer, allocatable :: primes(:)

write(*,*)'Input largest number for search'
read(*,*)prime_max
allocate(primes(prime_max))
primes=1 ! Sets all elements of array to 1
imax=sqrt(real(prime_max))

do i=2,imax
do j=2*i,prime_max,i
primes(j)=0
enddo
enddo

do i=2,prime_max
if (primes(i)==1) write(*,*)i
enddo
end