3

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.

iadvd
  • 8,875
Euler77
  • 63
  • 5
    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. – André Nicolas Sep 10 '15 at 23:45

4 Answers4

1

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

composite numbers sieve

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

enter image description here

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

Mats Granvik
  • 7,396
0

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$ ....

0

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$.

-1

I propose the following formula of composite numbers, except divisible by 2 and 3: Positive integers contained in two 2-dimensional arrays:$ P1(i,j)=6i^2-1+(6i-1)(j-1)$ and $P2(i,j)=6i^2-1+(6i+1)(j-1)$ are indexes $p$ of all composite numbers in the sequence $S1(p)=6p+5, p=0,1,2,...$ Positive integers contained in two 2-dimensional arrays: $P3(i,j)=6i^2-1-2i+(6i-1)(j-1)$ and $P4(i,j)=6i^2-1+2i+(6i+1)(j-1)$ are indexes $p$ of all composite numbers in the sequence $S2(p)=6p+7, p=0,1,2,...; i,j=1,2,3,...$

                                      |5     10     15     20 ..|
                            P1(i,j)=  |23    34     45     56...|
                                      |53    70     87    104...|
                                      |95   118    141    164...|
                                      |149  178    207    236...|
                                      |...  ...    ...     ...  |


                               | 5     12     19     26 ..|
                               |23     36     49     62...|
                     P2(i,j)=  |53     72     91    110...|
                               |95    120    145    170...|
                               |149   180    211    242...|
                               |...      ...      ...  ...|  

                                       |3        8     13     18 ..|
                                       |19      30     41     52...|
                                       |47      64     81     98...|
                              P3(i,j)= |87     110    133    156...|
                                       |139    168    197    226...|
                                       |...    ...    ...    ...   | 

                               |7    14     21     28 ..|
                               |27   40     53     66...|
                      P4(i,j)= |59   78     97     116..|
                               |103  128   153    178...|
                               |159  190   221    252...|
                               |...  ...   ...     ...  |   

[link] (http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=13752&lngWId=3)

  • These formulae of arrays are general formulae of composite numbers in the sequences $S1(p)=6p+1 – Boris Sklyar Nov 12 '16 at 16:43
  • 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 Nov 12 '16 at 16:59
  • 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 Nov 12 '16 at 17:11
  • see [link] https://www.academia.edu/13890086/Matrix_sieve_the_easiest_way_to_find_prime_numbers – Boris Sklyar Nov 29 '21 at 20:01