OFFSET
1,4
COMMENTS
Note that rectangles of size 0 are not accepted (i.e., the tiles may not be formed into a single rectangle).
Finding a(n) is equivalent to counting the positive integer solutions (x,y,z,w) of n = xy + zw such that:
i) x >= y,z,w
ii) z >= w
iii) if x = z then y >= w
These conditions ensure that identical pairs are not counted twice by permuting the values of the variables.
FORMULA
G.f.: (B(x)^2 + B(x^2))/2 where B(x) is the g.f. of A038548. - Andrew Howroyd, Apr 29 2021
EXAMPLE
a(5) = 3, since there are 3 ways to form 2 rectangles from 5 identical square tiles:
1) 2 X 2 and 1 X 1
2) 3 X 1 and 2 X 1
3) 4 X 1 and 1 X 1
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.
PROG
(Python)
import numpy as np
# This sets the number of terms:
nits = 20
# This list will contain the sequence
seq = []
# The indices of the sequence:
for i in range(1, nits + 1):
# This variable counts the pairs found for each total area i
count = 0
# The longest side of either rectangle:
for a in range(1, i):
# The other side of the same rectangle:
for b in np.arange(1, 1 + min(a, np.floor(i/a))):
# Calculate the area of this rectangle and the remaining area:
area1 = a*b
rem_area = i - a*b
# The longer side of the second rectangle:
for c in np.arange(1, 1 + min(a, rem_area)):
# The shorter side of the second rectangle:
d = rem_area / c
# Check that the solution is valid and not double counted:
if d != int(d) or d > min(a, c) or (a == c and d > b):
continue
# Count the new pair found:
count += 1
# Add to the sequence:
seq.append(count)
for an in seq:
print(an)
(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
CROSSREFS
KEYWORD
nonn
AUTHOR
Thomas Oléron Evans, Apr 23 2021
STATUS
approved