program main integer::N integer,parameter::b=LEN_TRIM("a") integer,parameter::a=b-b integer,parameter::c=b+b integer,allocatable::isPr(:) read *,N allocate(isPr(N)) call get_pr(isPr,N) if(isPr(N).eq.a) then print '(a)',"NO" else print '(a)',"YES" end if contains subroutine get_pr(isPr, N) implicit none integer::i,j,N integer,parameter::pr=b,nonpr=a integer,allocatable::isPr(:) isPr=pr isPr(a)=nonpr do i=c, FLOOR(SQRT(REAL(N))) if(isPr(i).eq.pr) then do j=ISHFT(i,b), N, i isPr(j) = nonpr end do end if end do end subroutine get_pr end program main