Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Primes{
- public static void main(String[] args){
- int N = Integer/parseInt(args[0]);
- boolean[] a = new boolean[N];
- for (int i = 2; i<N; i++) a[i] = true;
- for (int i = 2; i<N; i++)
- if (a[i] != false)
- for (int j = i; j*i < N; j++)
- a[i*j] = false;
- for (int i = 2; i < N; i++)
- if (i > N - 100) // Зачем это проверять?
- if (a[i]) Out.print(" " + i);
- Out.println();
- }
- }
Add Comment
Please, Sign In to add comment