Real-world applications of prime numbers? I am going through the problems from Project Euler and I notice a strong insistence on Primes and efficient algorithms to compute large primes efficiently. 
The problems are interesting per se, but I am still wondering what the real-world applications of primes would be. 
What real tasks require the use of prime numbers?

Edit: A bit more context to the question:
I am trying to improve myself as a programmer, and having learned a few good algorithms for calculating primes, I am trying to figure out where I could apply them. 
The explanations concerning cryptography are great, but is there nothing else that primes can be used for? 
 A: Primes are also useful for generating hash codes.
A: Like yourself, I got into primes since this was a common exercise program to do when learning new programming languages and it was interesting to see which language was faster on the same algorithm/error check plan.
It was only when I was refining my Ada coded program to get the highest number of primes that I could get from a 32-bit machine that I came across the offset logarithmic integral.
(I needed to reserve enough - but not too much - memory for my holding array for the primes. The array, of course, had to be declared prior to making any assignments to it. On a 1 GB memory 32-bit machine, I can get primes up to ~ 50 million before stack blows.)
$${\rm Li} (x) = \int_2^x \frac{dt}{\ln t}$$  
This function represents the best approximation to the number of primes up to some number, x.
All I'm saying here is that this equation made me wonder about primes in the context of a number of other things that use related functions . . . 
That led me on to thinking about entropy calculations, particularly about selecting compositions more likely to give rise to metastable crystal forms - possibly even glasses - than other compositions using the same constituent elements.
A: Uniform usage of gears with relatively prime number of teeth
Straight from Wikipedia:

For a long time, number theory in general, and the study of prime numbers in particular, was seen as the canonical example of pure mathematics, with no applications outside of mathematics[b] other than the use of prime numbered gear teeth to distribute wear evenly. In particular, number theorists such as British mathematician G. H. Hardy prided themselves on doing work that had absolutely no military significance.


The small gear has 13 teeth the middle gear has 21, relatively prime to 13. Image source.
Arecibo message image dimensions
The Arecibo message consisted of a rectangle with prime width and height.
This guarantees that aliens can only interpret the image in 2 ways (modulo rotations and excluding a flat 1 x N image).
For example, for a 2 x 3 x 5 image with 30 bits can be read as either of:
 2 x 15
 3 x 10
 5 x  6
 6 x  5
10 x  3
25 x  2

But a similarly sized 3 x 11 image with 33 bits can only be read as:
 3 x 11
11 x  3

If that counts as "real world", I leave up to you.
A good visualization of why this is for kids is that you cannot make a rectangle out of a prime number, so there is only one possibility for each edge.

Image source.
Indicator of intelligent life in interstellar communications
Another application in the alien communication vein: in the 1980's documentary series Cosmos, Carl Sagan proposes that we use a signal like:
X XX XXX XXXXX XXXXXXX XXXXXXXXXXX

with prime numbers length strings at the start of messages we send to aliens.
The rationale is that this is likely to catch their attention, since there are no (?) natural processes that generate such a sequence, even though it is a sequence we expect alien mathematicians to immediately understand, and thus recognize as a sign of intelligence.
So in this case, the lack of physical application of primes leads to their usefulness!
A: The most popular example I know comes from Cryptography, where many systems rely on problems in number theory, where primes have an important role (since primes are in a sense the "building blocks" of numbers).
Take for example the RSA encryption system: All arithmetic is done modulo $n$, with $n=pq$ and $p,q$ large primes. Decryption in this system relies on computing Euler's phi function, $\varphi(n)$, which is hard to compute (hence the system is hard to break) unless you know the prime factorization of $n$ (which is also hard to compute unless you know it upfront). Hence you need a method to generate primes (the Miller-Rabin primality checking algorithm is usually used here) and then you construct $n$ by multiplying the primes you have found.
A: Here is a hypothesized real-world application, but it's not by humans...it's by cicadas. 
Cicadas are insects which hibernate underground and emerge every 13 or 17 years to mate and die (while the newborn cicadas head underground to repeat the process). Some people have speculated that the 13/17-year hibernation is the result of evolutionary pressures. If cicadas hibernated for X years and had a predator which underwent similar multi-year hibernations, say for Y years, then the cicadas would get eaten if Y divided X. So by "choosing" prime numbers, they made their predators much less likely to wake up at the right time.
(It doesn't matter much anyway, because as I understand it, all of the local bug-eating animals absolutely gorge themselves whenever the cicadas come out!)

EDIT: I should have refreshed my memory before posting. I just re-read the article, and the cicadas do not hibernate underground. They apparently "suckle on tree roots". The article has a few other mild corrections to my answer, as well.
A: A simple answer is finding GCF and LCD for whole numbers which allows us to efficiently manipulate fractions, both arithmetic and algebraic.  Another is rationalizing and simplifying radical expressions.  Prime number manipulation is a basic and not-so-basic tool of mathematics.
A: When I was some 20 years old and living by myself for the first time, I designed a little racetrack with numbered squares on it, along with a handful of coloured tokens that would race along the track at the speed of one square per day. Each token had a household chore and a prime number on it; when a token hit its number, I had to carry out the given task, and it would get reset to zero. So, I washed the dishes every two days, watered the plants every three, vacuumed the carpet every five, ....
It was a good system. It made cleaning fun, it provided variety and structure at the same time, and I was obliged to devote the entire day to chores only once every 1397.73 years.
A: Quadratic Reciprocity is stated in terms of the residues modulo primes.  This "Golden Theorem" as called by Gauss, is one of the main threads leading up to Langlands program and eventually to the geometric Langlands Program.  This later area of research has been shown to have ties with S-duality in string theory.  String theory is just now being proven useful in understanding phenomena in condensed matter physics.   Also it is the techniques that are used to prove results about prime numbers that have applications rather than a particular theorem about specific families of primes. 
Prime numbers are often test beds for more general results used in other areas of mathematics. 
A: Thought I'd mention an application (or more like an explicit effect, rather than a direct application) that prime numbers have on computing fast Fourier transforms (FFTs), which are of fundamental use to many fields (e.g. signal processing, electrical engineering, computer vision).
It turns out that most algorithms for computing FFTs go fastest on inputs of power-of-two size and slowest on those of prime size. This effect is not small; in fact, it is often recommended, when memory is not an issue compared to time, to pad one's input to a power of 2 (increasing the input size to earn a speedup). 
Papers on this have been written: e.g. see Discrete Fourier transforms when the number of data samples is prime by Rader.
And github issues like this suggest it is still an issue.
Very specific algorithms (e.g. see this one using the Chinese remainder theorem for cases where the size is a product of relative primes) have been developed that, in my opinion, constitute some relevancy of primality to these applications. 
A: You can use prime numbers to plot this fine pattern :)

