I'm working on the following pb : "Write a Java program to create a two-dimension array (m x m) A[][] such that A[i][j] is true if I and j are prime and have no common factors, otherwise A[i][j] becomes false." from https://www.w3resource.com/java-exer...ercise-158.php
As an answer output they suggested that we should get the following :
true true true true true true true true false
I disagree with the answer because iteration (i,j) here will be between 0, 1, and 2. But 0 and 1 are not prime numbers so any value of the matrix with 0 and/or 1 should give false since the first condition is not met (prime number).
Then, 2 is a prime number but has a common factor (which is 2) if we reach the last value of the matrix[2][2] so how come they suggested this answer. I believe it should only be false? Or am I missing something?
This solution confuses me in knowing what the right answer is. What do you think of what I said?