# Formula for composite numbers

6,900

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)
-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)
-COLUMN(),COLUMN())),"")))


But a recurrence for the prime counting function using these spreadsheet formulas I don't think is possible.

Share:
6,900

Author by

### Euler77

Amateur mathematican and lover of the sciences

Updated on June 27, 2022

• Euler77 less than a minute

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:

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.

• André Nicolas almost 7 years
It is $(2y+1)(2y+2x-1)$, more complicated than $(2x+1)(2y+1)$, or $(x+1)(y+1)$, which also takes care of even composites. I do not see any way of turning this into a prime-counting function.
• Boris Sklyar over 5 years
These formulae of arrays are general formulae of composite numbers in the sequences $S1(p)=6p+1 • Boris Sklyar over 5 years and$S2(p)=6p+7$, and since all prime numbers belong to these sequences (except 2 and 3) so indexes of primes are that positive integers which do not appear in these arrays. • Boris Sklyar over 5 years For example: Find positive integers <30, which do not appear in two arrays$P1(i,j)$and$P2(i,j)\$: | 5 10 15 20 25 30| |23 34 45 56 67 78| and |5 12 19 26 33 40| |23 36 49 62 75 88| The answer is obvious: 0, 1, 2, 3, 4, , 6, 7, 8, 9, , 11, , 13, 14, , 16, 17, 18, , , 21, 22, , 24, , , 27, 28, 29, , (These integers are indexes p of 20 first primes in the sequence S1=6p+5).
• Boris Sklyar 7 months