Guest User

Untitled

a guest
Jul 20th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. class Primes{
  2. public static void main(String[] args){
  3. int N = Integer/parseInt(args[0]);
  4. boolean[] a = new boolean[N];
  5. for (int i = 2; i<N; i++) a[i] = true;
  6. for (int i = 2; i<N; i++)
  7. if (a[i] != false)
  8. for (int j = i; j*i < N; j++)
  9. a[i*j] = false;
  10. for (int i = 2; i < N; i++)
  11. if (i > N - 100) // Зачем это проверять?
  12. if (a[i]) Out.print(" " + i);
  13. Out.println();
  14. }
  15. }
Add Comment
Please, Sign In to add comment