.. Created by Adam Cunnningham on Fri June 3 2016. **Prime Spirals** ================= A *prime spiral* is produced by writing a rectangular grid of the positive integers, starting at 1 and spiraling out as follows: .. image:: prime_spiral.png :scale: 50 % Report Description ------------------ Do the following exercise first to write the function needed for the rest of the report. **Exercise 1.** Write a function ``is_prime(x)`` that returns `True` if `x` is a prime number, and `False` otherwise. This function may have additional arguments if necessary. .. hint:: The simplest way to check if an integer is prime is to check that it has no divisors between 1 and itself. Is it necessary to check *all* the possible divisors, or can you find a more efficient way to do this? Once you have the ``is_prime()`` function tested and working, use the Matplotlib **text** function to plot the positive integers on a grid as shown above. - Choose some way to distinguish between prime and composite numbers on your plot. Text properties you might want to experiment with include font, size, color, boldness etc. - Plot a large grid, at least 30 x 30. - What kinds of feature can you see in the image? Experiment with different text properties until you find some that highlight these features best. - How can any of these features be described mathematically? Can you find formulas which describe any of the "prime-rich" sequences seen? - Can you give reasons why any of these sequences might occur?