Formula for composite numbers I was digging around blogspot when I came upon an old post that claimed the author discovered a formula that generates all odd composite numbers.
The post:
http://barkerhugh.blogspot.com/2012/05/composite-number-formula.html?m=1 
The formula: 

$2x -1+4y(x+y)$ for all positive integer values of x and y.

It is my understanding that a formula for all composite numbers (that is every even number paired with formula above) subtracted by a given magnitude would be a prime counting function. 
Denoting $q$ as a given magnitude 
$\frac{q}{2}$ $+(2x -1+4y(x+y))$ fitted for the magnitude $q$ $=\pi(x)$.
(Please feel free to edit)

All I'm looking for is an explanation of this post as well as to how a formula for all composite numbers would correspond to a prime counting function.
  Thank you.

 A: You can generate the composites with this Excel cell formula which uses no number theoretic functions at all:
=IF(COLUMN()=1,1,IF(ROW()=COLUMN(),ROW()-ROW()*PRODUCT(INDIRECT(ADDRESS(ROW(),1)
&":"&ADDRESS(ROW(),COLUMN()-1))),IF(ROW()>COLUMN(),INDIRECT(ADDRESS(ROW()
-COLUMN(),COLUMN())),"")))


but if you look at the cell formula and the table in the picture, you will find that it is only a sieve since every time one row contains a zero it will cause the diagonal entries to be equal to the row index, which happens at the composite numbers.
You can make it into the characteristic sequence of composite numbers by not multiplying with the row index:
=IF(COLUMN()=1,1,IF(ROW()=COLUMN(),1-PRODUCT(INDIRECT(ADDRESS(ROW(),1)
&":"&ADDRESS(ROW(),COLUMN()-1))),IF(ROW()>COLUMN(),INDIRECT(ADDRESS(ROW()
-COLUMN(),COLUMN())),"")))


But a recurrence for the prime counting function using these spreadsheet formulas I don't think is possible.
A: The formula that generates all composite odd numbers is given by sieve of Marouane.
$p^2_{n}+2p_{n}.c=N$    where $c$ is a constant $N$ is an odd composite and $p_{n}$ is a prime number except the prime $2$.
Ex : for $p_{n}=3$, we get $9+6c=N$, for $c$ from 0 to 5, you get the odd numbers $9,15,21,27,33$
for $p_{n}=5$, we get $25+10c=N$, for $c$ from 0 to 5, you get the odd numbers $25,35,45,55,65$ ....
A: Proving Barker's formula is shown below.  One immediate comment is that a composite counting function falls out directly from the prime counting function.
Using the approximation #primes ~ $1.022*N/log(N)$ and that integers>1 are either prime or composite yields:
number of composites ~ $N -1.022*N/log(N)$
and since half of a number range are even composites,
number of  odd composites ~ $N/2-1.022*N/log(N)$       (1)
To formulate it with Barker's x&y seems unduly complicated but of course we know
max($2x-1+4y(x+y))$ ~ N    for the maximum x&y considered.  (2)
which allows (1) to be expressed in terms of x&y if that is what you seek.
For example, let max x,y both=100, then (max) N ~ 80199.  Substituting (2) into (1) yields
number of  odd composites ~ $80199 /2 - 80199*1.022/log(80199) = 32841$.  Since even composites ~ 40099, all composites~ 72940.
Checking, 72940 + #primes ~ $72940 + 1.022*80199/log(80199) = 80198$, which checks.  Of course, actual $primepi(80199)=7852$ vs the 7258 approximation.
(proof of Barker's)
Barker's formula is equivalent to factors:
$( 2y+1 , 2(x+y)-1 )$     (3)
(3) directly shows (1) produces no prime numbers (each term having a
minimum value of 3, for a minimum product of 9, the lowest odd composite),
and only produces odd number solutions. Thus it produces only odd composites.
We start with an odd composite number. Here, k>3, p>1, q>1, x>0, y>0 all are integers.
This number must be of the form 2k+1 since it is odd, expressible as
$2k+1 =(2p-1)*(2q-1)$.
There are three scenarios: $p<q, p=q, p>q$
$p<q: p=y+1, q=y+x$ which gives us $2k+1=(2[y+1]-1)(2[y+x]-1)= (2y+1)(2y+2x-1)$
$p=q: p=y+1, q=y+1 2k+1 = (2[y+1]-1)(2[y+1]-1)= (2y+1)(2y+2-1)$ In this case x=1
p>q : Same as first row but flipped values for p and q.
So any and all odd composites can be expressed in form $2x +4y(x+y)-1$.
