Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Could Someone Compile This Code?

  1. Jan 17, 2010 #1
    ..and tell what the last line they get in doing so.

    Code (Text):
    program sieve_t
    implicit none
    integer*1 s(1000000), offset (10), sequence
    integer i, j, n

    n=0
    sequence=4

    do i=1, 10
    offset(i)=0
    enddo

    offset(1)=2
    offset(2)=4
    offset(3)=2

    do i=1, 1000000
    s(i) = 1
    enddo

    do i=2, 1000000
    if (s(i).eq.1) then
    do j=2, (1000000/i)
    s(i*j)=0
    enddo
    endif
    enddo

    do i=2, 1000000

    if (s(i).eq.1) then
    do j=1,sequence-1  
    if (s(i+offset(j)).ne.1) goto 10
    enddo
    n=n+1
    write(*,*) n, i,i+2,i+6,i+8
    endif
    10  continue
    enddo


    end
     
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted



Similar Discussions: Could Someone Compile This Code?
Loading...