Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I read that $$10\frac{\exp(\pi)-\log 3}{\log 2} =318.000000033252\dots \approx 318$$

Is this simply a coincidence or can this somehow be explained?

share|cite|improve this question
It seems a little contrived. It would have been approximately 31.8 except for the factor of 10 in front of it. You could take any decimal with a long string of zeros anywhere in it, multiply by the appropriate power of 10, and get a similar result. – Austin Mohr May 18 '12 at 1:24
They probably just computed every combination of $a \frac{\exp(\pi) ± \log b}{\log c}$ (where a, b, and c are small integers) and picked the best one. – Dan May 18 '12 at 1:30
@Dan, if you calculate that expression for all $a,b,c$ from 1 to 10 (ignoring division by zero), you get 2000 expressions, so I'd expect one of them to be within $.0005$ of an integer---but this is much closer than that. – Gerry Myerson May 18 '12 at 2:07
Sometimes stuff like this has an explanation. See here for a (related?) example:… – Alex R. May 18 '12 at 6:43
@GerryMyerson The number of expressions is much, much larger if you allow yourself a wider range of combinations - e.g. here we have three unary operations and three binary operations. All possible combinations of these with a reasonably sized set of operations (e.g. +, -, *, /, exp, log and trig functions) with all integer arguments in 1..10 might (I haven't checked) easily generate the 10^8 expressions required to see a result this close to an integer. – Chris Taylor May 18 '12 at 9:17
up vote 7 down vote accepted

Here's one answer. The expression you wrote contains three binary operations and four unary operations. This becomes more obvious when you view the parse tree:

 |      |
id     (/)
 |      |
10   --------
     |      |
    (-)    log
     |      |
   -----    2
   |   |
  exp log
   |   |
   pi  3

We can count how many similar expressions there are, and see what the probability that one of them is that close to an integer is. This will give us an idea of whether the result is due to chance or not.

To be concrete, we restrict ourselves to the four binary operations $+$, $\times$, $-$ and $\div$ in any combination, and say that the leaves of the trees can be any of the numbers $1,2,\dots,10$ or $\pi$, optionally combined with one of the operators $\exp$, $\log$ or $\mathrm{id}$ (the identity function). We'll discount the expressions that are obviously integers , such as $1+(2+(3+4))$, but that won't be very many expressions compared to the total.

Then it becomes a simple counting argument. Every expression is represented as a binary tree with values at the leaves. There are 33 possible leaf values (11 numbers $\times$ 3 operators) and 4 possible values at each node.

There are three nodes in the tree and 4 leaves, and there are 5 possible binary trees with three nodes. Therefore the total number of expressions is

$$4^3 \times 33^4 \times 5 \approx 3.8 \times 10^8$$

Therefore, to a very rough approximation we can say that we would expect there to be one expression that was within

$$1/(3.8\times 10^8) \approx 2.6\times 10^{-9}$$

of an integer. Since your example is only within $3\times 10^{-8}$ of an integer, I feel fairly confident in saying that it is due to pure chance (or someone with a lot of time on their hands) and there isn't necessarily a deeper explanation for it.

share|cite|improve this answer
I think it's wrong to say the expression written contains four unary operators and one of them is $\mathrm{id}$. What justification do you have for introducting that? Also, you never actually discounted the expressions you promised, and furthermore there's a great deal of redundancy you haven't anticipated - e.g. every time you use an addition or multiplication operator, the order of the arguments is irrelevant, so many of your trees are really the same. – Ben Millwood Aug 11 '12 at 10:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.