The grandfather of my friend Bob has built a perfect square castle for himself and his family and divided it into 9 perfect square halls and made an armoury in the middle one.

Bob's father divided each of the remaining 8 halls into another 9 perfect square halls and in each middle one he made a garden.

Bob himself divided each of the remaining 64 halls into 9 perfect square halls and in each middle one he made a swimming pool and the rest became bedrooms.

Recently Bob told me that he managed to walk through each bedroom visiting each one of them exactly once and returning back to the one where he started. Each bedroom has a door to another bedroom if they share a wall.

And I being myself decided to check if it's possible before fully trusting him, but I do not have a lot of time, so I'm asking you: can I trust Bob or does he just want to look cool?


Picture of Castle
A=Armoury G=Garden P=Pool

  • 1
    $\begingroup$ Does Bob attempt to visit every bedroom without passing through swimming pools, gardens, and armouries, or is a quick swim between bedrooms acceptable? $\endgroup$ – LogicianWithAHat Dec 9 '15 at 15:54
  • 1
    $\begingroup$ I think the real question is why does Bob need so many bedrooms? $\endgroup$ – orp Dec 9 '15 at 16:27
  • $\begingroup$ @orp Or so many pools?! $\endgroup$ – 9194 Dec 9 '15 at 18:16
  • 1
    $\begingroup$ The bedrooms are used to house his guards —he clearly has many guards based on the size of that armoury. The pools simply serve as a bath for 8 rooms: proper hygiene is important. $\endgroup$ – Ian MacDonald Dec 9 '15 at 18:42
  • 2
    $\begingroup$ Is Bob's last name Sierpinski by any chance? $\endgroup$ – Darrel Hoffman Dec 9 '15 at 20:18

This is


Here is a picture describing why.

r = room
p = pool
g = garden
a = armoury

It's a closed path, so choose any room to start in.
closed path


Bob could have done it.

This is actually pretty easy to prove.

First we only look at the smallest rings of bedroms around the swimming pools.
It is pretty easy to form a cycle by going through those 8 rooms and returning to the one you started at.

Next we look at each 8 of those cycles around the gardens.
To connect those 9 cycles into a bigger circuit we make a total of 7 connections.
For each of those connections we look at a single, not yet connected, wall between 2 adjacent inner cycles and take 4 of their roms, two from each cycle, that stand in a square right next to the wall between the cycles.
If we now severe the connections between the two rooms of each cycle respectively and instead make two new connections between the two pairs that are on opposite sides of the wall between the cycles we have effectively combined two cycles into a single one.
Do that 7 times for each garden and you get 8 cycles each spanning a total of 64 bedrooms.

The last step is to combine those 8 large cycles into a complete cyclet with 7 more of these connections.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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