import java.util.Scanner; public class why_prime { public static void main( String[] args ) { Scanner in = new Scanner(System.in); int a, b, i; int p, N; System.out.println("Prints: Hash index = ( (a * hashCode + b) % p ) % N"); System.out.print("Enter a = "); a = in.nextInt();; System.out.print("Enter b = "); b = in.nextInt();; System.out.print("Enter p = "); p = in.nextInt();; System.out.print("Enter N = "); N = in.nextInt();; for ( i = 0; i < 2*N; i++ ) System.out.println( i + " --> " + ((a * i + b) % p) %N ); } }