# hw2 - /* * * * * * */ homework 2 the methods in this class...

This preview shows pages 1–2. Sign up to view the full content.

* homework 2 * the methods in this class are to deal with the questions in homework2 * Hua Zhang * 06/27/2003 */ * // Note: Code for a version of Miller-Rabin will be posted shortly. Hua used the version written for Java. v import java.math.*; i public class hw2 { //invoke the methods one by one public static void main(String[] args) { //Question1(); //Question2(); //Question31(); //Question32(); Question4(); //Question5(); //Question6(); //Question7(); //ExtraCredits(); } //method to solve question1 private static void Question1() { //Initialize BInt as 10 to the 20th BigInteger BInt = BigInteger.valueOf(10).pow(30); //number of possibly prime integers found byte bNum = 0; b System.out.println("Question 1: The first five prime numbers greater than 10 to the power of 30:"); //loop until we found 5 possibly prime integers while (bNum < 5) { //Call MillerRabin() to test BInt if ( MillerRabin(BInt)) { bNum++; System.out.println(BInt); } } //increase BInt to Bint + 1 BInt = BInt.add(BigInteger.ONE);

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This document was uploaded on 07/14/2011.

### Page1 / 4

hw2 - /* * * * * * */ homework 2 the methods in this class...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online