login
A327142
a(n) is the number of different sizes of integer-sided rectangles which can be placed inside an n X n square and with length greater than n.
1
0, 0, 0, 0, 1, 1, 1, 3, 3, 6, 6, 6, 10, 10, 15, 15, 21, 21, 21, 28, 28, 36, 36, 36, 45, 45, 55, 55, 66, 66, 66, 78, 78, 91, 91, 91, 105, 105, 120, 120, 120, 136, 136, 153, 153, 171, 171, 171, 190, 190, 210, 210, 210, 231, 231, 253, 253, 276, 276, 276, 300, 300, 325, 325
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
a(n) = A327141(n) - A000217(n).
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
Sequence in context: A160745 A105676 A127739 * A175394 A070318 A257537
KEYWORD
nonn,easy
AUTHOR
Kirill Ustyantsev, Aug 23 2019
STATUS
approved