/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package primtesttime; import static java.lang.Math.*; /** * * @author suchenek */ public class PrimalityTestDemo { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here int a[] = {2,3,7,13,61,127,251,509,1021,2039,4093,8191,16381,32761,65521,131071,262139,524287,2147483647}; for (int i = 0; i < a.length; i++) { // PrimalityTestDemo test = new PrimalityTestDemo(3802499); // PrimalityTestDemo test = new PrimalityTestDemo(524287); PrimalityTest test = new PrimalityTest(a[i]); test.go(); System.out.println(test.getOutput()); System.out.println(); } } } /* Test data of the form 2^p - 1 2147483647 = 2^31 - 1 524287 = 2^19 - 1 131071 = 2^17 - 1 8191 = 2^13 - 1 127 = 2^7 - 1 31 = 2^5 - 1 7 = 2^3 - 1 3 = 2^2 - 1 Other data that match worst-case count: 13, 61, 251, 509, 1021, 2039, 4093 */