A003983 Array read by antidiagonals with T(n,k) = min(n,k).
1, 1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 2, 3, 2, 1, 1, 2, 3, 3, 2, 1, 1, 2, 3, 4, 3, 2, 1, 1, 2, 3, 4, 4, 3, 2, 1, 1, 2, 3, 4, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1
Offset: 1
Examples
Triangle version begins 1; 1, 1; 1, 2, 1; 1, 2, 2, 1; 1, 2, 3, 2, 1; 1, 2, 3, 3, 2, 1; 1, 2, 3, 4, 3, 2, 1; 1, 2, 3, 4, 4, 3, 2, 1; 1, 2, 3, 4, 5, 4, 3, 2, 1; ...
Links
- Reinhard Zumkeller, Rows n=1..100 of triangle, flattened
Crossrefs
Programs
-
Haskell
a003983 n k = a003983_tabl !! (n-1) !! (k-1) a003983_tabl = map a003983_row [1..] a003983_row n = hs ++ drop m (reverse hs) where hs = [1..n' + m] (n',m) = divMod n 2 -- Reinhard Zumkeller, Aug 14 2011
-
Maple
a(n) = min(floor(1/2 + sqrt(2*n)) - (2*n + round(sqrt(2*n)) - round(sqrt(2*n))^2)/2+1, (2*n + round(sqrt(2*n)) - round(sqrt(2*n))^2)/2) # Leonid Bedratyuk, Dec 13 2009
-
Mathematica
Flatten[Table[Min[n-k+1, k], {n, 1, 14}, {k, 1, n}]] (* Jean-François Alcover, Feb 23 2012 *)
-
PARI
T(n,k) = min(n,k) \\ Charles R Greathouse IV, Feb 06 2017
-
Python
from math import isqrt def A003983(n): a = (m:=isqrt(k:=n<<1))+(k>m*(m+1)) x = n-(a*(a-1)>>1) return min(x,a-x+1) # Chai Wah Wu, Jun 14 2025
Formula
Number triangle T(n, k) = Sum_{j=0..n} [j<=k][j<=n-k]. - Paul Barry, Jan 16 2006
G.f.: 1/((1-x)*(1-x*y)*(1-x^2*y)). - Christian G. Bower, Jan 17 2006
a(n) = min(floor( 1/2 + sqrt(2*n)) - (2*n + round(sqrt(2*n)) - round(sqrt(2*n))^2)/2+1, (2*n + round(sqrt(2*n)) - round(sqrt(2*n))^2)/2). - Leonid Bedratyuk, Dec 13 2009
Extensions
More terms from Larry Reeves (larryr(AT)acm.org), Nov 08 2000
Entry revised by N. J. A. Sloane, Dec 05 2006
Comments