Project Euler

Problem #247

Consider the region constrained by 1 ≤ x and 0 ≤ y ≤ ^(1)/_(x).

Let S_(1) be the largest square that can fit under the curve.
Let S_(2) be the largest square that fits in the remaining area, and so on.
Let the index of S_(n) be the pair (left, below) indicating the number of squares to the left of S_(n) and the number of squares below S_(n).

The diagram shows some such squares labelled by number.
S_(2) has one square to its left and none below, so the index of S_(2) is (1,0).
It can be seen that the index of S_(32) is (1,1) as is the index of S_(50).
50 is the largest n for which the index of S_(n) is (1,1).

What is the largest n for which the index of S_(n) is (3,3)?