# A Prime Number equation using all nine digits once

Create an equation with the following conditions

1. All numbers must be one or two digit prime numbers

2. You can only use + and - and =
No other math operators

3. You must use all the nine (single) digits (1 to 9) but only once. No repeats of any digits.

• If it works, it also works with only +'s or only -'s. Commented Oct 26, 2023 at 7:47
• Nice puzzle! There are more than nine digits though :-)
– Bass
Commented Oct 26, 2023 at 11:13
• @Bass but you can't use zero. If it's the leading digit it's a no-op, if it's the last digit it's guaranteed not prime. You might get away with it if three digit numbers were allowed. Commented Oct 27, 2023 at 11:43

$$2 + 41 + 83 = 59 + 67$$

Method:
The 4 can only be in 41, 43, 47
The 6 can only be in 61, 67
The 8 can only be in 83, 89

So just permuting those digit pairs by hand on paper, some sets duplicate the digits. In each set there are just a few digits left to organise.

It was just by trial and error with pencil and paper.
First I attempted to balance 4n + 6n = 8n + ?, but no combinations would balance off with the remaining digits.

Then I realised the 4n + 8n = 5n + 6n + ? might work, and it did.

Looking at the digits 4, 6 and 8 since primes cannot end with any of them so we must be using one prime number from each of these groups:
41, 43, 47
61, 67
83, 89

We can look at the remaining digits and try to form primes with them.
41, 67, 83, [2, 5, 9] -> 5 and 29 OR 2 and 59
41, 67, 89, [2, 3, 5] -> 5 and 23 OR 53 and 2
43, 61, 89, [2, 5, 7] -> NOT POSSIBLE
43, 67, 89, [1, 2, 5] -> NOT POSSIBLE
47, 61, 83, [2, 5, 9] -> 2 and 59 OR 5 and 29
47, 61, 89, [2, 3, 5] -> 2 and 53 OR 5 and 23

After that its easy to see that $$41 + 83 - 67 = 59 - 2$$ works

• Just pipped you! Commented Oct 25, 2023 at 16:12
• Not sure that "easy to see" is true. Commented Oct 27, 2023 at 5:16
• It is possible to form primes in the third case: [2, 5, 7] -> 2, 5 and 7. Commented Oct 27, 2023 at 10:03

First off, you will need a minimum of three 2-digit numbers, because none of 1, 4, 6, 8, or 9 is prime, so they will need to be combined with another digit in order to make a prime number.

It quickly becomes evident that if there are three 2-digit numbers, it is impossible to combine them in such a way that they "cancel out", and allow an equation that works with the three much-smaller remaining digits.

Thus it is necessary to create four 2-digit numbers. These numbers will all necessarily be odd, since the only even prime is 2, which is a single digit.

The 2-digit primes can't end with 5, so the only ending digits available are 1, 3, 7, 9.

Any adding or subtracting of four odd numbers will always leave you with an even number, so the single-digit number must be 2.

Then it is just a matter of playing around with a few combinations of two-digit numbers that start with {4, 5, 6, 8} and end with {1, 3, 7, 9} to end up with:

$$67 + 59 - 83 - 41 = 2$$

• What about the option of a pair of equals signs (if that still counts as AN equation)? Commented Oct 26, 2023 at 10:41
• @JeopardyTempest the question specifically says "no programming" so a programming expression == doesn't feel like it qualifies. Commented Oct 27, 2023 at 5:15
• @Mark no I mean like 1+ 2 = 3 = 7-4 (of course not aiming that at a valid solution, but just the idea that it's multiple equal statements, which doesn't seem to be programming) Commented Oct 27, 2023 at 8:09

Late, but without brute forcing combinations:

There are three primes of the form: 4x, 6y, 8z. These numbers can't be single digits and the number cannot end with any of those.

Now

There are 2,3,5,7 as the possible single-digit primes. We get to have 3 of them (1 and 9 are needed with those two-digit primes, along with another one; that another cannot be 2 or 5). Can we balance the equation? We get up to 14 (2+5+7) so 8x+14 is 103 at most, but 4x+6y is 104 at least. So, nope.