login
A338671
a(n) is the number of distinct ways of arranging n identical square tiles into two rectangles.
1
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, 40, 50, 44, 55, 49, 60, 55, 66, 55, 75, 64, 75, 70, 86, 72, 92, 77, 97, 87, 103, 84, 116, 94, 114, 104, 126, 102, 135, 109, 138, 123, 143, 117, 164, 128, 153, 138, 171
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
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).
Sequence in context: A117174 A320466 A342542 * A343246 A348531 A237824
KEYWORD
nonn
AUTHOR
STATUS
approved