Sum of primes in square

552 Views Asked by At

Is there any series of primes $A=(a_1,a_2,...a_n)$ s.t:

$a_1^2+a_2^2+...+a_n^2=S$

And there is a series $B=(b_1,...b_n)$ which every $b_i\in A$ (Yes, it might be $b_i = b_j$ when $ i\neq j$).

And satisfy $b_1^2+b_2^2+...+b_n^2=S$

Note: $a_i \neq a_j$ when $i \neq j$ but not in B.

One more rule, B cannot be a $A$ in other/same order. Wihch means must be in B at least two element in B that are equal.

EDIT: calrification:

I want to find a group of $n$ different primes, that a the sum of their squares will be equal to the sum of square of another group of n primes, which are subset of the first one, for example:

Lets take 3, 5 and 11. Is there any 3 elements you can take from that group (not all of them) so their square in sum will be $3^2+5^2+11^2=155$? A try can be $(11,11,3)$ but $11^2+11^2+3^2 \neq 155$

Don't know were to start from.. Thanks

2

There are 2 best solutions below

3
On BEST ANSWER

Yes there are such sequences. For example,

$ \begin{align*} 7^2+13^2+17^2&=13^2+13^2+13^2=507\\2^2+ 7^2 +13^2 +17^2&= 2^2 +13^2 +13^2 +13^2= 511\\7^2+11^2+17^2+19^2&=7^2+7^2+19^2+19^2=820 \end{align*}$

Edit: Posting the code I used to generate these.

from itertools import combinations_with_replacement as cwr, combinations as c
primes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97]
for n in range(3, len(primes)+1):
    for x in c(primes, n):
        s = sum(p**2 for p in x)
        for y in cwr(x, len(x)):
            if set(x) != set(y) and sum(p**2 for p in y) == s:
                print(list(x), list(y),s)
                input("Hit enter to continue")
0
On

Simple case when only one element is dubbled in B. For simplicity assume that exists indexes $i,i+1$ for which $a_i=b_i=b_{i+1}$ and $\forall_m\ b_m\neq a_{i+1}$so we can write:

$b_1^2 + b_2^2 + ... + b_i^2 + b_{i+1}^2 + ... b_n^2 = S$

And we can substitute elements $b_m$ to proper $a_m$ as follows

eq.1: $a_1^2 + a_2^2 + ... + a_i^2 + a_i^2 + a_{i+2}^2 + ... + a_n^2 = S$

From definition of A we know that $a_i\neq a_{i+1}$ and

eq.2: $a_1^2 + a_2^2 + ... + a_i^2 + a_{i+1}^2 + a_{i+2}^2 + ... + a_n^2 = S$

Now if we substract eq.2 from eq.1 we get:

$a_i^2 - a_{i+1}^2 = S - S \qquad \Longrightarrow \qquad a_i^2 = a_{i+1}^2$

contradiction!

So if only one element is doubled in B, then you will never get same sume S that you get from A

As Darius shows in his answer if one element appears three times in B or if two different elements are dubbled then you can get similar sum S for A and B