http://en.wikipedia.org/wiki/47_(number)
Fortyseven has been the favorite number of Pomona College, California, USA, since 1964. A mathematical proof, written in 1964 by Professor Donald Bentley, supposedly demonstrates that all numbers are equal to 47.[4] However, Bentley offered it as a "joke proof" to further a popular student research project that listed real and imaginative "47 sightings". Bentley used the invalid proof to introduce his students to the concept of mathematical proofs.[5]
Joe Menosky graduated from Pomona College in 1979 and went on to become one of the story writers of Star Trek: The Next Generation. Menosky "infected" other Star Trek writers with an enthusiasm for the number 47.

The joke transcends Trek, also showing up in J.J. Abrams shows from
Alias to
Fringe (so it's an interesting convergence that he ended up doing Trek).