96

If you search for "Turn! Turn! Turn!" on Google, then the second result is this YouTube video of The Byrds performing the Pete Seeger song of that name. But the first result is Google's internal calculator displaying "241217.524881". With a bit of experimentation, it appears that this number is a numerical approximation to $$\frac{\Gamma(2\pi+1)^2}{2 \pi},$$ where $\Gamma$ represents the Euler gamma function.

I sort of understand why Google is interpreting "Turn" to mean $2\pi$, and the exclamation mark to mean $x! := \Gamma(x+1)$, as this is a relatively common (although not universal) choice of interpolation of the factorial function to the real numbers. But in that case, I would expect Google to interpret "Turn! Turn! Turn!" to represent $\Gamma(2\pi+1)^3 \approx 18\, 658\, 774\, 329$ instead of the expression above. Why isn't it?

A possible partial solution: if you search "Turn! Turn" then you get the expected result $7735.248 \approx \Gamma(2\pi+1) 2\pi$. But if you search "Turn! Turn!" then you do not get the expected result $\Gamma(2\pi+1)^2 \approx 1\, 515\, 614$. Instead, you get 195.936, which appears to be the numerical approximation of $\Gamma(2\pi+1)/(2\pi)$. Moreover, Google reparses the input as "Turn ! (Turn !)". To me, this suggests that it's interpreting the second explamation mark as a factorial symbol, but the first exclamation mark to mean $a ! b := b/a$, i.e. division but with the usual order of arguments reversed. This explains the orginal result if Google is interpreting "Turn! Turn! Turn!" with the first exclamation mark representing reversed division (with a lower order-of-operations precedence than multiplication) but the second two exclamation marks representing factorial: $$2\pi "!" (((2\pi)!)\ ((2\pi)!)) = \frac{\Gamma(2\pi+1)^2}{2\pi}.$$

Is this notation $a!b := b/a$ standard? I've never seen it before. Can anyone explain how Google is parsing this string?

(This is one of those awkward questions where the (unknown) solution determines whether or not the question is on-topic for Math Stack Exchange. If the solution does indeed come down to unusual math notation, as I suspect, then the question is on-topic for Math SE. But if the resolution is just some black-box machine learning magic, then maybe the question isn't on topic. I'm not quite sure what one does in this kind of situation.)

Henry
  • 169,616
tparker
  • 6,756
  • 3
    For what it's worth, typing just 113!355 does not bring up the calculator at all. – Troposphere Jul 26 '21 at 00:37
  • 2
    Actually directly searching with paranthesis Turn ! (Turn !) i get Turn ! = 195.936116 Turn which makes even less sense than the other results. Searching for Turn ! Turn ! Turn gives the equally confusing Turn ! Turn = 0.159154943 Turn. – Mikael Öhman Jul 26 '21 at 00:57
  • They sing the last "Turn" with a lower note and with less emphasis, as if in the fraction "(Turn!)(Turn!)" over "Turn". – Oscar Lanzi Jul 26 '21 at 01:25
  • It seems google search return result depends on person. If I follow the google search link, the calculator doesn't show up (the first result is the youtube video). – achille hui Jul 26 '21 at 02:01
  • 4
    Just tried *Fun! Fun! Fun!* but only got a Beach Boys' song... – J.-E. Pin Jul 26 '21 at 02:38
  • 7
    In case it changes later, it's worth noting that the calculator interpreted "Turn! Turn! Turn!" as "(Turn ! (Turn !)) (Turn !)". – Mark S. Jul 26 '21 at 13:20
  • 5
    When I do a google search on "(Turn ! (Turn !)) (Turn !)" the calculator returns the (sort of expected) result \begin{align} &\text{(Turn ! * (Turn !))* (Turn !)}=\ 1&865877328.74\ . \end{align} So the insertion of the parentheses in the search term changes the way it gets interpreted. – lonza leggiera Jul 27 '21 at 05:23
  • Maybe the Google calculator is limited and somewhat erroneous? (turn!)! gives undefined. – Lehs Jul 28 '21 at 02:46

1 Answers1

77

It appears that Google search uses the following syntax for conversions between different units or currencies: target_unit! <expression> (Though I can't find any documentation for this). For example, searching for cm! 1m + 5 yards yields 557.2 centimeters. Interpreting a turn to be a dimensionless quantity equal to $2\pi$, we can try to make sense of the results:

  • Turn ! (Turn !) means "calculate $\text{Turn}!$ and express it in the unit turn", which comes out to $\frac{\Gamma(2\pi +1)}{2\pi}\text{ Turn}$, or approximately $195.936116 \text{ Turn}$ (as observed by Mikael).
  • Turn! Turn! Turn! is interpreted as (Turn ! (Turn !)) * (Turn !), where we make the calculation from the previous bullet point and are left with a product of something in the unit turn and a number, which Google evaluates by throwing away the unit information in the first term and calculating the product of the two numbers. Hence, we end up with $\frac{\Gamma(2\pi+1)}{2\pi}\cdot \Gamma(2\pi+1)$ as the result.
Markus
  • 833
  • 9
    You've cracked the case. So I was right that Google is effectively interpreting a!b to mean $b/a$, but you figured out why: Google's trying to do a unit conversion. – tparker Jul 29 '21 at 02:05
  • 2
    One very minor correction to your second bullet regarding the reason why Google's throwing away the unit information. Google actually keeps the unit when you multiply a united quantity by a dimensionless number.... – tparker Jul 29 '21 at 02:07
  • 2
    ...However, Google's messing up the units of Turn ! (Turn !). It should indeed be $\Gamma(2\pi+1)/(2\pi)$ Turn as you say, but Google's mistakenly thinking that it's $\Gamma(2\pi+1)/(2\pi)$ rad instead. Moreover, for some reason it's interpreting Turn ! not to be just $\Gamma(2\pi+1)$, but instead $\Gamma(2\pi+1)$ rad (i.e. it's bringing forward the unit of the argument). So Google mistakenly believes that (Turn ! (Turn !)) * (Turn !) is the product of two quantities with the unit of radians. And it's easy to verify that when you multiple two quantities with the unit of radians ... – tparker Jul 29 '21 at 02:19
  • 2
    ... together, Google's algorithm just discards the units (because radians$^2$ isn't really a very meaningful unit). So these two errors - Google's mistakenly assigning the unit of radians to two different quantities that shouldn't have that unit - conveniently cancel either other out. – tparker Jul 29 '21 at 02:22
  • 2
    One potential correction – you said that "It appears that Google search uses the following syntax for conversions between different units or currencies: target_unit! <expression>" However, I'm not sure that ! is actually playing any significant role; I think it's just being discarded. You point out that "cm! 1m + 5 yards yields 557.2 centimeters", but I get the same result for cm 1m + 5 yards, cm] 1m + 5 yards, and cm' 1m + 5 yards … it looks like Google is just tossing out some symbols that it can't incorporate into the expression. – codesections Jul 30 '21 at 16:03
  • @codesections Great observation, although unfortunately it does seem to un-settle the resolution a bit. If you take out the first exclamation mark, the search doesn't return the calculator at all. And confusingly, if you enter Google's own internal parsing verbatim, then you get a different answer! (The expected $\Gamma(2\pi+1)^3$ answer.) So unfortunately, the details of Google's parsing may still remain a bit of a black box after all. – tparker Jul 31 '21 at 17:02
  • 1
    I'd also dispute the unit! expression format - Googling gbp! 100 usd shows conversion from pounds to dollars, not the other way round – M. Volf Aug 01 '21 at 10:34