This site is supported by donations to The OEIS Foundation.

# Prime triangles

A prime triangle, also called a prime pyramid although it is 2 dimensional rather than 3 dimensional, is a triangle of positive integers with row ${\displaystyle \scriptstyle n\,}$ being an arrangement of the numbers {1, 2, ..., ${\displaystyle \scriptstyle n\,}$} that begins with 1, ends with ${\displaystyle \scriptstyle n\,}$, and for which the sum of two consecutive entries in a row is prime. Rows 1 to 6 are unique, then starting from row 7 you get many possibilities (hence the ? in rows 7 and after in the prime triangle.)

### Row n of the prime triangle

#### Number of ways to investigate for row n of the prime triangle

Since the entries of row ${\displaystyle \scriptstyle n\,}$ are all the distinct numbers in {1, ..., ${\displaystyle \scriptstyle n\,}$}, the sums of its consecutive entries can only be in {3, ..., 2${\displaystyle \scriptstyle n\,}$-1}, so we are looking for sums of consecutive entries which are odd primes. This means that the parity of consecutive entries must be distinct (even entries must alternate with odd entries.) Since the first and last entries of row ${\displaystyle \scriptstyle n\,}$ are set to 1 and ${\displaystyle \scriptstyle n\,}$ respectively, we are only free to arrange the ${\displaystyle \scriptstyle n\,}$-2 entries in {2, ..., ${\displaystyle \scriptstyle n\,}$-1}, starting with an even number. The number of even entries and odd entries which we are free to arrange for row ${\displaystyle \scriptstyle n\,}$ are thus

${\displaystyle {\Bigg \lceil }{\frac {n-2}{2}}{\Bigg \rceil },\quad n\geq 2,\,}$

and

${\displaystyle {\Bigg \lfloor }{\frac {n-2}{2}}{\Bigg \rfloor },\quad n\geq 2,\,}$

respectively.

So the number of arrangements for row ${\displaystyle \scriptstyle n\,}$ to investigate is

${\displaystyle {{\Bigg \lceil }{\frac {n-2}{2}}{\Bigg \rceil }}!~{{\Bigg \lfloor }{\frac {n-2}{2}}{\Bigg \rfloor }}!,\quad n\geq 2,\,}$

giving the sequence (Cf. A010551${\displaystyle \scriptstyle (n-2),\,n\,\geq \,2\,}$)

{1, 1, 1, 1, 2, 4, 12, 36, 144, 576, 2880, 14400, 86400, 518400, 3628800, 25401600, 203212800, 1625702400, 14631321600, 131681894400, 1316818944000, 13168189440000, 144850083840000, ...}
##### Table of number of ways to investigate for row n of the prime triangle
Number of ways to investigate for row ${\displaystyle \scriptstyle n\,}$ of the prime triangle
${\displaystyle \scriptstyle n\,}$ ${\displaystyle {{\Bigg \lceil }{\frac {n-2}{2}}{\Bigg \rceil }}!~{{\Bigg \lfloor }{\frac {n-2}{2}}{\Bigg \rfloor }}!,\quad n\geq 2.\,}$
1 1
2 1
3 1
4 1
5 2
6 4
7 12
8 36
9 144
10 576
11 2880
12 14400
13 86400
14 518400
15 3628800
16 25401600

#### Distinct ways of arranging row n of the prime triangle

 ${\displaystyle \scriptstyle n\,}$ = 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 1 4 3 2 5 6 1 4 3 2 5 6 7 1 ? ? ? ? ? 7 8 1 ? ? ? ? ? ? 8 9 1 ? ? ? ? ? ? ? 9 10 1 ? ? ? ? ? ? ? ? 10 11 1 ? ? ? ? ? ? ? ? ? 11 12 1 ? ? ? ? ? ? ? ? ? ? 12 13 1 ? ? ? ? ? ? ? ? ? ? ? 13 ${\displaystyle \scriptstyle k\,}$ = 1 2 3 4 5 6 7 8 8 10 11 12 13

The distinct ways, in lexicographic order, of arranging row ${\displaystyle \scriptstyle n\,}$ of the prime triangle are

