/**
* Created by Jo on 7/10/2017.
* For more exercises and lessons, visit http://shegertech.blogspot.com/
* Chapter 8, Example 3
*/
public class Q3Solution {
public boolean is_Prime(long n) {
if (n < 2)
return false;
for (int i = 2; i <= n / 2; i++) {
if (n % i == 0)
return false;
}
return true;
}
public static void main(String[] args) {
Q3Solution q3 = new Q3Solution();
for (int i = 2; i < 100; i++) {
if (q3.is_Prime(i) && q3.is_Prime(i + 2)) {
System.out.printf("(%d, %d)\n", i, i + 2);
}
}
}
}