/* Written by Boufounos,Petros T : petrosb@mit.edu Castagnola,Luciano : luciano@mit.edu Michalakis,Nikolaos : nikos@mit.edu October 11, 2001 May be freely reproduced for educational or personal use */ import java.math.*; import java.io.*; import java.util.*; public class FindInverse { static BigInteger TWO=new BigInteger("2"); static int TRIES = 256; public static void main(String args[]) { if (args.length>1){ System.out.println("Usage: java FindInverse []"); System.exit(0); }else if(args.length==1){ int primelength = Integer.parseInt(args[0]); runForLength(primelength); }else{ for(int i=1; i<17; i++){ int length = i * 64; System.out.println("length:"+length); runForLength(length); } } } public static void runForLength(int primelength){ Random r = new Random(); BigInteger prime = new BigInteger(primelength, 2048, r); BigInteger[] aarray = new BigInteger[TRIES]; for(int i=0; i