Row 1
1 way, {1};
Row 2
1 way, {1, 2} giving sums {3};
Row 3
1 way, {1, 2, 3} giving sums {3, 5};
Row 4
1 way, {1, 2, 3, 4} giving sums {3, 5, 7};
Row 5
1 way, {1, 4, 3, 2, 5} giving sums {5, 7, 5, 7};
Row 6
1 way, {1, 4, 3, 2, 5, 6} giving sums {5, 7, 5, 7, 11};
Row 7
2 ways, {1, 4, 3, 2, 5, 6, 7}, and {1, 6, 5, 2, 3, 4, 7} giving sums {5, 7, 5, 7, 11, 13} and {7, 11, 7, 5, 7, 11};
Row 8
4 ways, {1, 2, 3, 4, 7, 6, 5, 8}, {1, 2, 5, 6, 7, 4, 3, 8}, {1, 4, 7, 6, 5, 2, 3, 8} and {1, 6, 7, 4, 3, 2, 5, 8} giving sums {3, 5, 7, 11, 13, 11, 13}, {3, 7, 11, 13, 11, 7, 11}, {5, 11, 13, 11, 7, 5, 11}, and {7, 13, 11, 7, 5, 7, 13};

#### Number of ways of arranging row n of the prime triangle

The number of ways of arranging row ${\displaystyle \scriptstyle n\,}$ of the prime pyramid is (Cf. A036440)

{1, 1, 1, 1, 1, 1, 2, 4, 7, 24, 80, 216, 648, 1304, 3392, 13808, 59448, 155464, 480728, 1588162, 5626309, 28279112, 157469880, 842498189, ...}

## Prime triangles

### Lexicographically earliest prime pyramid

 ${\displaystyle \scriptstyle n\,}$ = 1 1 2 1    (3) 2 3 1    (3) 2    (5) 3 4 1    (3) 2    (5) 3    (7) 4 5 1    (5) 4    (7) 3    (5) 2    (7) 5 6 1    (5) 4    (7) 3    (5) 2    (7) 5    (11) 6 7 1    (5) 4    (7) 3    (5) 2    (7) 5    (11) 6    (13) 7 8 1    (3) 2    (5) 3    (7) 4    (11) 7    (13) 6    (11) 5    (13) 8 9 1    (3) 2    (5) 3    (7) 4    (11) 7    (13) 6    (11) 5    (13) 8    (17) 9 10 1    (3) 2    (5) 3    (7) 4    (11) 7    (13) 6    (11) 5    (13) 8    (17) 9    (19) 10 11 1    (3) 2    (5) 3    (7) 4    (11) 7    (17) 10    (19) 9    (17) 8    (13) 5    (11) 6    (17) 11 12 1    (3) 2    (5) 3    (7) 4    (11) 7    (17) 10    (19) 9    (17) 8    (13) 5    (11) 6    (17) 11    (23) 12 13 1    (3) 2    (5) 3    (7) 4    (11) 7    (13) 6    (11) 5    (17) 12    (23) 11    (19) 8    (17) 9    (19) 10    (23) 13 ${\displaystyle \scriptstyle k\,}$ = 1 2 3 4 5 6 7 8 8 10 11 12 13

The concatenation of the rows of the lexicographically earliest prime pyramid give the sequence (Cf. A051237)

{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, 1, 2, 3, 4, 7, 10, 9, 8, 5, 6, 11, 1, 2, 3, 4, 7, 10, 9, 8, 5, 6, 11, 12, 1, 2, 3, 4, 7, 6, 5, ...}

The sum of adjacent row entries of the lexicographically earliest prime pyramid give the infinite sequence of finite sequences

{{3}, {3, 5}, {3, 5, 7}, {5, 7, 5, 7}, {5, 7, 5, 7, 11}, {5, 7, 5, 7, 11, 13}, {3, 5, 7, 11, 13, 11, 13}, {3, 5, 7, 11, 13, 11, 13, 17}, ...}

whose concatenation give the sequence (Cf. A??????)

{3, 3, 5, 3, 5, 7, 5, 7, 5, 7, 5, 7, 5, 7, 11, 5, 7, 5, 7, 11, 13, 3, 5, 7, 11, 13, 11, 13, 3, 5, 7, 11, 13, 11, 13, 17, ...}

#### Conjectured limit of the rows of the lexicographically earliest prime pyramid

That those rows do approach a limit seems certain, and given that that limit exists, that this sequence (A055265) is the limit seems even more certain, but no proof is obvious for either assertion. — Robert G. Wilson v, Mar 31 2011, edited by Franklin T. Adams-Watters, Mar 17 2011.

Smallest positive integer not already in sequence with a(n)+a(n-1) prime. (Cf. A055265)

{1, 2, 3, 4, 7, 6, 5, 8, 9, 10, 13, 16, 15, 14, 17, 12, 11, 18, 19, 22, 21, 20, 23, 24, 29, 30, 31, 28, 25, 34, 27, 26, 33, 38, 35, 32, 39, 40, 43, 36, 37, 42, 41, 48, 49, 52, 45, 44, 53, 50, 47, 54, 55, 46, 51, 56, 57, ...}