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 A338671 #26 Jun 24 2021 02:27:09 %S A338671 0,1,1,2,3,4,5,7,7,10,10,13,14,16,16,21,20,25,24,29,28,34,30,40,36,43, %T A338671 40,50,44,55,49,60,55,66,55,75,64,75,70,86,72,92,77,97,87,103,84,116, %U A338671 94,114,104,126,102,135,109,138,123,143,117,164,128,153,138,171 %N A338671 a(n) is the number of distinct ways of arranging n identical square tiles into two rectangles. %C A338671 Note that rectangles of size 0 are not accepted (i.e., the tiles may not be formed into a single rectangle). %C A338671 Finding a(n) is equivalent to counting the positive integer solutions (x,y,z,w) of n = xy + zw such that: %C A338671 i) x >= y,z,w %C A338671 ii) z >= w %C A338671 iii) if x = z then y >= w %C A338671 These conditions ensure that identical pairs are not counted twice by permuting the values of the variables. %F A338671 G.f.: (B(x)^2 + B(x^2))/2 where B(x) is the g.f. of A038548. - _Andrew Howroyd_, Apr 29 2021 %e A338671 a(5) = 3, since there are 3 ways to form 2 rectangles from 5 identical square tiles: %e A338671 1) 2 X 2 and 1 X 1 %e A338671 2) 3 X 1 and 2 X 1 %e A338671 3) 4 X 1 and 1 X 1 %e A338671 Note that rotation through 90 degrees and/or exchanging the order of the two rectangles in a pair naturally do not create a distinct pair. For example, the pair 2 X 1 and 1 X 3 is not distinct from pair 2 above. %o A338671 (Python) %o A338671 import numpy as np %o A338671 # This sets the number of terms: %o A338671 nits = 20 %o A338671 # This list will contain the sequence %o A338671 seq = [] %o A338671 # The indices of the sequence: %o A338671 for i in range(1,nits + 1): %o A338671 # This variable counts the pairs found for each total area i %o A338671 count = 0 %o A338671 # The longest side of either rectangle: %o A338671 for a in range(1,i): %o A338671 # The other side of the same rectangle: %o A338671 for b in np.arange(1,1 + min(a,np.floor(i/a))): %o A338671 # Calculate the area of this rectangle and the remaining area: %o A338671 area1 = a*b %o A338671 rem_area = i - a*b %o A338671 # The longer side of the second rectangle: %o A338671 for c in np.arange(1,1 + min(a,rem_area)): %o A338671 # The shorter side of the second rectangle: %o A338671 d = rem_area / c %o A338671 # Check that the solution is valid and not double counted: %o A338671 if d != int(d) or d > min(a,c) or (a == c and d > b): %o A338671 continue %o A338671 # Count the new pair found: %o A338671 count += 1 %o A338671 # Add to the sequence: %o A338671 seq.append(count) %o A338671 for an in seq: %o A338671 print(an) %o A338671 (PARI) a(n) = {(sum(k=1, n-1, ((numdiv(k)+1)\2)*((numdiv(n-k)+1)\2)) + if(n%2==0, (numdiv(n/2)+1)\2))/2} \\ _Andrew Howroyd_, Apr 29 2021 %Y A338671 Cf. A038548, A338664, 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 A338671 nonn %O A338671 1,4 %A A338671 _Thomas Oléron Evans_, Apr 23 2021