Saved

Press the star next to a tool's name to save it.

All my tools

Hilbert's Hotel Paradox Calculator

Use this Hilbert's hotel paradox calculator to see how a full infinite hotel takes new guests and coaches, and to find the room for a passenger or the guest in a room.

Restored your last values ·

The hotel has infinitely many rooms, numbered 1, 2, 3, …, and all are full. To see the moves for new guests, enter a room number and the number of new guests, or leave the number empty for infinitely many. To place a passenger from a coach, enter the coach and seat numbers. To look a room up, enter its number.

Everything is worked out in your browser. Nothing you type is sent anywhere.

–

–

Choose what you want, fill in the boxes, then press Find the room.

See full result

A Hilbert's hotel paradox calculator shows how a hotel with infinitely many rooms, all full, can still take in new guests. Enter a room number and a number of new guests to see how the guests move, or enter a coach and seat number to see where a passenger from one of infinitely many coaches is placed. The accounts follow the Wikipedia page on Hilbert's paradox of the Grand Hotel and the page on countable sets, and the work is done in your browser.

How to use the Hilbert's hotel paradox calculator

  1. Choose what you want: a move, a coach passenger or a room look-up.
  2. Enter the room, the number of new guests, or the coach and seat.
  3. Choose the method for coaches.
  4. Press Find the room.

The paradox

The page tells us that the hotel was described by the mathematician David Hilbert in a lecture from 1924 to 1925, and made popular by George Gamow in 1947. It has rooms numbered 1, 2, 3 and so on with no upper limit, and every room is occupied. A new guest arrives. You might say that no room is free, but the page shows that there is a way. The paradox is called veridical, which means that the surprising result is provably true.

One new guest or a few

For one new guest, each guest in room n moves to room n + 1. Room 1 is then free, and nobody is left without a room, because every guest has a room one higher. For k new guests, each guest moves from room n to room n + k, which frees rooms 1 to k. If the guest in room 7 is asked to make room for 5 new guests, they move to room 12. The calculator shows the move and the first ten rooms.

Infinitely many new guests

If infinitely many new guests arrive, the page says that each guest in room n moves to room 2n, twice the previous room number. Every odd-numbered room is then free, and there are infinitely many of them, so the i-th new guest can take room 2i − 1. The guest in room 7 moves to room 14. This works because the odd numbers and the whole numbers can be matched one to one, as the even numbers can, by n ↔ 2n, an example that the page on countable sets gives.

Infinitely many coaches

The hardest case is infinitely many coaches, each with infinitely many passengers. The page describes several methods that give each passenger a different room. In the prime factorization method, the passenger in seat n of coach c goes to room 2ⁿ × 3ᶜ. The page's example is room 2,592, which is the fifth seat of the fourth coach, since 2⁵ × 3⁴ is 32 × 81. Coach 0 is the guests who are already in the hotel, so the guest in seat 3 goes to room 8. Rooms that have any prime factor other than 2 or 3, such as 15, stay empty. The calculator also works backwards: enter 2,592 to see that it is seat 5 of coach 4.

Filling every room

The interleaving method fills the whole hotel. Write the coach number and the seat number with the same number of digits, adding zeros at the front, and then weave the digits together, taking the coach's digit first. The page's examples: the guest in room 1,729 is coach 0 and becomes room 01,070,209, and seat 1,234 of coach 789 goes to room 01,728,394. Every room number can be read back as a coach and a seat, so the calculator can tell who is in any room, and no room is empty. The page also describes methods with triangular numbers and with any list of all pairs, and they too fill the hotel.

What the paradox teaches

The page says the paradox is veridical, and it explains that the sentences there is a guest in every room and no more guests can be accommodated are not the same when there are infinitely many rooms. For a hotel with a finite number of rooms they mean the same thing. The paradox is a lesson in how counting works for infinite sets, and it uses the same one-to-one matching as Galileo's paradox. Mathematicians call a set countable if it can be matched with the whole numbers, and the coach passengers form such a set.

Typing tips

For the move option, leave the number of new guests empty to see the case of infinitely many guests. For the coach option, use coach 0 for a guest who is already in the hotel. For the room look-up, pick the method first, since the same room number means different passengers in the two methods. For example, room 847 stays empty in the prime method, because 847 has the prime factors 7 and 11.

Common mistakes

  • Thinking the hotel has a last room. It has none.
  • Confusing the two coach methods. The prime method leaves rooms empty, the interleaving method does not.
  • Forgetting coach 0. It stands for the guests who are already in the hotel.
  • Applying the rules to a finite hotel. A full finite hotel cannot take anyone.
  • Taking the story as real. It is a thought experiment.

What next

Use this often? Add Hilbert's Ho to your Home screen.

Frequently asked questions

What is Hilbert's hotel paradox calculator?

A tool that shows how the guests of an infinite, full hotel move to make room for new guests or for passengers of infinitely many coaches.

How can a full hotel take a new guest?

Each guest in room n moves to room n + 1, which frees room 1.

How can it take infinitely many new guests?

Each guest in room n moves to room 2n, which frees all the odd-numbered rooms.

How do infinitely many coaches fit?

By the prime factorization method, seat n of coach c goes to room 2ⁿ × 3ᶜ. Seat 5 of coach 4 gets room 2,592.

Is Hilbert's hotel a real contradiction?

No. The page calls it a veridical paradox: the surprising result is provably true for infinite sets.

What went wrong?

We only receive the reason you pick, never what you typed into the tool.

Thanks for your feedback.

More Fun & Lifestyle Tools