Average Primes

Cerebral distractions of every kind, mostly but not exclusively Countdown-related.

Moderator: Michael Wallace

Post Reply
User avatar
Joseph Bolas
Fanatic
Posts: 2446
Joined: Mon Jan 21, 2008 9:19 am
Location: Liverpool, UK

Average Primes

Post by Joseph Bolas »

I'm not good at solving these puzzles so lets try setting one :lol:. Hope this ain't too easy.

Find three different two-digit primes, where the average of any two is a prime, and the average of all three is a prime.
Conor
Series 54 Champion
Posts: 541
Joined: Mon Jan 21, 2008 7:29 am
Location: Luton - UK

Re: Average Primes

Post by Conor »

I eventually gave up on this, so I wrote a program to solve it. The result: No solutions. :o

Nevermind, I've removed the faulty 6 characters and I see the solution. I won't reveal it for anyone who wants to get it 'properly'.
User avatar
Charlie Reams
Site Admin
Posts: 9494
Joined: Fri Jan 11, 2008 2:33 pm
Location: Cambridge
Contact:

Re: Average Primes

Post by Charlie Reams »

Is there actually any attack on this except brute force?
User avatar
Joseph Bolas
Fanatic
Posts: 2446
Joined: Mon Jan 21, 2008 9:19 am
Location: Liverpool, UK

Re: Average Primes

Post by Joseph Bolas »

Charlie Reams wrote:Is there actually any attack on this except brute force?
I believe this a trial and error type puzzle, but to make it more solveable I will give a hint towards the numbers. Imagine if the answer was 13, 29 and 67, these numbers are made up of 6 different digits (1, 2, 3, 6, 7 and 9). The 3 numbers you are after are only made up of 3 different digits.

Hopefully that has made it easier to solve, but not too easy.
Paul Howe
Kiloposter
Posts: 1070
Joined: Tue Jan 22, 2008 2:25 pm

Re: Average Primes

Post by Paul Howe »

Charlie Reams wrote:Is there actually any attack on this except brute force?
I think you can reduce the search space by saying that all the primes have to be congruent mod 4, to ensure the average of any 2 is odd, and congruent mod 3 to ensure the average of all 3 is an integer. Unless I'm missing something clever, it's just brute force after that.
User avatar
Joseph Bolas
Fanatic
Posts: 2446
Joined: Mon Jan 21, 2008 9:19 am
Location: Liverpool, UK

Re: Average Primes

Post by Joseph Bolas »

If I give youse one of the 2-number averages then it should make it easier to solve, right?

One of the averages is 29.
Howard Somerset
Kiloposter
Posts: 1955
Joined: Mon Jan 21, 2008 9:02 am
Location: UK

Re: Average Primes

Post by Howard Somerset »

I looked at this problem during lunch today, and did work out a strategy which comes to a solution with not too much brute force or trial and error. Not time to give my method now, as the forum's due to go down in just over five minutes. I'll post again later when it's back up and running.

Briefly, though, I was concentrating on the units digits of the numbers involved, and the number of different combinations to try was much lower than I expected.

Nice puzzle, Joseph.
Howard Somerset
Kiloposter
Posts: 1955
Joined: Mon Jan 21, 2008 9:02 am
Location: UK

Re: Average Primes

Post by Howard Somerset »

I guess the upgrade's been done now. So here's my method. It probably takes less time to do than to read.

My method starts by considering only the final digit of the primes involved.

Any prime beyond 5 must end with 1, 3, 7 or 9. When we combine any two of our three, we cannot total a multiple of 10, otherwise their average would not be prime. This means that our three numbers cannot have three different final digits. (Otherwise we’d have a 1 combined with a 9, or a 3 combined with a 7.) We must therefore have at least two of our primes ending with the same digit.

Now let’s suppose those two primes both end in 9. What are the possibilities for the third prime? It can’t end in 1, because we can’t combine 9 with 1. It can’t in 7, because that would give a total ending in 5, yielding an average, if it is an integer, ending in 5. Therefore we’d need three 9s or two 9s and a 3.

Similar reasoning works if the two primes end in 7, or in 3. or in 1.

