A104887 Triangle T(n,k) = (n-k+1)-th prime, read by rows.
2, 3, 2, 5, 3, 2, 7, 5, 3, 2, 11, 7, 5, 3, 2, 13, 11, 7, 5, 3, 2, 17, 13, 11, 7, 5, 3, 2, 19, 17, 13, 11, 7, 5, 3, 2, 23, 19, 17, 13, 11, 7, 5, 3, 2, 29, 23, 19, 17, 13, 11, 7, 5, 3, 2, 31, 29, 23, 19, 17, 13, 11, 7, 5, 3, 2, 37, 31, 29, 23, 19, 17, 13, 11, 7, 5, 3, 2, 41, 37, 31, 29
Offset: 1
Examples
Triangle begins: 2; 3, 2; 5, 3, 2; 7, 5, 3, 2; 11, 7, 5, 3, 2; 13, 11, 7, 5, 3, 2; 17, 13, 11, 7, 5, 3, 2;
Links
- Reinhard Zumkeller, Rows n = 1..125 of triangle, flattened
- Boris Putievskiy, Transformations Integer Sequences And Pairing Functions, arXiv:1212.2732 [math.CO], 2012.
Programs
-
GAP
P:=Filtered([1..200],IsPrime);; T:=Flat(List([1..13],n->List([1..n],k->P[n-k+1]))); # Muniru A Asiru, Mar 16 2019
-
Haskell
import Data.List (inits) a104887 n k = a104887_tabl !! (n-1) !! (k-1) a104887_row n = a104887_tabl !! (n-1) a104887_tabl = map reverse $ tail $ inits a000040_list -- Reinhard Zumkeller, Oct 02 2014
-
Maple
T:=(n,k)->ithprime(n-k+1): seq(seq(T(n,k),k=1..n),n=1..13); # Muniru A Asiru, Mar 16 2019
-
Mathematica
Module[{nn=15,prms},prms=Prime[Range[nn]];Table[Reverse[Take[prms,n]],{n,nn}]]//Flatten (* Harvey P. Dale, Aug 10 2021 *)
Formula
a(n) = A000040(m), where m=(t*t+3*t+4)/2-n, t=floor((-1+sqrt(8*n-7))/2). - Boris Putievskiy, Dec 13 2012
Extensions
Edited by Ralf Stephan, Apr 05 2009
Comments