program main implicit none integer*8::N,i,j integer*8::upper integer*8,allocatable::isPrime(:) read *,N if(N.eq.1) then print '(a)', "NO" return end if allocate(isPrime(N)) isPrime = 1 upper = FLOOR(SQRT(REAL(N))) do i=2, FLOOR(SQRT(REAL(N))) if(isPrime(i).eq.1) then if(MOD(N,i).eq.0) then print '(a)', "YES" return end if do j=i+i, N, i isPrime(j) = 0 end do end if end do print '(a)', "NO" end program main