OFFSET
1,8
COMMENTS
Conditions for rectangles L x W which have length L > n: n - L/sqrt(2) > W/sqrt(2) where L/sqrt(2) and W/sqrt(2) are projections on the n X n square's sides.
If a rectangle with sides k X m fits in an n X n square then it fits by putting a parallel (without loss of generality, the longest) on the diagonal of the n X n square. Only the sum k + m really matters in order to see if the k X m rectangle fits in the square; it fits if k + m < sqrt(2) * n. - David A. Corneth, Aug 24 2019
FORMULA
a(n) = binomial(floor(n * sqrt(2)) - n, 2). - David A. Corneth, Aug 24 2019
EXAMPLE
For n = 1, 2, 3, 4 we cannot place rectangles with side length L > n.
For n = 5 we can place a 6 X 1 rectangle inside a 5 X 5 square, so a(5) = 1.
For n = 8 we can place 9 X 1, 9 X 2 and 10 X 1 rectangles inside an 8 X 8 square, so a(8) = 3.
PROG
(C++)
#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
int main() {
int n;
cin>>n;
vector <int> v;
for (int i=1; i<=n; i++)
{int count=0;
// ii-length, jj-width of diagonal rectangle
for (int ii=i+1; ii<=int(sqrt(2)*i); ii++)
for (int jj=1; jj<=i; jj++)
if ((double(i)-double(ii)/sqrt(2))-double(jj)/sqrt(2)>0)
{count++; }
v.push_back(count);
}
for (int i=0; i<v.size(); i++)
cout << v[i] << ", ";
return 0;
}
(PARI) a(n) = {binomial(floor(n * sqrt(2)) - n, 2)} \\ David A. Corneth, Aug 24 2019
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Kirill Ustyantsev, Aug 23 2019
STATUS
approved