# An odd form of math

Long ago (The year of 1350 BC), the aliens found the Earth. They saw our math, and tried to learn it. They completely failed at it, but the humans adopted their form of math. Now, in the year 2050 AD, we have discovered the original math. These sample problems were provided (Numbers converted to Arabic Numerals):

5 + 5 = 7

8 + 6 = 10

5 - 8 = 13

5 ! 5 = 0

7 ! 5 = 2

123 - 7 = 130

30 + 40 = 50

18 / 7 = 11

7 / 3 = 4

30 * 2 = 60

4 * 6 = 24

5,5 - 1,5 = 4

3,4 - 3,4 = 0

5 - 3,5 = 1,5

The scientists have figured out what these all mean. They also discovered some more operation, with one parameter:

^ 4 = 2

^^ 256 = 4

^ 6 = 2

^ 81 = 9

^^^ 256 = 4

5! = 4

4! = 3

78!!!!!!!!!!! = 67

But then, the scientists found a text. It said (When translated from alien hieroglyphics):

There are 184 sheep. The farmer sells 18, and uses the money to buy 6. He puts them in a large square array. All extra are sold to an inventor, who buys 4 more. He gives a quarter of them to his brother, and then a third of the remaining to the farmer. How many sheep does the farmer now possess?

You are a mathematician. Interested in how the ancient people did math, you decide to solve the problem. What is the equation to solve this problem? Shortest answer gets checkmark.

• Two questions. (1) Are you absolutely sure that the operator in the last three lines of the first block should be - rather than, say, !? (2) Is the final text actually correct, given that it seems to call at the end for fractional sheep? – Gareth McCaughan May 10 '18 at 18:22
• You haven't given us any notion of commutativity or ordering on these operations. Should we use parentheses to indicate order, or are they necessarily always applied left-to-right? – Ian MacDonald May 10 '18 at 18:22
• You've noted that ^^256=4, and ^4=2. It's possible that there's more to get, but that would certainly imply to me that ^^^256 should be 2, and not 4. Can you double-check? – GentlePurpleRain May 10 '18 at 18:47
• Has a correct answer been given? If so, please don't forget to $\color{green}{\checkmark \small\text{Accept}}$ it. If not, some further guidance to the answerer to help steer him in the right direction would be helpful. (A self-answer, at this point, wouldn't be all that out of line either.) – Rubio May 23 '18 at 7:57

Except for one, these operations seem to correspond directly to familiar operations, but just use different symbols.

Binary operators

• $+$ seems to be a short form of the Pythagorean theorem: $x+y=z$ means that $x^2+y^2=z^2$, or, more accurately $z=\lfloor\sqrt{x^2+y^2}\rfloor$ (in our notation)
• $-$ means addition ($+$), except for non-whole numbers, where it means subtraction ($-$)
• $!$ means modulo (thanks oMiKeY)
• $/$ is subtraction ($-$)
• $*$ is multiplication ($\times$)

Unary operators

• $^\wedge$ means square root, or, more accurately, $^\wedge x$ means $\lfloor\sqrt x\rfloor$
• $!$ is simply a decrement operator, so $x!$ means $x-1$

To solve the problem:

To start, let $x = (184\ !\ 18) - 6$
Then the sheep the farmer puts into the array is
$^\wedge x *\ ^\wedge x$
and what is given to the inventor is
$x\ !\ (^\wedge x *\ ^\wedge x)$

The investor gets 4 more
$(x\ !\ (^\wedge x *\ ^\wedge x)) - 4$

We don't seem to have a division operator, so the best we can do is multiply by a fractional number. By giving away a quarter of the sheep, the investor is left with $\frac34$. One third of that is $\frac14$. Thus we simply need to multiply the investor's sheep by $0.25$.

So the investor gives $((x\ !\ (^\wedge x *\ ^\wedge x)) - 4) * 0.25$ sheep back to the farmer.

The farmer therefore has his original $^\wedge x *\ ^\wedge x$, plus the $((x\ !\ (^\wedge x *\ ^\wedge x)) - 4) * 0.25$ given back to him by the investor.

We don't have an addition operator for non-whole numbers, so all we can do is subtract a negative number.

let $y = ((x\ !\ (^\wedge x *\ ^\wedge x)) - 4) * 0.25$

then negative $y$ is $y - 2y$

so adding $y$ is the same as subtracting $y-2y$

This means
$^\wedge x *\ ^\wedge x - (y - 2y)$
is the final number of sheep belonging to the farmer.

Replacing $y$, we get
$^\wedge x *\ ^\wedge x - ((((x\ !\ (^\wedge x *\ ^\wedge x)) - 4) * 0.25) - 2(((x\ !\ (^\wedge x *\ ^\wedge x)) - 4) * 0.25))$

Then replacing $x$, we get
$^\wedge ((184\ !\ 18) - 6) *\ ^\wedge ((184\ !\ 18) - 6) - ((((((184\ !\ 18) - 6)\ !\ (^\wedge ((184\ !\ 18) - 6) *\ ^\wedge ((184\ !\ 18) - 6))) - 4) * 0.25) - 2(((((184\ !\ 18) - 6)\ !\ (^\wedge ((184\ !\ 18) - 6) *\ ^\wedge ((184\ !\ 18) - 6))) - 4) * 0.25))$

There may be ways to simplify that, but it should give the correct answer.

• I suspect that either ! or / (probably /) is intended to be "remainder". – Gareth McCaughan May 10 '18 at 20:50
• It could be (that would make some of the calculations easier). If so, though, the examples chosen were poor, since they also all fit with subtraction. – GentlePurpleRain May 10 '18 at 21:01
• ! in this case is modulo, which indeed gives the remainder of division. In programming we use the symbol %, thus 13 % 5 = 4. I think we can deduce here that since / is subtraction, ! must be modulo, as the two being the same would be odd on any planet. – omikes May 10 '18 at 21:15
• @oMiKeY Even if we are confident that one of the operations is subtraction and the other is remainder, we have no evidence to tell us which is which. My guess was the other way around from yours because of the similarity between "-1" and "-". – Gareth McCaughan May 10 '18 at 21:48
• Clearly you mean 0,25 :) – Rubio May 10 '18 at 23:14