# Blog

## Ulam’s Prime Number Spiral

There is an infinite number of prime numbers, and yet the prime numbers themselves do not display any apparent pattern, nor does any formula exist that generates prime numbers. In fact, Legendre proved that there cannot be an algebraic function which always gives primes.

However, prime numbers do exhibit a curious phenomenon when arranged in a spiral along with other consecutive integers, as in the figure to the right (in the figure, prime numbers are highlighted in white, twin primes are green, and Mersenne primes are red).

### The Phenomenon

It was first noticed by the physicist Stanisław Ulam in 1963, when he got bored in a meeting and started doodling spirals of numbers. He noticed that, if he makes a spiral of consecutive integers, and circles only the prime numbers, strange diagonal “lines” of prime numbers emerge.

This is quite surprising, since we would intuitively expect a random distribution of prime numbers. However, these diagonal segments occur on an impressively large scale, and arbitrarily far from the center of the spiral. The following image is a spiral containing about 4000 primes, and next to it is the same image with some of the diagonal paths highlighted.

### Application

To explore this phenomenon on a large scale, I wrote a small program that generates arbitrarily large spirals, with configurable coloring and other options.

The program generates a spiral based on the total number of integers that you specify. It also allows you to specify the colors to use for the background, prime numbers, twin primes, and Mersenne primes.

In addition, the program allows you to use a custom polynomial (up to degree-2) for generating the spiral. By default, the polynomial is set to
$f(n) = n$
so the spiral will have the normal sequence 0, 1, 2, 3, etc. However, as an example, suppose you want the spiral to consist only of odd integers (1, 3, 5, 7, etc). You can simply set the polynomial to be
$f(n) = 2n + 1$

by writing “2” in the text box next to “n“, and “1” in the last of the three text boxes. The image to the right shows a spiral constructed from odd integers only. Notice the prominent “patterns,” this time extending vertically and horizontally.

### Conclusions

Ultimately, all that these patterns show is that certain polynomials are more “likely” to generate prime numbers than others. In fact, we can speculate that these kinds of patterns would emerge if we arrange the integers in any ordered design, not just a spiral. Even if we arrange the integers in a simple table, we would still see occasional “streaks” of prime numbers similar to the ones seen in the spiral.

The existence of “prime-generating” polynomials was known since the time of Euler, who discovered a polynomial that gives 40 consecutive prime numbers, namely
$$f(n) = n^2 – n + 41$$
The reason why some polynomials generate more primes than others is still not known.

### Extreme Spirals

Using my program, you can generate extremely large spirals, limited only by the amount of memory on your computer. Here are some fairly large ones that I generated:

## On the Existence of George Washington

In yet another friendly religious debate, I was given the argument that goes something like, “How do you know that _____ _____ existed?” The blanks can obviously be replaced with any prominent historical figure who is no longer living. On this occasion it was George Washington. This argument is quite weak in itself, since it is not even an argument for or against the existence of God (or Jesus); instead, it argues only that human knowledge is fallible, therefore no fact can be absolutely certain, indirectly leaving a little room for the possibility of a god.

The response to this kind of argument is three-fold. First, we have thousands of instances of indirect evidence that supports the existence of George Washington in the form of biographies, paintings, and letters, as well as documents and letters written by the man himself. It’s highly unlikely and unnecessary for all of these sources to have conspired to invent a non-existent first president of the United States.

The second part of the response is perhaps the most important: George Washington never claimed to be able to break the laws of physics! There are no claims of Washington parting seas, curing the blind, or turning water into wine. If such a claim had been made, we would undoubtedly need some truly convincing evidence, like confirmations of the observed phenomena by the greatest scientists of the time (emphasizing their inability to explain the phenomena), as well as experimental data on repeatability and consistency of Washington’s powers.

The third part of the response is a bit more subtle, but also very important. Believing in the existence of George Washington is not integral to the understanding of reality. History is reevaluated all the time. One day, historians might even discover that Washington was a hoax, and never existed as a real person. However, this kind of finding would have no effect on the foundations of physics, cosmology, or biology. The existence of Jesus, however (especially the god-man Jesus of the Bible) would have profound consequences in many scientific disciplines. The fact that the Bible is the only (second-hand) source that attributes supernatural powers to Jesus makes for particularly weak evidence for his divinity. If there was a single manuscript claiming that George Washington had magical powers, I would undoubtedly want evidence that is as credible as the claim is outlandish. Wouldn’t you?

## This is What I Think About!

One of the recent television commercials for the U.S. Navy depicts two police officers in their cruiser, patroling a sketchy urban neighborhood. Suddenly they pick out a boy in a group of friends, and call him over to the vehicle. One of the police officers points to his laptop, annoyed, saying, “It, uhh… it crashed again.” The boy glances at the laptop screen and says proudly, “Reboot with F8 in Safe Mode.

Now, it is true that pressing F8 during the boot sequence will allow you to enter Safe Mode. However, going into Safe Mode is a very temporary measure, and by no means the solution to the underlying problem! Booting into Safe Mode should only be done in the most extreme situations (e.g. a malfunctioning video driver), and should never be used for anything except repairing critical errors in the operating system, and then making sure the computer can boot back into normal mode.

The Navy-bound computer whiz-kid should never have let the officer drive off with the computer still in Safe Mode. If anything, the officer will encounter more problems (or at least annoyances) trying to work in Safe Mode than working normally with an occasional crash. Is this kid really the kind of person we want working as an Airborne Ops Tech?

## Bible Code Finder

At long last, I’ve recovered the source code for my Bible Code Finder application. It’s covered in more detail in this article. The program takes a plain text file (preferably a large one), and allows you to scan it for occurrences of words with equidistant letter spacing. Download the program and, if you’d like, the source code repository. To download the full text of the Bible (or a great number of other texts), visit Project Gutenberg.

It works like this: start the program and open the text file that you want to search (the program automatically strips punctuation and whitespace). Then enter up to seven words to look for, and click the Start button! The program will find the first occurrence of all words within a certain range, unless you select “Find All” instead of “Find One.” The result(s) will be shown in the Results tab.

The “Frame Size” parameter is the range (in letters) within which all words must be found. “Min Delta” and “Max Delta” are the minimum and maximum letter spacing of words to search.

Obviously, longer words will take longer to search for. Generally it’s highly improbable to find combinations with words longer than 8 letters. On the other hand, don’t search for words shorter than three letters, since too many results will be found. As a rule, try to enter longer words first, then shorter words. This will result in a quicker search.

## Another Thought on New-Age Nonsense

Why is it that the more ancient a certain alternative healing technique is (or the more Eastern it is), the more “hip” it is to practice it?

Isn’t it well-established that people in ancient times were less smart than we are today? What does this say about the medicinal techniques they employed?

With the advent of modern (“Western”) medicine, the average human lifespan has nearly doubled, numerous diseases have been completely eradicated, and we are well on our way to reverse-engineering the very structure of life itself. This is due only to the fact that all forms of voodoo, magick, and pseudoscience have been eliminated from the medical profession.

For New Age proponents to attempt to reinsert pseudoscientific quackery into medicine and “restore harmony with the ancient ways” is not only counterproductive, but dangerous, and ultimately futile.