- 소수
1과 그수 자신 이외의 자연수로는 나눌 수 없는, 1보다 큰 자연수
1. 소스코드
public class PrimeNumber {
 public static void main(String[] args) {
  for (long i = 1; i < Long.MAX_VALUE; i++) {
   check(i);
  }
 }
 public static void check(long value) {
  for (long i = 2; i < value; i++) {
   if (value % i == 0)
    return;
  }
  System.out.println(value);
 }
}
2. 결과
1
2
3
5
7
11
13
17
19
23
29
31
...
