First Contact Math

First Contact situations with Starfish Aliens have an inherent problem -- since the aliens are so incomprehensible, how will you even realize that they're intelligent? For that matter, how can you convince them that you are?

The generally accepted universal signal of intelligence in this situation is the ability to produce a sequence of prime numbers. If the aliens have math, they'll get this -- it's an aspect very closely tied to resource allocation, which is one of the first tricks any intelligent group has to figure out. You see, prime numbers are only divisible by the number one and themselves; for example, seven rocks cannot be divided up into any whole number of equal groups of rocks without breaking them. It doesn't matter what number base you are using or what you call the numbers; seven rocks (• • • • • • •) will always be the same, observable amount.

More generally, anything obviously recognizable as simple math, such as the Fibonacci sequence or proof of the Pythagorean theorem, can serve the same function. Whatever you choose, the point is to present a sequence of numbers that wouldn't arise by pure chance from a natural system, yet would still be simple enough to be understood by any intelligent group as non-random.

While this is generally accepted in fiction, some philosophers of mathematics speculate that mathematics as we know it might be a solely human affair. Actual mathematicians aren't so impressed with this idea. Physical scientists don't think much of it either.

On the surface, this can look like a test designed to weed out the non-educated. But unlike the Only Smart People May Pass trope, which happens in the context of a pre-created puzzle or situation, the entire point of First Contact Math is that it provides the best hope we might have of communicating without any established context at all.

"Prime Numbers and the Search for Extraterrestrial Intelligence", by Carl Pomerance, is an academic paper which discusses the idea in depth.

Comic Books

 * Life on Another Planet (1978) by Will Eisner. An artificial radio signal from Barnard's Star listing prime numbers (although the term "prime" is never used in the story) is received at the Mesa Radio Astronomy Observatory.

Literature
"Cargill and Horvath's team worked together to answer the pulses. One, two, three, four blinked the light, and Cargill used the forward batteries to send five, six, seven. Twenty minutes later the light sent three one eight four eleven, repeated, and the ship's brain ground out: Pi, base twelve. Cargill used the computer to find e to the same base and replied with that. But the true message was, We want to talk to you. And MacArthur's answer was, Fine. Elaborations would have to wait."
 * Contact: The alien transmission begins with a sequence of prime numbers, before continuing on to more useful mathematics and science. The novel by Carl Sagan (who also championed the use of primes in this context in Real Life SETI) makes considerably more of this, also using prime numbers in the encoding of the more complex layers of the transmission.
 * In Schild's Ladder by Greg Egan, the protagonists realize that there's intelligent life inside a pseudovacuum when they notice that a series of pulses coming from it represent consecutive prime numbers.
 * In Arthur C. Clarke's novel version of 2001: A Space Odyssey, Dave Bowman tries (unsuccessfully) to talk to the Iapetus monolith by broadcasting primes at it.
 * Tom Swift: Tom Swift Jr. and his father communicate with some aliens by sending mathematical symbols at them (and vice versa) throughout his entire series. Exactly what is meant by "mathematical symbols" is never made particularly explicit.
 * The Barbara Hambly novel The Silicon Mage shows Antryg and Joanna communicating with an extra-dimensional via Pi and Planck's Constant.
 * The Action Hero's Handbook has a chapter on communicating with extraterrestrials, and suggests starting with basic concepts like numbers and shapes because the authors of the book believe that no matter how alien the culture is, they would still be able to have dialogue about that, especially if they're able to go into space.
 * This fails in Calculating God by Robert J. Sawyer; transmissions to Delta Pavonis go unnoticed by the native Wreed, because the Wreed have a brain structure that makes them incapable of doing math. (They can automatically recognize numbers of up to 46, and that's it.) They are very good at ethical problems and analog simulations, though. The Forhilnor also admit that they were astonished to find a civilization on the Wreed homeworld, but stoutly defend their intelligence, noting that the Wreed build beautiful cities out of the sparse available materials there.
 * In C. J. Cherryh's Chanur series, when the human Tully is cornered by the felinoid Hani, he writes out (in his own blood) numbers from zero on up. When he gets to 10 they realize that he might be using a positional notation system.
 * Used, then subverted in the series beginning with Emprise. An alien transmission is recognized and eventually translated into a simple depiction of the aliens and their system. However, one mathematician claims to have found many more levels of meaning embedded in the message, a la The Bible Code. Ultimately, it turns out that these new levels are the product of his overactive imagination.
 * Double subverted in that the message turns out to be from
 * The alien ship in Anathem has a proof of the Pythagorean Theorem on its hull for this reason.
 * Larry Niven and Jerry Pournelle's The Mote in God's Eye has the human exploration party and the Moties use this method for initiating communications:


 * In the French novel Ceux de nulle part, the protagonist tries to communicate with an alien by using basic math and fails. Then again, normal physical laws do not seem to apply to said alien.
 * The Polish short story "Koła na piasku" by Adam Pietrasiewicz parodies this: a human and an alien talk to each other friendlily by radio before realizing what the other is. They immediately proceed to follow the "standard first contact procedures"; the human draws a Pythagorean triangle, while the alien draws some squiggly lines. They then go back to their vehicles and complain by radio that they can't comprehend what the other one drew (and none of them knows math very well, so they don't even know what they drew, only that they were told to draw them).
 * The Murderous Maths book discussing the properties of numbers discusses this trope.
 * In H.G. Wells' The First Men in the Moon, Cavor discusses using math to communicate with his alien captors, but he doesn't really have any idea how to do so.
 * In a related "First Contact Chemistry", in James P. Hogan's Inherit the Stars the key to deciphering an alien language comes when someone recognizes a Periodic Table of the Elements in an alien book.
 * H. Beam Piper's short story "Omnilingual" is an earlier example of the Periodic Table as universal key. It helps that the Martian language tends to make new words by combining existing ones, so that (for example) the word for "metal" is part of the names of various metallic elements.
 * In Michael Crichton's Sphere this is the way Harry manages to first make meaningful contact with the mysterious alien presence.
 * In The Andromeda Affair the aliens are transmitting a sequence of bits whose length is the product of two primes. The hero assumes correctly that this implies the bits should be arranged in a two-dimensional grid to be understood.

