How many squares can fit in a circle without going outside the perimeter?

135 Views Asked by At

How many squares of side length $x$ can fit in a circle of diameter $n\cdot x$, where $n$ is any positive number, such that none of the squares overlap the perimeter of the circle and all of the squares are aligned in a grid (i.e. no zig-zagging of edges)?

For example: enter image description here This is for a project I'm doing using Excel, so it'd be ideal to have a formula, versus an infinite series or a c++ function.

Thanks!

[Edit]: Some folks have suggested this solution but I think that only works when the circle is very large (relative to the squares). For example, a circle of 3x gives a result of 0.4, when clearly (from the image above) you can fit 4 squares inside.