Hunt for the 3 primes

Let α \alpha , β \beta and γ \gamma be three different two-digit primes, where the average of any two is a prime, and the average of all three is a prime.

Find α + β + γ \alpha +\beta +\gamma


The answer is 129.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

Bill Bell
Mar 17, 2015

primerange is a generator that, in this case, supplies all of the two-digiti primes. combinations is another generator that, in this case, supplies all of the three-combinations of these primes. The code simply sifts through the combinations to identify any that satisfy the required conditions.

Since the average of any number of two-digit numbers will also be a two-digit number, apart from the decimals, I could have checked whether the averages are primes using table lookup. However, this approach, using isprime seemed more straightforward.

I split the if statement up into pieces in the misapprehension that this would be faster. Of course, if I had put all of the conditions together the interpreter would have stopped executing them as soon as one of them failed.

can u plz tell me the numbers

Tanishq Varshney - 6 years, 2 months ago

Log in to reply

Certainly. They are 11, 47 and 71.

Bill Bell - 6 years, 2 months ago

Is there any mathematical-algebraic solution to this? since the sum of these three primes is 3 times another prime somehow I checked my chance with 43 and it turned out correct :D How awesome am I!!?!

Arian Tashakkor - 6 years, 1 month ago
Sahar Bano
Mar 13, 2020

We wrote this program in python and we got the output as 129

def prime(x):

z=x**0.5

a=1

while (a<=z):

    a+=1

    if (x % a == 0):

        return False

return True

l=[]

for a in range(10,100):

if prime(a)==True:

    l.append(a)

for s in l:

for t in l:

    for u in l:

        if (s!=t) and (t!=u) and (s!=u):

            w=(s+t+u)/3

            q=(s+t)/2

            r=(t+u)/2

            y=(s+u)/2

            if (prime(w)==True) and (prime(q)==True) and (prime(r)==True) and (prime(y)==True):

                print(s+t+u)

Hence the answer is 129

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...