A037126 Triangle T(n,k) = prime(k) for k = 1..n.
2, 2, 3, 2, 3, 5, 2, 3, 5, 7, 2, 3, 5, 7, 11, 2, 3, 5, 7, 11, 13, 2, 3, 5, 7, 11, 13, 17, 2, 3, 5, 7, 11, 13, 17, 19, 2, 3, 5, 7, 11, 13, 17, 19, 23, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 2, 3, 5, 7, 11, 13, 17
Offset: 1
Examples
Triangle begins: ..... 2 .... 2,3 ... 2,3,5 .. 2,3,5,7 . 2,3,5,7,11 ...
Links
- Reinhard Zumkeller, Rows n = 1..100 of triangle, flattened
- Boris Putievskiy, Transformations [Of] Integer Sequences And Pairing Functions, arXiv preprint arXiv:1212.2732 [math.CO], 2012.
Programs
-
GAP
P:=Filtered([1..200],IsPrime);; T:=Flat(List([1..13],n->List([1..n],k->P[k]))); # Muniru A Asiru, Mar 16 2019
-
Haskell
a037126 n k = a037126_tabl !! (n-1) !! (k-1) a037126_row n = a037126_tabl !! (n-1) a037126_tabl = map (`take` a000040_list) [1..] -- Reinhard Zumkeller, Oct 01 2012
-
Maple
T:=(n,k)->ithprime(k): seq(seq(T(n,k),k=1..n),n=1..13); # Muniru A Asiru, Mar 16 2019
-
Mathematica
Flatten[ Table[ Prime[ i], {n, 12}, {i, n}]] (* Robert G. Wilson v, Aug 18 2005 *) Module[{nn=15,prs},prs=Prime[Range[nn]];Table[Take[prs,n],{n,nn}]]// Flatten (* Harvey P. Dale, May 02 2017 *)
Formula
As a linear array, the sequence is a(n) = A000040(m), where m = n-t(t+1)/2, t=floor((-1+sqrt(8*n-7))/2). - Boris Putievskiy, Dec 12 2012
Comments