The algorithm works like this.
First, we start with the equation x+y=z (x,y)>0
Next, we pick an input value for z. In this case we will pick z= 5.
Then, we proceed to solve the equation in terms of x.
Next, we enumerate the solutions to the equation. Namely, 4+1=5, 3+2=5, 2+3=5, and 1+4=5.
Then, check if the values of x and y in each equation are primitive i.e when x and y share no common factor.
Finally, If yes declare that 5 is prime. If not declare that 5 is composite. In this case, all solutions of z are primitive therefore z is prime.
To boil it down further z is prime if all pairs of solutions to x+y=z are primitive to each other. But if even if one pair of solutions is not primitive to each other then z is composite.
Visit this page for an interactive demo of this Primality test.
Thank you,
Nunghead