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?

**Answer**

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.

**Attribution***Source : Link , Question Author : Sylverdrag , Answer Author : Martin Thoma*