Counting the Number of "Hollow" Square Laminae That Can Form One, Two, Three, ... Distinct Arrangements
Define N(t) as the number of hollow square laminae that can be formed using exactly t tiles. How many values of t <= 10^6 satisfy 1 <= N(t) <= 10?
Problem Statement
This archive keeps the full statement, math, and original media on the page.
We shall define a square lamina to be a square outline with a square "hole" so that the shape possesses vertical and horizontal symmetry.
Given eight tiles it is possible to form a lamina in only one way: \(3 \times 3\) square with a \(1 \times 1\) hole in the middle. However, using thirty-two tiles it is possible to form two distinct laminae.

If \(t\) represents the number of tiles used, we shall say that \(t = 8\) is type \(L(1)\) and \(t = 32\) is type \(L(2)\).
Let \(N(n)\) be the number of \(t \le 1000000\) such that \(t\) is type \(L(n)\); for example, \(N(15) = 832\).
What is \(\sum \limits _{n = 1}^{10} N(n)\)?
Problem 174: Counting the Number of “Hollow” Square Laminae That Can Form One, Two, Three, … Distinct Arrangements
Mathematical Foundation
Theorem 1. (Tile-count parameterization.) Every hollow square lamina with outer side , inner side , , , , uses tiles where . In particular, .
Proof. From Problem 173, . Setting gives , so . Since and , we have and .
Theorem 2. (Reduction to divisor counting.) Write . Then equals the number of divisors of satisfying .
Proof. Setting , the equation must hold with (since requires ). Each such factorization corresponds to a unique lamina. The number of ordered pairs with and is the number of divisors of strictly less than :
which in both cases equals .
Lemma 1. (Divisor sieve.) For , the array can be computed in time by iterating and for each , incrementing for all with .
Proof. Each pair with and is visited exactly once. The total number of pairs is .
Editorial
That Can Form One, Two, Three, … Distinct Arrangements N(t) = number of laminae with exactly t tiles. Count values of t <= 10^6 with 1 <= N(t) <= 10. Key insight: t = 4m, and N(t) = number of divisors k of m with k < sqrt(m).
Pseudocode
M = N / 4 # N = 10^6, so M = 250000
count[1..M] = 0
For k from 1 to floor(sqrt(M)):
For q from k+1 to M/k:
m = k * q
count[m] += 1
answer = 0
For m from 1 to M:
If 1 <= count[m] <= 10 then
answer += 1
Return answer
Complexity Analysis
- Time: where . The inner loop total is bounded by .
- Space: for the count array.
Answer
Code
Each problem page includes the exact C++ and Python source files from the local archive.
#include <bits/stdc++.h>
using namespace std;
int main(){
// Problem 174: Count values of t <= 10^6 with 1 <= N(t) <= 10
// where N(t) = number of hollow square laminae with exactly t tiles.
// t = 4*m, N(t) = number of divisors k of m with k < sqrt(m).
const int LIMIT = 1000000;
const int M = LIMIT / 4; // 250000
vector<int> N(M + 1, 0);
// For each k, count factorizations m = k * q with k < q
for(int k = 1; (long long)k * k < M; k++){
for(int q = k + 1; (long long)k * q <= M; q++){
N[k * q]++;
}
}
int ans = 0;
for(int m = 1; m <= M; m++){
if(N[m] >= 1 && N[m] <= 10) ans++;
}
cout << ans << endl;
return 0;
}
"""
Problem 174: Counting the Number of "Hollow" Square Laminae
That Can Form One, Two, Three, ... Distinct Arrangements
N(t) = number of laminae with exactly t tiles.
Count values of t <= 10^6 with 1 <= N(t) <= 10.
Key insight: t = 4m, and N(t) = number of divisors k of m with k < sqrt(m).
"""
import math
def solve():
LIMIT = 1_000_000
M = LIMIT // 4 # 250000
N = [0] * (M + 1)
# Sieve: for each k, find all q > k with k*q <= M
k = 1
while k * k < M:
q = k + 1
while k * q <= M:
N[k * q] += 1
q += 1
k += 1
ans = sum(1 for m in range(1, M + 1) if 1 <= N[m] <= 10)
print(ans)
if __name__ == "__main__":
solve()