9

Consider the sets of integers $$ A = \{1, 3, 7, 13, 27\} \\ B = \{4, 10, 16, 40, 100\} $$

Elementwise addition of sets $A, B$ looks like $A + B := \{ a + b: a \in A, b \in B\}$.

Now elementwise-add them to form $A + B$. Here is the result: $$ \begin{matrix} + & 1 & 3 & 7 & 13 & 27 & \\ 4 & 5 & 7 & 11 & 17 & 31 & \\ 10 & 11 & 13 & 17 & 23 & 37 \\ 16 & 17 & 19 & 23 & 29 & 43 \\ 40 & 41 & 43 & 47 & 53 & 67 \\ 100 & 101 & 103 & 107 & 113 & 127\\ \end{matrix} $$

As you can see, this doesn't perfectly list the first $n$ primes since $59$ is missing.

Can you come up with two sets of integers $A, B$ such that $A + B$ consists only of prime numbers and such that $|A + B| \gt 20$. In other words, can you beat me in my example above?

Thus, if we don't examine the size of the integers involved in the above matrix, we've effectly compressed $n^2 - n$ primes into $2n$ numbers where $n = 5$. I don't know about you, but to me that seems pretty darn interesting!


Continuing from above (by pen & paper): $$ \begin{matrix} + & 1 & 3 & 7 & 13 & 27 & 57 &\\ 4 & 5 & 7 & 11 & 17 & 31 & 61\\ 10 & 11 & 13 & 17 & 23 & 37 & 67\\ 16 & 17 & 19 & 23 & 29 & 43 & 73\\ 40 & 41 & 43 & 47 & 53 & 67 & 97\\ 100 & 101 & 103 & 107 & 113 & 127 & 157\\ \end{matrix} $$


Here's a script you can play with:

from sympy.ntheory import prime, isprime

# Seed with whatever you want:
A = [1, 3, 7]
B = [4, 10, 16]

M = 1000

for k in range(0, M):
    if k % 2 == 0:
        b = max(B) + 1
        for n in range(b, b + M):
            for a in A:
                if not isprime(a + n):
                    break
            else:
                B.append(n)
                break
    else:
        a = max(A) + 1
        for n in range(a, a + M):
            for b in B:
                if not isprime(b + n):
                    break
            else:
                A.append(n)
                break


def elementwise_add(A, B):
    C = set()
    for a in A:
        for b in B:
            C.add(a + b)
    return list(C)

print(A)
print(B)
C = elementwise_add(A, B)
C.sort()
print(C)

Outputs:

[1, 3, 7, 13, 27, 63, 97]
[4, 10, 16, 40, 100, 346, 1090, 1426]
[5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 67, 73, 79, 101, 103, 107, 113, 127, 137, 163, 197, 347, 349, 353, 359, 373, 409, 443, 1091, 1093, 1097, 1103, 1117, 1153, 1187, 1427, 1429, 1433, 1439, 1453, 1489, 1523]

Did some thought on the problem:

Ease the constraints some, and allow $0, \pm 1$ into the result set of $A + B$.

Take a finite subsquare of the composition group law for $(\Bbb{Z}, +)$. For example:

$$ \begin{matrix} -2 & (-1) & 0 & 1 & 2 & (3) & 4 & (5) \\ -1 & 0 & 1 & 2 & 3 & 4 & 5 & 6 & \\ 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 \\ 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\ 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\ 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10\\ 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \\ 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\ 6 & (7) & 8 & 9 & 10 & (11) & 12 & (13) \\ \vdots \\ 12 & (13) & 14 & 15 & 16 & (17) & 18 & (19) \\ \end{matrix} $$

First, assume that $7$ is in $A$ and highlight the prime columns with parentheses like above. Those are the only columns that you can select from to fill out $B$. Since we don't want to delete anything from $A$, highlight all rows such that the rows prime columns contain row "7"s prime columns. This is done in the table above.

  • 1
    Do you mean $|A| \cdot |B| >25$? (your example achieves product $25$ but sum only $10$) – coffeemath Oct 20 '18 at 07:44
  • @coffeemath you're right, that's what I mean. Such that $|A + B| \gt 20$ (I counted them up!) – Daniel Donnelly Oct 20 '18 at 07:46
  • @coffeemath Oh, I see your mistake. You're confusing $+$ with $\cup$. – Daniel Donnelly Oct 20 '18 at 07:49
  • 2
    Are we looking to list the first $K$ consecutive primes? Or you only care about listing some primes, regardless of their consecutivity? – RGS Oct 20 '18 at 09:53
  • @RGS either one. Thank you – Daniel Donnelly Oct 20 '18 at 10:33
  • 1
    You can have A as {$1$} and B as {$p_1-1, p_2-1 \cdot\cdot\cdot p_{26}-1$} where $p_x$ is a prime, to suit your conditions. But that’s not what you’re looking for. So both sets should have absolute size of at least $2$. – Kyan Cheung Oct 20 '18 at 12:15
  • 1
    Perhaps, to make this more interesting, you should require that $A$ and $B$ have the same number of elements? – TonyK Oct 20 '18 at 14:12
  • It's too bad that this leads nowhere! The primes are indeed an unsolved mystery... – Daniel Donnelly Oct 22 '18 at 21:17
  • 1
    Not sure if it helps but the primes are too complicated to compress. Compressing data implies " simple patterns " or " using formulas" , without that it is not possible. The primes are as complicated as the digits of $\pi$, what you can see from $\zeta(2 n)$. – mick Nov 26 '23 at 20:22

