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.

A356356 Triangle of number of rectangles in the interior of the rectangle with vertices (k,0), (0,k), (n,n+k) and (n+k,n), read by rows.

This page as a plain text file.
%I A356356 #51 Dec 25 2022 14:20:37
%S A356356 0,1,9,2,19,51,3,29,86,166,4,39,121,250,410,5,49,156,334,575,855,6,59,
%T A356356 191,418,740,1141,1589,7,69,226,502,905,1427,2044,2716,8,79,261,586,
%U A356356 1070,1713,2499,3396,4356,9,89,296,670,1235,1999,2954,4076,5325,6645
%N A356356 Triangle of number of rectangles in the interior of the rectangle with vertices (k,0), (0,k), (n,n+k) and (n+k,n), read by rows.
%C A356356 The function of the triangle T(n,k), where n,k > 0, is equal to (n-k+1)*A330805(k-1) - (n-k)*T(k,k-1) + k*(n-k). This is equivalent to saying that this function is (n-k+1) Aztec diamonds (A330805(k-1)) minus the overlaps of those diamonds (two Aztec diamonds of size k-1 overlapped, hence f(k,k-1)) plus (n-k) copies of k extra rectangles. For this last part, the rectangles are of sizes 1 X (2k-1), 3 X (2k-3), 5 X (2k-5), ..., (2k-3) X 3, (2k-1) X 1 and there are (n-k) copies per overlap.
%C A356356 T(n,n) = A330805(n-1).
%C A356356 If n or k <= 0, T(n,k) = 0.
%C A356356 T(n,k) = T(k,k) + (n-k)*A000447(k). That is, incrementing n for fixed k adds a fixed number of new rectangles, equal to A000447(k).
%C A356356 This sequence was prompted by the codegolf.se question linked below, where the problem was to find T(n,k) plus the number of squares and rectangles in an n X k rectangular lattice with diagonals (lines y+a=+-x).
%H A356356 Evan Robinson, <a href="/A356356/b356356.txt">First 100 rows, flattened</a>
%H A356356 Code Golf Stack Exchange, <a href="https://codegolf.stackexchange.com/questions/87560/count-the-rectangles-in-a-diagonal-grid">Related problem of finding the number of squares on a diagonal grid</a>
%F A356356 T(n,k) = (n-k+1)*A330805(k-1) - (n-k)*T(k,k-1) + k*(n-k).
%F A356356 T(n,k) = (n-k+1)*(4*k^4-k^2-3*k)/6 - (n-k)*T(k,k-1) + k*(n-k).
%F A356356 T(n,k) = 1/3*(n-k)*(4*k^3-k) + (4*k^4-k^2-3*k)/6.
%F A356356 T(n,k) = (n-k)*A000447(k) + A330805(k-1).
%F A356356 T(n,1) = n-1.
%F A356356 T(n,n) = A330805(n-1).
%F A356356 T(n,n-1) = (4*n^4-8*n^3-n^2+5*n)/6.
%F A356356 T(n,k) = (n-1)*A000447(k) - T(k,k-1).
%e A356356 Triangle T(n,k) begins:
%e A356356   n\k  1    2    3    4    5    6    7    8    9   10
%e A356356    1   0
%e A356356    2   1    9
%e A356356    3   2   19   51
%e A356356    4   3   29   86  166
%e A356356    5   4   39  121  250  410
%e A356356    6   5   49  156  334  575  855
%e A356356    7   6   59  191  418  740 1141 1589
%e A356356    8   7   69  226  502  905 1427 2044 2716
%e A356356    9   8   79  261  586 1070 1713 2499 3396 4356
%e A356356   10   9   89  296  670 1235 1999 2954 4076 5325 6645
%e A356356 For n = 7, k = 3, T(n,k) = (7-3+1)*A330805(3-1) - (7-3)*f(3,2) + 3*(7-3) = 5*51 - 4*19 + 3*4 = 191.
%o A356356 (Julia)
%o A356356 function T(n, k)
%o A356356     (2*(n-k)*(4*k^3-k)+(4*k^4-k^2-3*k))รท6
%o A356356 end
%Y A356356 Cf. A330805, A000447.
%K A356356 nonn,easy,tabl
%O A356356 1,3
%A A356356 _Evan Robinson_, Oct 15 2022