Intensity of green colour for each pixel was calculated using a function, which can be described with this pseudocode snippet:
g_intensity = ((((y << 32) | x))^((x << 32) | y))) * 15731 + 1376312589) % 256

where x and y are a pixel coordinates in screen space, stored in a 64bit integer variables.
A: Yes indeed modern cryptography is a useful branch which requires extensive use of prime numbers. A real world application to them would be how we use large primes in order for us to be able to encode information that is sent wirelessly when making transactions on our debit cards, credit cards, computers,$~\ldots$etc in order to keep our information safe. Now when I say real world I don't mean the physical world. Primes numbers use is only in the computer world, in which we use computers in our physical world; if that makes any sense at all. Primes number had little use until about the 19th century, when mathematicians experimented with them in hopes to uncover some breakthrough with their use. When the times of the war came around, the U.S. defense needed a way of secrecy of all high class confidential information, so files and messages all needed to be encoded, so that enemy lines could not retrieve vital information of plans and routines. Encryption was used, and to make the process of using primes numbers to encode information, computers came into play to create more complex and longer codes that would be much harder to crack by anyone. Primes can also be used in pseudorandom number generators and computer hash tables. There are some biological instances in which primes are used  to help in predicting the predator-prey model for a special type of insect to have a higher survival rate which are "Cicada". Something else would be public-key encryption, formally known as RSA.  
There are many types of classifications of prime numbers, but the main two are Fermat primes and Mersenne primes.
Have a look at this video here from Terence Tao. 
Structure and Randomness in Prime Numbers
Articles Here:
Treatment on  Primes, They are the very top 9 links by Terry Tao and  others.
Powerpoint Link in First Paragraph
A: There may be some applications (other than to cryptography, already mentioned) in Manfred Schroeder's book, Number Theory in Science and Communication. 
A: Just to add one more: Primes are also useful when generating Pseudo-Random Numbers with the computer. A few formulas use them to avoid patterns in the output.
A: From the world of real things...
Prime number are used in developing machine tools.  Utilizing primes you can avoid setting up harmonics which "eat" your very expensive tools.  Tools chatter, (bounce up and down), as they are being used.  Allowing those vibrations to propagate intensifying the chatter and the wear.
You ever wonder how the metal racks in a microwave get designed?  Again they use primes to assure that there are no harmonic possibilities, and you don't get the light show you would on an older microwave.
A: You know the Queen song, We Will Rock You? How it has that stamp-stamp-clap-pause beat? According to Wikipedia, 
"The stamping effects were created by the band overdubbing the sounds of themselves stomping and clapping many times and adding delay effects to create a sound like many people were participating. The durations of the delays were in the ratios of prime numbers, a technique now known as non-harmonic reverberation."
A: 
Primes are really strange... I created this simple pattern out of bordom. I haven't seen any of similarity online. As you see, the picture has lines of absence depending on the scale you choose, this is ranging from values 1 to 1000000
A: Prime numbers are used in public key cryptography. It is used because you generally don't think of the really big prime numbers, so it is great for codes and to keep things safe. 
A: I used prime numbers to help group entities using two factors using Excel. I needed to calculate a. how large an entity was (in terms of turnover), and b. how tardy it was (by number of months) in filing annual returns. Each band had a consecutive number, and each size (e.g. turnover between $125,000 and $2 million) was assigned a prime number higher than the total number of time bands. Using prime numbers ensured that multiplying "size" by "lateness" values resulted in a unique "lateness score" that could then be used used to group entities based on size and degree of lateness. 
A: Prime numbers are often used to make puzzles. Specially series puzzles.
For instance, I made this one few months ago:
Finding the next term in the sequence: $10,37,521,8177,33550457$
It is OEIS-proof.
