cp's OEIS Frontend

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.

A003983 Array read by antidiagonals with T(n,k) = min(n,k).

This page as a plain text file.
%I A003983 #59 Jun 14 2025 17:16:17
%S A003983 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,
%T A003983 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,
%U A003983 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
%N A003983 Array read by antidiagonals with T(n,k) = min(n,k).
%C A003983 Also, "correlation triangle" for the constant sequence 1. - _Paul Barry_, Jan 16 2006
%C A003983 Antidiagonal sums are in A002620.
%C A003983 As a triangle, row sums are A002620. T(2n,n)=n+1. Diagonal sums are A001399. Construction: Take antidiagonal triangle of MM^T where M is the sequence array for the constant sequence 1 (lower triangular matrix with all 1's). - _Paul Barry_, Jan 16 2006
%C A003983 From _Franklin T. Adams-Watters_, Sep 25 2011: (Start)
%C A003983 As a triangle, count up to ceiling(n/2) and back down again (repeating the central term when n is even).
%C A003983 When the first two instances of each number are removed from the sequence, the original sequence is recovered.
%C A003983 (End)
%H A003983 Reinhard Zumkeller, <a href="/A003983/b003983.txt">Rows n=1..100 of triangle, flattened</a>
%F A003983 Number triangle T(n, k) = Sum_{j=0..n} [j<=k][j<=n-k]. - _Paul Barry_, Jan 16 2006
%F A003983 G.f.: 1/((1-x)*(1-x*y)*(1-x^2*y)). - _Christian G. Bower_, Jan 17 2006
%F A003983 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
%e A003983 Triangle version begins
%e A003983   1;
%e A003983   1, 1;
%e A003983   1, 2, 1;
%e A003983   1, 2, 2, 1;
%e A003983   1, 2, 3, 2, 1;
%e A003983   1, 2, 3, 3, 2, 1;
%e A003983   1, 2, 3, 4, 3, 2, 1;
%e A003983   1, 2, 3, 4, 4, 3, 2, 1;
%e A003983   1, 2, 3, 4, 5, 4, 3, 2, 1;
%e A003983   ...
%p A003983 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
%t A003983 Flatten[Table[Min[n-k+1, k], {n, 1, 14}, {k, 1, n}]] (* _Jean-François Alcover_, Feb 23 2012 *)
%o A003983 (Haskell)
%o A003983 a003983 n k = a003983_tabl !! (n-1) !! (k-1)
%o A003983 a003983_tabl = map a003983_row [1..]
%o A003983 a003983_row n = hs ++ drop m (reverse hs)
%o A003983    where hs = [1..n' + m]
%o A003983          (n',m) = divMod n 2
%o A003983 -- _Reinhard Zumkeller_, Aug 14 2011
%o A003983 (PARI) T(n,k) = min(n,k) \\ _Charles R Greathouse IV_, Feb 06 2017
%o A003983 (Python)
%o A003983 from math import isqrt
%o A003983 def A003983(n):
%o A003983     a = (m:=isqrt(k:=n<<1))+(k>m*(m+1))
%o A003983     x = n-(a*(a-1)>>1)
%o A003983     return min(x,a-x+1) # _Chai Wah Wu_, Jun 14 2025
%Y A003983 Cf. A002620, A001399, A087062, A115236, A115237, A124258, A006752, A120268, A173945, A173947, A173948, A173949, A173953, A173954, A173955, A173973, A173982-A173986, A004197.
%K A003983 tabl,nonn,easy,nice
%O A003983 1,5
%A A003983 _Marc LeBrun_
%E A003983 More terms from Larry Reeves (larryr(AT)acm.org), Nov 08 2000
%E A003983 Entry revised by _N. J. A. Sloane_, Dec 05 2006