Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I a math question, that I hope someone can help me with.

I have 342 Squares sized at 11 x 11 cm and need to calculate how to pack them in a circle and find out how large the circle must be to pack them all in and my math skills are coming to a short here, so wonder if anyone here have a good hint to how I can solve this, without having to cut out 342 pieces of paper and start packing them.

Hopefully there is somehow an easy formular that can be used to determine this issue.

btw. the squares cannot be rotated to fit into the circle.

Bonus question is if it possible to get Excel to graphically show how to place them within the circle.

share|improve this question
    
Excel has, as part of it, Visual Basic for Applications, which is pretty much a full-fledged programming language. So, yes, it's possible to get Excel to display it. Is it easy to do so? probably not. –  anorton Dec 13 '13 at 22:45
add comment

3 Answers 3

The following fact may be helpful:

Let $C_r$ be the circle of radius $r$ in the complex plane centered at the origin. It is easy to prove that $|\{(x,y): x,y \in \mathbb{Z}, \sqrt{x^2 + y^2} \leq r\} |$, the number of integer lattice points contained in disk, is asymptotic to $\pi r^2$.

share|improve this answer
add comment

enter image description here

The following Excel VBA code created the image to demonstrate how to assemble an Excel graphics by adding Shape objects to the active worksheet:

Option Explicit

Sub addShapeDemo()
    Dim shape As Excel.shape
    Dim x As Single
    Dim y As Single
    Dim mx As Single
    Dim my As Single
    Dim col As Integer
    Dim cols As Integer
    Dim row As Integer
    Dim rows As Integer
    Dim d2 As Single
    Dim xMin As Single
    Dim yMin As Single
    Dim squares As Integer

    Const radius = 120.3964   '  results in 341 squares
    Const a = 11              '  square dimension

    mx = 600                  '  center of the circle
    my = 600

    '  clean our sheet from previous drawings
    On Error Resume Next
    ActiveSheet.DrawingObjects.Delete

    '  draw the circle nicely colored
    Set shape = ActiveSheet.Shapes.AddShape(msoShapeOval, Left:=mx - radius, _
                                            Top:=my - radius, Width:=2 * radius, _
                                            Height:=2 * radius)
    shape.Select
    Selection.ShapeRange.Fill.Visible = msoFalse
    With Selection.ShapeRange.Line
        .ForeColor.RGB = RGB(255, 0, 0)
        .Weight = 2.25
    End With
    With Selection.ShapeRange.Fill
        .Visible = msoTrue
        .ForeColor.RGB = RGB(255, 255, 0)
    End With

    '  draw the boxes
    rows = (2 * radius) \ a
    yMin = my - a * 0.5 * ((2 * rows) \ 2)

    For row = 1 To rows
        ' find out how many columns to place
        ' outer corner must stay within our circle
        y = yMin + (row - 1) * a
        If row <= rows \ 2 Then
            cols = (2# * ((radius * radius - (y - my) * (y - my)) ^ 0.5)) \ a
        Else
            cols = (2# * ((radius * radius - (y - my + a) * (y - my + a)) ^ 0.5)) \ a
        End If

        '  center the line
        xMin = mx - a * 0.5 * ((2 * cols) \ 2)

        For col = 1 To cols
            x = xMin + (col - 1) * a
            ActiveSheet.Shapes.AddShape msoShapeRectangle, Left:=x, _
                               Top:=y, Width:=a, Height:=a
            squares = squares + 1
        Next col
    Next row
    MsgBox squares & " squares"
End Sub
share|improve this answer
    
I don't understand the downvote. This is directly responsive to the question. Yes, we are a math site, not a programming site, but if he wants to do it I don't see a problem. –  Ross Millikan Dec 14 '13 at 3:53
    
The first version placed all squares in a matrix fashion. This left more gaps than necessary. The new version directly computes the number of squares per line without try-and-error. –  Axel Kemper Dec 14 '13 at 13:28
add comment

You said the squares need to be axis aligned, but do they have to be on the lattice points? If you require that they be on lattice points and the center of the circle also be on a lattice point, this is almost an example of the Gauss circle problem. Each square can be identified with the lattice point farthest from the origin. You need $342$ lattice points within the circle ignoring the ones on the axes. OEIS A000328 tells us there are 377 lattice points within a circle of radius $11$, we deduct $45$ for the ones on the axes, and we find $332$ squares within the circle. Now we just need to increase the radius to get the other $10$ squares. Each time we get a new positive pair $(m,n)$ such that $m^2+n^2 \lt r^2$ we get $8$ more squares (unless $m=n,$ then we get $4$). You get the first $8$ at $\sqrt {122}$ and another $16$ at $\sqrt {125}$ (because $11^2+2^2=10^2+5^2=125$) so that is the answer: a circle of radius $\sqrt {125}=5\sqrt 5 \approx 11.18$, which includes $356$ squares

You can improve on this if the squares can slide off the lattice points and may be able to if the center need not be on a lattice point. For some numbers of squares it will help to have it at the center of a square. For example, to have one square in the circle requires $r=2\sqrt 2$ (and gets you $4$ squares) if the center has to be on a lattice point, but $r=\sqrt 2$ works if it need not be.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.