This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A051237 #42 Feb 16 2025 08:32:41 %S 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, %T A051237 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, %U A051237 2,3,4,7,10,9,8,5,6,11,12,1,2,3,4,7,6,5,12,11,8,9,10,13,1,2,3,4,7,6,13,10 %N A051237 Lexicographically earliest prime pyramid, read by rows. %C A051237 Row n begins with 1, ends with n and sum of any two adjacent entries is prime. %C A051237 From _Daniel Forgues_, May 17 2011 and May 18 2011: (Start) %C A051237 Since the sum of any two adjacent entries is at least 3, the sum is an odd prime, which implies that any two consecutive entries have opposite parity. %C A051237 Since the first and last entries of row n are fixed at 1 and n, we have to find n-2 entries, where ceiling((n-2)/2) of them are even and floor((n-2)/2) are odd, so for row n the number of possible arrangements is %C A051237 (ceiling((n-2)/2))! * (floor((n-2)/2))! (Cf. A010551(n-2), n >= 2.) %C A051237 The number of ways of arranging row n to get a prime pyramid is given by A036440. List them in lexicographic order and pick the first (earliest) to get row n of lexicographically earliest prime pyramid. %C A051237 Prime pyramids are also (more fittingly?) called prime triangles. (End) %C A051237 It appears that the limit of the rows of the lexicographically earliest prime pyramid is A055265 (see comment in that sequence). %C A051237 Assuming Dickson's conjecture (or the later Hardy-Littlewood Conjecture B), no backtracking is needed: if the first n-2 elements in each row are chosen greedily, a penultimate member can be chosen such that its sums are prime. - _Charles R Greathouse IV_, May 18 2011 %D A051237 R. K. Guy, Unsolved Problems Number Theory, Section C1. %H A051237 T. D. Noe, <a href="/A051237/b051237.txt">Rows n=1..100 of triangle, flattened</a> %H A051237 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/PrimeTriangle.html">Prime Triangle</a> %H A051237 OEIS Wiki, <a href="/wiki/Prime_triangles">Prime triangles</a> %e A051237 Triangle begins: %e A051237 1; %e A051237 1, 2; %e A051237 1, 2, 3; %e A051237 1, 2, 3, 4; %e A051237 1, 4, 3, 2, 5; %e A051237 1, 4, 3, 2, 5, 6; %e A051237 1, 4, 3, 2, 5, 6, 7; %e A051237 1, 2, 3, 4, 7, 6, 5, 8; %e A051237 1, 2, 3, 4, 7, 6, 5, 8, 9; %e A051237 1, 2, 3, 4, 7, 6, 5, 8, 9, 10; %e A051237 1, 2, 3, 4, 7, 10, 9, 8, 5, 6, 11; %e A051237 1, 2, 3, 4, 7, 10, 9, 8, 5, 6, 11, 12; %e A051237 1, 2, 3, 4, 7, 6, 5, 12, 11, 8, 9, 10, 13; %t A051237 (* first do *) Needs["Combinatorica`"] (* then *) f[n_] := Block[{r = Range@ n}, While[ Union[ PrimeQ[ Plus @@@ Partition[r, 2, 1]]][[1]] == False, r = NextPermutation@ r]; r]; f[1] = 1; Array[f, 13] // Flatten (* _Robert G. Wilson v_ *) %Y A051237 See A187869 for the concatenation of the numbers for each row. %Y A051237 Cf. A036440, A051239, A055265. %K A051237 tabl,nice,nonn,easy %O A051237 1,3 %A A051237 _N. J. A. Sloane_ %E A051237 More terms from _Jud McCranie_