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.
%I A338664 #18 Jun 24 2021 02:26:54 %S A338664 0,1,1,1,2,2,2,1,1,4,2,4,2,2,1,2,4,4,4,4,3,2,2,1,2,6,5,6,2,7,2,3,2,2, %T A338664 1,3,6,6,6,5,4,6,4,2,3,2,2,1,3,8,4,10,4,6,3,9,2,4,2,3,2,2,1,4,5,10,6, %U A338664 6,8,4,4,9,4,2 %N A338664 a(n) is the number of ways that n square tiles can be formed into two rectangles, such that those rectangles fit orthogonally into the minimal bounding square that can contain n such tiles, without overlap. %C A338664 Note that rectangles of size 0 are not accepted (i.e., the tiles may not be formed into a single rectangle). %C A338664 Finding a(n) is equivalent to counting the positive integer solutions (x,y,z,w) of n = xy + zw such that: %C A338664 i) x,y,z,w <= ceiling(sqrt(n)) %C A338664 ii) min(x,y) + min(w,z) <= ceiling(sqrt(n)) %C A338664 iii) x >= y,z,w %C A338664 iv) z >= w %C A338664 v) if x = z then y >= w %C A338664 Note that ceiling(sqrt(n)) is the side length of the minimal bounding square into which n unit square tiles can be orthogonally placed, without overlap. %C A338664 Therefore, i) states that neither rectangle should be longer than the bounding square, while ii) states that the two rectangles must fit side by side within this square. %C A338664 iii)-v) ensure that rectangles are not double counted through permuting the values of the variables. %H A338664 Thomas Oléron Evans, <a href="/A338664/b338664.txt">Table of n, a(n) for n = 1..9999</a> %e A338664 a(18) = 4. %e A338664 18 unit square tiles fit orthogonally into a square of side length 5 (the minimum) without overlap. There are four possible pairs of rectangles that can be formed with the 18 tiles that can then be fit orthogonally into such a square without overlap: %e A338664 1) 4 X 3 and 3 X 2 %e A338664 2) 4 X 4 and 2 X 1 %e A338664 3) 5 X 2 and 4 X 2 %e A338664 4) 5 X 3 and 3 X 1 %e A338664 Case 1 Case 2 Case 3 Case 4 %e A338664 1 1 1 - - 1 1 1 1 - 1 1 1 1 1 1 1 1 - - %e A338664 1 1 1 - - 1 1 1 1 - 1 1 1 1 1 1 1 1 - 2 %e A338664 1 1 1 2 2 1 1 1 1 2 - 2 2 2 2 1 1 1 - 2 %e A338664 1 1 1 2 2 1 1 1 1 2 - 2 2 2 2 1 1 1 - 2 %e A338664 - - - 2 2 - - - - - - - - - - 1 1 1 - - %e A338664 Note that other pairs of rectangles with total area 18, e.g., 3 X 3 and 3 X 3, or 6 X 2 and 3 X 2 are not counted, since they could not fit together into the minimal (5 X 5) bounding square. %o A338664 (Python) %o A338664 import numpy as np %o A338664 # This sets the number of terms: %o A338664 nits = 20 %o A338664 # This list will contain the complete sequence: %o A338664 seq_entries = [] %o A338664 # i is the index of the term to be calculated: %o A338664 for i in range(1, nits + 1): %o A338664 # This variable counts the rectangle pairs: %o A338664 count = 0 %o A338664 # Calculate the side length of the minimal bounding square: %o A338664 bd_sq_side = np.ceil(np.sqrt(i)) %o A338664 # Looking for pairs of rectangles of sizes a x b and c x d (all integers) %o A338664 # such that both can fit orthogonally into the minimal bounding square (integer side length) %o A338664 # WLOG suppose that: %o A338664 # a is the greatest of a, b, c, d... %o A338664 # c >= d %o A338664 # if a = c then b >= d %o A338664 # a rectangle of size 0 X 0 is not acceptable %o A338664 # The longest side length of either rectangle: %o A338664 for a in np.arange(1,bd_sq_side + 1): %o A338664 # The other side length of the same rectangle: %o A338664 for b in np.arange(1,1 + min(a,np.floor(i/a))): %o A338664 # Find the remaining area for the other rectangle: %o A338664 area_1 = a*b %o A338664 rem_area = i - area_1 %o A338664 # If there is no remaining area, the first rectangle is not valid: %o A338664 if rem_area == 0: %o A338664 continue %o A338664 # The shorter side of the second rectangle: %o A338664 for d in np.arange(1,1 + min(a,np.floor(np.sqrt(rem_area)))): %o A338664 # The longer side of the second rectangle: %o A338664 c = rem_area / d %o A338664 # Check that the solution is valid: %o A338664 if b + d <= bd_sq_side and c == int(c) and c <= bd_sq_side and c <= a and ((a != c) or (b >= d)): %o A338664 count += 1 %o A338664 # Add the entry calculated to the list %o A338664 seq_entries.append(count) %o A338664 for an in seq_entries: %o A338664 print(an) %Y A338664 Cf. A338671, A055507 (where a(n) is the number of ordered ways to express n+1 as a*b+c*d with 1 <= a,b,c,d <= n). %K A338664 nonn %O A338664 1,5 %A A338664 _Thomas Oléron Evans_, Apr 22 2021