Google as calculator

by brian d foy

Related link: http://www.google.com/help/features.html#calculator



This morning, Adam Turoff pointed me toward a problem posed by Norman Walsh. He wanted to count the permutations of the middle letters of "morning", figuring if we mistyped the word, we would at least get the first and last letters of the word right.

His solution was brute force: simply generate all the possibilities and count them. His solution is pretty ugly because it only works for a fixed number of letters.

This reminds me of statistical thermodynamics though. The number of distinct states is the factorial of the number of elements divided by the number of indistinct elements. In the letters in "ornin", there are 5 ! states (120), but the "n" is duplicated, so there are two indistinct elements. The number of distinct states is then 120 / 2.

Adam tells me that factorials and morning coffee don't mix though. Well, just google " 5 ! / 2".

Adam showed me that I could also get the result in roman numerals.

4 Comments

brianiac
2004-08-26 12:57:38
Other, less documented features of GC
Google also does base and units conversion, and understands a huge number of units.
jbgreer
2004-08-26 17:11:40
and symbols, too
Google also understands


five plus seven minus twelve


Jim G

nwalsh
2004-08-27 03:48:40
Brute force was just to see the answers, not count them
Just for the record, I worked out the number of answer before I wrote the program. The program, crude, non-general, hack though it may be, was written to see the answers not count them.
kavka
2004-08-27 04:58:00
But...
they could also, in a lapse of thinking (or an intended pun), type 'mourning'.