Prime Triangles

A "prime triangle" is made up of rows of numbers.  Row number n contains the integers 1 through n. The first row is just "1", the second row is "1 2", the third row is "1 2 3" and so on. The tricky part is that the numbers have to be arranged so that if you add a number to its neighbor, that sum must be a prime number. So when you get to "1 2 3 4 5", you have to reorder the numbers because 4+5 is 9, which isn't prime. "1 4 3 2 5" works.

Here's a 10 row prime triangle:

                   1  
                 1   2  
               1   2   3  
             1   2   3   4  
           1   4   3   2   5  
         1   4   3   2   5   6  
       1   4   3   2   5   6   7  
     1   2   3   4   7   6   5   8  
   1   2   3   4   7   6   5   8   9  
 1   2   3   4   7   6   5   8   9  10
 

Question: Is there a (really long) row for which there is no solution?

Answer: I dunno. If you have any insights into the answer, please drop me a line at Acuff@Dr-Amy.com.

Joke

 My wonderful wife Amy's undergraduate degree is in English Lit, so in her honor:

A mathematician, a physicist, an engineer, and an English major are all asked if all odd numbers are prime.

The mathematician says, "3 is prime, 5 is prime, 7 is prime, therefore, by induction, the answer is yes."

The physicist says, "3 is prime, 5 is prime, 7 is prime, 9 is experimental error, 11 is prime; that's a large enough sample; the answer is yes."

The engineer says, ""3 is prime, 5 is prime, 7 is prime, 9 is not prime, so the answer is no."

The English major says, "What's a prime?"

The Program

Christopher Lane got me interested in prime triangles when he used them as an example in a class he's teaching. (See Prime Spiral for another prime number plaything he introduced me to.)

In order to play with prime triangles and learn more about Java, I wrote the following Applet. Drop me a line to let me know if you enjoy it. You can see the source here.

Here are some tips on using it.

Last updated on 6-19-2002 by Rich Acuff