Check05C - final int P = 607, G = input.nextInt();...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import type.lib.ToolBox; import java.io.PrintStream; import java.util.Scanner; i public class Check05C { public static void main(String[] args) { Scanner input = new Scanner(System.in); PrintStream output = System.out; output.println("Enter an integer g [1 < g < 607]");
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: final int P = 607, G = input.nextInt(); ToolBox.crash(!(1 < G && G < P), ". .."); int e = 1, power = G; do { power = (power * G) % P; } while (power != G && (e = e + 1) > 1); output.printf("The smallest e [e > 1 & g^e = g]%n%d", e + 1); } }...
View Full Document

This note was uploaded on 09/16/2011 for the course CSE CSE 1020 taught by Professor Burton,ma during the Fall '10 term at York University.

Ask a homework question - tutors are online