# Packing circles in a rectangle [closed]

You have a rectangle of dimensions $l \times b$ where $l\geq b \geq 1$ and $l,b \in \mathbb R$. How many circles of diameter one unit can be fitted inside this rectangle without overlapping? (Touching of circles is allowed)

I thought this was a simple problem and googled it. And while wikipedia mentions that a hexagonal packing arrangement is best, sometimes packing more circles along the length is better, sometimes packing more circles along the breadth is better. And I'm not convinced that one of the above two hexagonal arrangements is always optimal.

So is there a simple solution for large numbers of length and breadth?

Also a reference table or tip while tackling this problem for not-so-large length and breadth will also be helpful.

Without attempting to answer the general question let me show a small example where the hexagonal packing is not optimal.

Choosing $b=1.6$ and $l=2.6$ won't allow any of those setups to fit in more than 2 circles. However, 3 circles do have space in that with the following setup:

Again, this does not really answer the general case, but shows that even in small cases the hexagonal packing may not find the optimum.

I do think that for large cases the hexagonal packing is close to optimal, but close to the edges there may be non-hexagonal setups which allow more coins to fit in.