Last updated: July 31, 2026
Hilbert's Hotel Paradox Calculator
Creators
Dharmendra SinghReviewers

Creators
Dharmendra SinghReviewers
Creators
Dharmendra SinghReviewers

Creators
Dharmendra SinghReviewers
Formula
New room = r + n (finite); doubling room = 2r (infinite bus); rooms freed = n
Where:
- r=Current room number of an existing guest(room)
- n=Number of new guests arriving on a finite bus(guests)
Worked Examples
Finite bus with three arrivals
Guest in room 5 shifts right by 3 rooms.
- 1Start with current room r = 5.
- 2Finite bus size is n = 3.
- 3Apply new room = r + n = 5 + 3 = 8.
- 4The first 3 rooms become available for the new guests.
Single arriving guest
A simple finite shift by one room.
- 1Set r = 12 and n = 1.
- 2Move the existing guest to 12 + 1.
- 3Room 1 is freed for the new arrival.
Large finite bus
Compare a large room number with a large incoming group.
- 1Use r = 1,000,000.
- 2Use n = 999,999.
- 3Add to get the finite-shift room.
- 4Double r to see the infinite-bus rule.
Infinite bus focus
See how doubling preserves a room for every existing guest.
- 1Current room is r = 7.
- 2Finite-bus shift gives 7 + 4 = 11.
- 3Infinite-bus shift gives 2 × 7 = 14.
- 4All odd-numbered rooms remain open for infinitely many newcomers.
Introduction
Hilbert's Hotel is a classic set-theory thought experiment showing that infinite collections behave differently from finite ones. This calculator models the two most famous room-reassignment rules so you can test the paradox numerically.
What the Paradox Shows
A hotel with countably infinite rooms can still accept more guests by reassigning existing occupants.
The hotel is already full.
Every occupied room has a positive integer label.
Existing guests can all move at once.
Finite arrivals need only a finite shift.
Infinite arrivals need a different bijection.
Finite Bus Rule
When n new guests arrive, every existing guest in room r moves to room r + n.
Start with any room number r ≥ 1.
Count the arriving guests as n ≥ 1.
Move each existing guest forward by n rooms.
Rooms 1 through n become empty.
Each new guest gets one of those freed rooms.
Infinite Bus Rule
Doubling room numbers keeps all even rooms occupied and frees every odd room.
Move each guest from r to 2r.
Every existing guest still gets exactly one room.
All odd rooms remain empty.
Those odd rooms can host infinitely many new guests.
This works because positive integers and even integers have the same cardinality.
Input Rules
The calculator accepts positive integers and floors decimals before applying the paradox steps.
currentRoomNumber must be at least 1.
newGuestsCount must be at least 1.
Math.floor handles decimal entries.
Non-finite values are rejected.
Invalid input returns safe zero defaults with an error message.
Understanding the Outputs
Each output highlights a different part of the thought experiment.
- 1
newRoomNumber is the finite-bus destination.
- 2
roomsFreed tells you how many low rooms open up.
- 3
doublingRoomNumber shows the infinite-bus destination.
- 4
Compare the finite and infinite strategies directly.
- 5
Use the values to verify manual reasoning.
Set Theory Connection
The paradox is really a statement about one-to-one correspondences between infinite sets.
Natural numbers can pair with even numbers.
A proper subset can match the full set in size.
Finite intuition fails for infinite cardinality.
Room mappings behave like functions on sets.
Hilbert's Hotel is often used to introduce countable infinity.
Best Uses for This Calculator
This tool is most helpful for learning, explaining, and checking infinite-hotel examples.
Classroom demonstrations
Homework verification
Set-theory intuition building
Quick examples for presentations
Comparing finite vs infinite rearrangements
FAQs
What does Hilbert's Hotel Paradox Calculator compute?
It computes the new room for an existing guest under the finite-bus shift and the infinite-bus doubling rule.
Why does the finite scenario use r + n?
Shifting every occupied room by n opens exactly the first n rooms for the incoming finite group.
Why does the infinite scenario use 2r?
Doubling sends existing guests into even-numbered rooms and leaves all odd-numbered rooms empty for infinitely many newcomers.
What happens to decimal inputs?
The pure calculation floors both values with Math.floor before validating them as positive integers.
Can currentRoomNumber be 0?
No. Room numbers must start at 1 because the model uses positive integers.
Does this calculator assign rooms to every new guest individually?
No. It focuses on where an existing guest moves and how many rooms are freed, which is enough to illustrate the paradox.
Is the paradox physically possible?
It is a mathematical thought experiment, not a claim about real hotels.
How can I verify the finite result manually?
Take the existing room number r and add the number of new guests n.
How can I verify the infinite-bus result manually?
Multiply the existing room number by 2 and note that every odd room stays available.