Find prime number in the coordinate of Prime Spiral : I have a question which says that all prime numbers are arranged in the spiral form (the ulam spiral)

I will be entering 2 first which will show that I have to enter 2 coordinates and then at those coordinates values will be shown. 

Input:

2

1,0 

0,1

Expected output:

3

7

In this case at two coordinates 1,0 and 0,1 values are assigned i.e, 3 and 7 which are result. Please help me with this problem 

