There is some pleasure in finding a universal solution to a class of problems that people pass around. Here is one of them.

You have probably seen mathematical puzzles of this type before. Someone gives you a few numbers and asks to place arithmetic and “other mathematical signs” between or around them so that the resulting expression is evaluated as some target number.

For example, if the numbers are **2**, **3**, **4**, and the the target is **10**, one of the solutions might be:

**10 = –(2-3*4)**

Or this:

**10 = 2*3 + 4**

Here I would like to present a general solution that works for all problems of this class, provided that mathematical signs include elementary analytic functions and all numbers are integers.

Let’s start with the core relation between hyperbolic functions (https://en.wikipedia.org/wiki/Hyperbolic_function):

**Cosh ^{2}(x) – Sinh^{2}(x) = 1**

From that, the relation between the inverse hyperbolic functions immediately follows:

**Cosh(ArcSinh(x)) = √(1+x ^{2})**

Using **x** = **√k**, one arrives then to formula that converts **k** into **k+1**:

**Cosh(Arcsinh(√k)) = √(1+k)** (1)

By applying that formula repeatedly as many times as needed, we can increment integers. For example:

Cosh(Arcsinh(Cosh(Arcsinh(Cosh(Arcsinh(Cosh(Arcsinh(Cosh(Arcsinh(**2**)))))))))) = **3**

(you can check that with a calculator)

The rest is easy. We just apply that formula to one of the input numbers, and play it as many times as needed to produce the target.

What do you do with other numbers? You decrement them away to zeros with a reverse of formula (1):

**Sinh(Arccosh((√k)) = √(k-1)** (2)

So, for instance, if you wanted to make **10** out of numbers **8**, **3**, **5**, **2**, you would’ve written:

**10** = Cosh(Arcsinh(…(Cosh(Arcsinh(**8**)))…)) + Sinh(Arcсosh(…(Sinh(Arcсosh(**3**)))…)) + Sinh(Arccosh(…(Sinh(Arccosh(**5**)))…)) + Sinh(Arccosh(…(Sinh(Arccosh(**2**)))…))

— where the first pair of calls is repeated **36** times, the second **9** times, the third **25** times, and the last one **4** times.

Obviously, further optimizations are possible, but the solution is complete at this point.

Have a nice day,

Eugene