Did you know this about prime numbers?

I see nothing at all suggesting prime numbers as random. we have this rule that applies to all prime numbers

"For each prime number p > 3, there exists a natural number n such that p = 6n - 1 or p = 6n + 1. "

Plug in any n, and most of the time you’ll get two primes, but you’ll always get at least one prime.

If only for the sake of my sanity, can anybody come up with a specific cite for Ulam discovering it while “doodling during a boring lecture” ? I’m sure I’ve read a first-hand account by him of discovering this in just such circumstances, but I really don’t remember where. I’d have sworn it was in Adventures of a Mathematician, but, no, it doesn’t look as if that’s it.

While I can’t exhibit, there’s a whole field of study revolving around this sort of thing. It’s called Kolmogorov (or descriptive) complexity. One of the most striking results is that truly random sequences exhibit patterns, but not on any large enough scale.

That’s why I don’t think that this diagram shows that the primes have some large-scale order, or that there’s any deep reason why those lines should exist. One of the basic results of Chaitin’s work (a related area called algorithmic information theory) is that in any theory, there are statements which are true for no reason. If I’m not mistaken, these correspond to Godel’s undecidable statements. This pattern may be analogous–it may exist at random.

The first part of the quote is correct, but only because 6n, 6n+2, 6n+3, and 6n+4 are divisible by 2, 2, 3, and 2, respectively. All that’s left are numbers of the form 6n-1 and 6n+1.
The second part of the quote is incorrect. Neither 620 + 1, nor 620 - 1 are prime.

My copy of Archimedes’ Revenge by Paul Hoffman mentions that Ulam discovered it while doodling, but doesn’t mention anything about it happening during a boring lecture.

As has already been mentioned, the “prime diagonals” correspond to “prime producing” quadratic polynomials, such as Euler’s. Apparently, it is understood why Euler’s polynomial produces so many primes, though I personally am not familiar with the theory behind it:

http://www.maproom.demon.co.uk/keeps.html

What would a graph of the distance between prime numbers look like? That seems like it would be an interesting graph to look at.

x:1 y: 1 (2-1)
x:2 y: 1 (3-2)
x:3 y: 2 (5-3)
etc.

The number of primes less than or equal to n is asymptotic to n/ln(n), so on the large scale, it would look a bit like the finite differences of that equation, which are roughly 1/2ln(n).

To bring forward a couple points that have been touched on, so as to emphasize them:

(1) Prime numbers are not “random” in the strict sense. (I believe they are what is called “pseudo-random”.) Though there is no formula that will generate them in sequence, there certainly is a formula that will allow one to determine whether a given number is prime: namely the formula-ization of the “Sieve of Eratosthenes” (think of it as organized and efficient trial and error).

(2) As the “lines” figure expands, it begins to resemble the outline of a flower–perhaps a poppy. I’m not joking! But it’s not a “clean” line-drawing, but something impressionistic embedded in a “haze” of nonincluded dots. The implication is that, whereas individual PNs are unpredictable, they do show a very definite tendency toward strong probabilistic “clustering.” I have read this described as “an underlying second- and third-degree order.”

DOPERS–I would love to know if a similar “Ulam spiral” shows some kind of order to the decimal expansion of Pi!

(There is no truth to the rumor that it shows as a visual image:
YOG-SUTTHOTH WAS HERE!)

Sounds interesting; I’ll give it a go How about I do it on a proper spiral with each digit 0-9 being represented by a corresponding shade of grey?

Sounds interesting, Mangetout. I was thinking it would be interesting to do ten different plots, one for each digit 0-9 to better see the distribution of each digit.

Sure; it’s all doable. trouble is with a regular spiral plot is that the spacing of the points is going to make a big difference; this page has one method (for primes), but I think I’ll have to play around a bit with the pi thing.

I am going to doodle a chart of prime numbers tonight while I watch tv and find out what it looks like.

Being a bit obsessive compulsive, I only listen to tv volumes that are prime numbers. I might as well use that compulsion for a good use. I’ll tell you what I find.

Not quite true. Here’s an algorithm which, if left to run forever, will eventually output every prime number, and no others:

(1) Start with n = 2.
(2) Divide n by every natural number k < sqrt(n).
(3) If any k divides n, go to (5).
(4) Output n.
(5) Increment n and go to (2).

“pseudorandom” refers to something completely different.

Almost, ultrafilter. Step (2) should be:

Divide n by every natural number 2 > k < sqrt(n).

Otherwise division by 1 will pass every number.

Once you have tested for division by 2, you only need to test for division by the odd numbers less than sqrt(n)

If we keep this up, we’ll have an O(log n) solution in no time :smiley:

I knew all that…no, really. :smiley:

Good points.

I see a disconcerting lack of faith in the Riemann Hypothesis here :smiley:

I am ignorant about higher Math, but have an aptitude and curiosity about it.

When I sat and wrote out prime numbers the other night, there is a definite pattern to it. There always seems to come a point where there are 2 prime numbers only separated by one other number. For example 29 and 31. Most prime numbers stick out like a sore thumb to me. Obvious are the ones divisible by 2, 3 or 5. I am glad you are having this discussion.

Do a web search on “twin primes”… an interesting subset of the whole prime number deal.

Well, I couldn’t avoid playing with this stuff. Here are some of my results.

(And, of course, step 2 should read “Divide n by every prime number k < sqrt(n),” since they’ve already been determined by the time you need 'em for this step.)