Now, let’s see what possible pairs of 9s we can have. Primes ending in 9 are 19, 29, 59, 79, 89. But before trying all 10 possible pairs, we can eliminate a lot of the work by a little more thought. Two numbers ending in 9 will have an average ending in 4 or 9. In order for the average to end in 9, which we need, the penultimate digits of the two numbers must either be both odd, or both even. We therefore only need to look at 29 with 89, or any two from 19, 59 79. And that’s the first very brief bit of brute force. Only the 29 and 89 pairing yields a prime average.

Similar reasoning can then be applied to pairs of 7s, pairs of 3s and pairs of 1s. We get one pair of 7s, two pairs of 3s and one pair of 1s.

Can we have three numbers ending in 9 for our final solution? No. Because this would mean we’d need three pairs of 9s yielding a prime average. Similarly we can’t have three numbers ending in 7, or in 3, or in 1.

Now back to the 9s again. For the solution to be based on two 9s, we now know that the numbers must be 29, 89 and a prime ending in 3. Primes ending in 3 are 13, 23, 43, 53, 73, 83. But once again we don’t need to check them all against 29 and 89. We only need to check those whose penultimate digit is odd, otherwise the average, when combined with 29 or with 89 will end in 6. Brute force again – just three to try – shows that 29, 89 and 53 is a possible set.

Similar reasoning gives just three other possible sets from pairs of 7s, pairs of 3s, and pairs of 1s.

The final bit of brute force involves looking at each of the four sets of three to see which has a prime average. Sure enough only one does, and that is the solution.
User avatar
Joseph Bolas
Fanatic
Posts: 2446
Joined: Mon Jan 21, 2008 9:19 am
Location: Liverpool, UK

Re: Average Primes

Post by Joseph Bolas »

Howard Somerset wrote:I looked at this problem during lunch today, and did work out a strategy which comes to a solution with not too much brute force or trial and error. Not time to give my method now, as the forum's due to go down in just over five minutes. I'll post again later when it's back up and running.

Briefly, though, I was concentrating on the units digits of the numbers involved, and the number of different combinations to try was much lower than I expected.

Nice puzzle, Joseph.
I must admit, when I first solved this one, I just did a trial and error thing. I started with one number and then took all possible combinations of that 1 and the other prime numbers and then saw which pairs averaged out as a prime.

Then I took those prime-averaging pairs and them added a 3rd prime to each to see which set of three averaged to a prime. Once I had done that I checked to make sure that the other 2-prime pairs of that set of three averaged to a prime also.

It didn't take me long (going from the number I first started with) to find a set of 3 that worked. With these types of puzzles there is normally only 1 solution, which I am hoping is what everyone else is getting :),
Gavin Chipper
Post-apocalypse
Posts: 13194
Joined: Mon Jan 21, 2008 10:37 pm

Re: Average Primes

Post by Gavin Chipper »

Did we get an answer to this?
User avatar
Joseph Bolas
Fanatic
Posts: 2446
Joined: Mon Jan 21, 2008 9:19 am
Location: Liverpool, UK

Re: Average Primes

Post by Joseph Bolas »

Howard has explained how to work it out step by step, but I think because theres quite a bit of bruce force required to solve this, most have decided not too. I think it was harder than I implied :oops:.
Gavin Chipper
Post-apocalypse
Posts: 13194
Joined: Mon Jan 21, 2008 10:37 pm

Re: Average Primes

Post by Gavin Chipper »

Joseph Bolas wrote:Howard has explained how to work it out step by step, but I think because theres quite a bit of bruce force required to solve this, most have decided not too. I think it was harder than I implied :oops:.
But what is the answer?
User avatar
Joseph Bolas
Fanatic
Posts: 2446
Joined: Mon Jan 21, 2008 9:19 am
Location: Liverpool, UK

Re: Average Primes

Post by Joseph Bolas »

Gevin-Gavin wrote:
Joseph Bolas wrote:Howard has explained how to work it out step by step, but I think because theres quite a bit of bruce force required to solve this, most have decided not too. I think it was harder than I implied :oops:.
But what is the answer?
The answer is 11, 47 and 71:

(11 + 47) / 2 = 58/2 = 29
(11 + 71) / 2 = 82/2 = 41
(47 + 71) / 2 = 118/2 = 59

(11 + 47 + 71) / 3 = 129/3 = 43
Post Reply