//  Data Structures with Java by John R. Hubbard
//  Copyright McGraw-Hill, 2001
//  Problem 2.28 on page 50
//  Finding Fermat primes

import schaums.dswj.Primes;

public class Pr0228
{ public static void main(String[] args) 
  { final int N=10000;
    Primes.setSize(N);
    for (int p=0; p<5; p++)
    { int n = (int)Math.pow(2,Math.pow(2,p)) + 1;
      if (Primes.isPrime(n))
        System.out.println("p = "+p+", n = 2^2^p = "+n);
    }
  }
}
