/* iterate through integer values 2 to 10 for i and j and compute i*i + j*j and determine if this sum is a prime, if so, * output i and j */ public class PrimeSumOfSquares { public static void main(String[] args) { for(int i=2;i<=10;i++) // iterate through all combinations of 2 int values from 2 to 10 for(int j=i+1;j<=10;j++) if(isPrime(i*i+j*j)) // test for prime and if so, provide output System.out.println("i: " + i + ", j: " + j + " with a sum of " + (i*i+j*j)); } // given an int value, determine if it is prime by dividing all int values from 2 to x-1 into x to see if any divide public static boolean isPrime(int x) { boolean prime = true; // assume x is a prime, used to exit the while loop if we find a divisor int divisor = 2; // iterate from 2 to x-1 to see if any value of divisor can divide into x while(prime&&divisor