Is it possible to add two numbers using the min() and max() functions??

81 Views Asked by At

Consider two whole numbers $A$ and $B$. Given $A$ and $B$ are hexadecimal (i.e. have base $16$) and our single digit, is it possible to add the two numbers using the min() and max() functions only? There's also the NOT gate (which I want to prevent using), since there a

$$\min(A,B) - {\rm The~ lower~ value~ of}~ A~ {\rm and}~ B$$

$$\max(A,B) - {\rm The~ larger~ value~ of}~ A~ {\rm and}~ B$$

Motivation:- I was playing Minecraft and came across something called 'Hexadecimal Logic Gates', specifically the AND and OR gate. In binary, AND has an output of 1 if both inputs are 1. OR has an output of 1 as long as any/both inputs are 1. But in this weird hex variant, AND gives you the min of the two values, and OR gives you the max of the two values. Now, I thought, is it possible to build an adder using them, similar to how using binary gates you can build adders? However before I could build it, I need an algorithm. And it must use min() and max(). There's also the NOT gate (which I want to prevent using) since there already exists a design using it.

1

There are 1 best solutions below

0
On BEST ANSWER

This is not possible. If we have two numbers $A$ and $B$ and unlimited ability to use the $\min$ and $\max$ functions, the only numbers we can ever attain are $A$ and $B$. Since $A + B$ is sometimes neither $A$ nor $B$, we cannot achieve this value in these cases.