4 Answers4

2

$|A|=|B|=8,\space |A+B|=64$

I have spiced it up a little bit, numbers in each row are consecutive primes.

\begin{matrix} & 165523 & 165527 & 165533 & 165541 & 165551 & 165553 & 165559 & 165569 \\ \\ +1099560& 1265083 & 1265087 & 1265093 & 1265101 & 1265111 & 1265113 & 1265119 & 1265129 \\ +6067230& 6232753 & 6232757 & 6232763 & 6232771 & 6232781 & 6232783 & 6232789 & 6232799 \\ +16348200& 16513723 & 16513727 & 16513733 & 16513741 & 16513751 & 16513753 & 16513759 & 16513769 \\ +41967240& 42132763 & 42132767 & 42132773 & 42132781 & 42132791 & 42132793 & 42132799 & 42132809 \\ +56322420& 56487943 & 56487947 & 56487953 & 56487961 & 56487971 & 56487973 & 56487979 & 56487989 \\ +65835840& 66001363 & 66001367 & 66001373 & 66001381 & 66001391 & 66001393 & 66001399 & 66001409 \\ +92498820& 92664343 & 92664347 & 92664353 & 92664361 & 92664371 & 92664373 & 92664379 & 92664389 \\ +95634000& 95799523 & 95799527 & 95799533 & 95799541 & 95799551 & 95799553 & 95799559 & 95799569 \end{matrix}

Oldboy
  • 17,264
  • How did you generate this, and why did you use such big numbers? – Daniel Donnelly Oct 20 '18 at 20:56
  • @EnjoysMath Obviously with computer, I can post the code here if you want to play with it. This is the smallest matrix that has 9 rows made of 8 consecutive prime numbers with each row having the same prime gaps as the first one. It’s pretty amazing that all increments in the first column are divisible by 10. – Oldboy Oct 20 '18 at 21:45
  • Yes, pleaes post the code. – Daniel Donnelly Oct 20 '18 at 22:18
1

Here is an example if we are only requiring $A+B$ consist of primes (and not the first $n$ primes).

Let $Q_n=\{a_1,\ldots, a_n\}$ be a set of prime numbers such that $a_i \equiv 1 \pmod {10}$ and $a_{i}+2$ is also a prime. Using a twin prime table, this is easy to obtain. For example, we can let $$Q_{10}=\{11, 71, 101, 191, 281, 311, 431, 461, 821, 881\}.$$ Then let $A=\{1,3\}$ and $B=\{a-1: a \in Q_n\}$, and $A+B$ will consist of exactly 20 primes.

Since there are arbitrarily long arithmetic progressions of primes, theoretically one should be able to make $A$ and $B$ have any size.

Marco
  • 2,743
1

Here's what I've found. I was concentrating more on keeping $\sup(A+B)$ fairly small than on maximising $|A+B|$. \begin{array}{rrllrr} |A|&|B|&A&B&\sup(A+B)&|A+B|\\ 5&5& 5, 7, 17, 23, 37 & 0, 6, 24, 36, 66 &103& 20 \\ 5&5& 7, 11, 17, 29, 31 & 0, 12, 30, 72, 120 &151& 23 \\ 5&5& 11, 17, 29, 31, 37 & 0, 30, 42, 72, 120 &157& 24\\ 5&5& 1, 13, 23, 31, 41 & 6, 30, 66, 126, 150 &191& 25\\ \hline 6&6& 7, 11, 17, 31, 41, 67 & 0, 6, 12, 30, 72, 96 &163& 28 \\ 6&6& 5, 13, 17, 47, 73, 83 & 0, 6, 24, 54, 66, 84 &167& 29 \\ 6&6& 5, 7, 17, 31, 41, 61 & 0, 6, 12, 66, 96, 132 &193& 32 \\ 6&6& 1, 11, 25, 35, 41, 55 & 6, 12, 18, 72, 138, 156 &211& 33 \\ 6&6& 1, 11, 31, 61, 71, 101& 12, 36, 78, 96, 162, 180&281& 34 \\ \hline 7&7& 7, 17, 23, 41, 73, 83, 101 & 0, 6, 30, 66, 90, 150, 156 &257& 35 \\ 7&7& 1, 17, 35, 67, 77, 95, 101 & 6, 12, 36, 72, 96, 156, 162&263& 36 \\ \hline \end{array}

Rosie F
  • 3,231
1

I realize this is quite an old post. With the proper seeding, one should be able to generate a nxn matrix of primes (not all distinct). A bit much to describe here totally, but one solution that generates 164 unique primes is odds= [1,11,17,41,101,1481,3917,14627,27737,118901,111018431,574060031,47357739281] evens= [2,6,12,30,72,156,546,11886,78696,137436,1676610,12618762,168920413410]

I can provide the mechanism in PariGP code. The seeding here was [1,2,6,11].

With the proper seeding, one can likely produce any size though timing really slows after ~ 10x10.