A036440 Number of ways of arranging row n of the prime pyramid.
1, 1, 1, 1, 1, 1, 2, 4, 7, 24, 80, 216, 648, 1304, 3392, 13808, 59448, 155464, 480728, 1588162, 5626309, 28279112, 157469880, 842498189, 4998554801, 28466978744, 166572523589, 1020487969891, 5753385660978
Offset: 1
Examples
a(8)=4 because of the 720 permutations P of {1,2,3,4,5,6,7,8} with first element 1 and last element 8, these four satisfy the "prime pyramid" condition that P[i] + P[i+1] be prime for i=1..7: 1 2 3 4 7 6 5 8; (lexicographically earliest row 8) 1 2 5 6 7 4 3 8; 1 4 7 6 5 2 3 8; 1 6 7 4 3 2 5 8. For row 8, there are 6! = 720 permutations of {2,3,4,5,6}, but if we take into account that the parity of all entries of row n must alternate, we only have to consider ceiling((8-2)/2)! * floor((8-2)/2)! = 36 cases.
References
- R. K. Guy, Unsolved Problems Number Theory, C1.
Links
- Eric Weisstein's World of Mathematics, Prime Triangle.
Crossrefs
Cf. A051237 for lexicographically earliest prime pyramid.
Programs
-
Mathematica
prsQ[n_]:=AllTrue[Total/@Partition[n,2,1],PrimeQ]; Table[Count[Join[{1},#,{n}]&/@ Permutations[ Range[2,n-1]],?prsQ],{n,12}] (* _Harvey P. Dale, May 07 2023 *)
Extensions
More terms from Jud McCranie
a(25)-a(27) from Max Alekseyev, Jan 05 2008
a(28)-a(29) from Giovanni Resta, Apr 01 2014
Comments