In the new film "Knowing," which opens Friday, Nicolas Cage plays a professor who is given a piece of paper containing a mysterious number code taken from a time capsule at his son's school. He decodes the message and realizes that the numbers accurately predicted past disasters — as well as an imminent apocalypse.

Though the plot is fictional, this scenario has occurred many times in the real world. In 1997 Michael Drosnin published a best-selling book titled "The Bible Code," in which he claimed that the Bible contained a code (hidden in numbers and letters) accurately predicting past world events. Drosnin's work was later refuted, with critics demonstrating that the "meanings" he found were simply the result of selectively choosing data sets from a vast sea of random letters.

Similar "hidden codes" were found in other books such as "Moby Dick" and "War and Peace," demonstrating that any sizeable text can produce such codes if you look long enough.

In psychology, the tendency for the human mind to find coincidences, patterns, and connections in random data is called apophenia.

In statistics, there is even a name for this type of thinking mistake: a Type I error. A common example of a Type I error is a false positive result on a medical test, for instance detecting pregnancy or disease. Physicians often recommend further medical tests to prevent just this type of mistake. Because the first test might have mistaken a random coincidence for a meaningful result, a second or third test is needed confirm the diagnosis.

The premise behind "Knowing" has several roots, including numerology — seeing significance in numbers. Sometimes the significance is said to be lucky (7), unlucky (13), or just somehow evil (666).

After the September 11, 2001 attacks, many people found meaningful coincidence or significance in the number 11, such as that the Twin Towers resembled the number 11, that "New York City" has 11 letters, and that doomed Flight 77 had 65 people on board; if you add 6 and 5 you get 11 (of course if you subtract, divide, or multiply those numbers, you don't get 11). With a little effort and creativity you can find or create whatever significance you like.

"Knowing" also touches on the work of psychiatrist Carl Jung, who proposed a phenomenon he called synchronicity. The idea is that there are hidden connections between the human mind and the outside world, and that two or more events that happen at the same time must be connected in some way. Jung's concept of synchronicity has enjoyed wide popularity, spawning common sayings like "There are no coincidences" and "Everything happens for a reason." There is one small problem with this idea: there's no evidence that it is true. Synchronicity is an interesting concept, but it is not scientifically testable, and therefore lacks proof of its validity.

"Knowing" is only the most recent dose of entertainment capitalizing on themes involving mysterious codes and numbers, including "The Number 23" with Jim Carrey, "The Da Vinci Code," and the TV series "Lost." Mysticism and magical thinking can be dangerous in the real world, but are often interesting in the fictional world.

Benjamin Radford has a degree in psychology and is managing editor of Skeptical Inquirer science magazine. His books, films, and other projects can be found on his website.