You might be interested in the following two variable function.

Define F(m,k) recursively as follows.

F(1,1) = 15

F(m+1,k) = F(m,k) + 4*(2*m + k + 2)

F(m,k+1) = F(m,k) + 2*(2*m + 1)

Then for both m and k positive integers,

F(m,k) = (2 * m + 1) * (2 * m + 2 * k + 1)

which makes it evident that every odd non-square positive composite

integer appears in the table, and that no prime appears in the table.

This function could be used to make an efficient prime number sieve.

Note that F(m,0) = (2*m+1)**2

Factoring a positive integer z is equivalent to finding it in the table.