I need to figure out what number base makes the expression 32 + 12 = 28 true. It looks like the second number is signed, I've tried converting to decimal and using 10's complement but haven't gotten an answer that makes sense.
-
1Are these numbers all in the same base, or is 28 meant to be base 10? – tgdavies Sep 02 '21 at 00:55
-
Show us what you've tried so far. Please read the [Open letter to students with homework problems](https://softwareengineering.meta.stackexchange.com/questions/6166/open-letter-to-students-with-homework-problems) – Alexander Sep 02 '21 at 00:55
-
3This seems more like a math problem rather than a request for help with code, so this would be more appropriate for the math stackexchange. That said, this seems impossible if every number is the same base. 32 > 28 in any base, so 32 + 12 > 28 + 12. – BatWannaBe Sep 02 '21 at 00:58
-
1If you can freely assign base, there are multiple solutions. For example 6/4/9, 4/10/9, 7/3/10 would all be valid. The only limitation is that the first cannot go lower than base 4 (it contains a 3), the second cannot go lower than base 3 (it contains a 2) and the sum cannot go lower than base 9 (it contains a 8). – 3limin4t0r Sep 02 '21 at 01:16
-
They're all supposed to be the same base. – afc2020 Sep 02 '21 at 01:18
2 Answers
If this is a positional number system, then you can replace the numerals with an expression showing how their digits multiply by the meaning of their columns.
That is,
"32 + 12 = 28"
≣ (3*R^1 + 2*R^0) + (1*R^1 + 2*R^0) = (2*R^1 + 8*R^0)
≣ (3*R + 2*1) + (1*R + 2*1) = (2*R + 8*1)
≣ (3*R + 2) + (1*R + 2) = (2*R + 8)
≣ 4*R + 4 = 2*R + 8
≣ 2*R = 4
≣ R = 2
For some radix R
.
You can solve this equation to get the value of R. If you attempt to solve it, you'll see that you get R = 2
, which clearly can't be the case, since you have a digit 3
(a base-2 system would only have ... 2 digits. 0, and 1).
Thus, there is no radix R that would allows "32 + 12 = 28"
to encode a valid equation.

- 59,041
- 12
- 98
- 151
-
-
@confusedstudent That's the kind of thing you should mention in your post, so we wouldn't have to waste our time repeating it :P – Alexander Sep 02 '21 at 01:22
On the face of it, it looks impossible. Adding positive integers in any base should result in a larger integer; if the second integer is negative, you end up with 20 = 28 which is clearly impossible. Considered modulo arithmetic? 32 mod 4 is 0, 12 mod 4 is 0, 28 mod 4 is 0, 0 + 0 = 0.

- 206
- 1
- 3