Live Action TV
"Exposition Guy: I was a scientist before I became a bad actor. I know what that number means. Other Character: Well? What is it? Exposition Guy: It's... pi."
 * In the Farscape episode "Through The Looking-Glass", Crichton realizes an extradimensional being is trying to communicate with them rather than hunt them when he sees that each group of talon slashes that it makes is prime.
 * In the Star Trek: The Next Generation episode "Allegiance", Picard is kidnapped by unknown aliens; he attempts to convince them that he's intelligent by repeatedly tapping out the first six prime numbers.
 * In an episode of Star Trek: Voyager, an alien species living on a planet where time moves extremely fast attempt to communicate with the Voyager (or, as they call it, the Sky Ship) via radio by using prime numbers and universal constants. Since, by the time they receive and recognize the signals, the scientist who sent them is long dead, the Voyager crew don't bother responding.
 * Subverted in an episode of Babylon 5. A probe sent out by an advanced species containing mathematical riddles appears to be this at first... until it's found out the thing's actually a way for the isolationist species to figure out which other races are a threat and destroy them. Fortunately, the probe's fairly stupid.
 * In the Close Encounters of the Third Kind parody short Closet Cases Of The Nerd Kind, which features aliens coming down to Earth and hitting people in the face with pies for no apparent reason, some researchers keeps receiving the number 3.14159 and don't understand why. Finally, one character speaks up.

Video Games

 * In Rama (based on the novel Rendezvous With Rama), the Ramans put many math-based obstacles in your path, presumably for this reason.

Web Original

 * In Fine Structure, "Eka", AKA "The Script", starts out from prime numbers and works its way up to describe the entire physics of the universe.

Other

 * Parodied in The Onion: Earth Contacted By Extraterrestrial Nerds.

Real Life

 * The paper by Carl Pomerance, in case you missed it in the description.
 * Space probes (like Pioneer 10) we sent out of the Solar System usually contain this in some form.
 * Lincos is one possible example of how to extend the message into actual communication, building up to a complete language from only the natural numbers (fiction, being written by writers, usually skips this bit).
 * The notion mentioned above for The Andromeda Affair ("a repeating sequence with a period that is the product of two primes is an indicator that it represents a rectangular grid") is not a stunning leap of logic for anyone familiar with SETI, since it's been used in human broadcasts as well.