# The prime number matrix sieve

I have derived the following theorem:

An odd positive integer $$N=6n−1$$ is a prime iff neither of two diophantine equations

$$6x^2+(6x−1)y=n$$

$$6x^2+(6x+1)y=n$$

has solution.

An odd positive integer $$N=6n+1$$ is a prime iff neither of two diophantine equations

$$6x^2−2x+(6x−1)y=n$$

$$6x^2+2x+(6x+1)y=n$$

has solution.

$$x=1,2,3,\ldots;y=0,1,2,\ldots;n=1,2,3,\ldots$$

Theorem allows to substitute the task: "Find all primes in the range $$(N_1;N_2)$$" by the task: "Find positive integers which do not appear in the range $$(n_1;n_2)$$ in two pairs of $$2$$-dimensional arrays

$$P_1(i,j)=6i^2+(6i-1)(j-1)$$

$$P_2(i,j)=6i^2+(6i+1)(j-1)$$

$$i,j = 1,2,3,\ldots$$

for primes in the sequence $$N=6n-1$$.

$$P_3(i,j)=6i^2-2i+(6i-1)(j-1)$$

$$P_4(i,j)=6i^2+2i+(6i+1)(j-1)$$

$$i,j = 1,2,3,\ldots$$

for primes in the sequence $$N=6n+1$$. Since all primes (except $$2$$ and $$3$$) are in one of two forms $$6n−1$$ or $$6n+1$$.

Can anybody advice me - is proposed "matrix sieve" algorithm well known?