Exact arithmetic, not floating point
Two boxes take n, the pool of items, and r, how many you choose; the defaults are 10 and 3. Each factorial is a simple loop multiplying BigInt values, so products stay exact however long they grow, and ordinary floating point never enters the calculation. The page reports P(n,r), n! divided by (n minus r)!, and C(n,r), derived as P divided by r!, with the working spelled out beneath.
A worked example
The defaults print P(10,3) = 720 and C(10,3) = 120, and the numbered steps read: 10! = 3628800, then 10! over 7! equals 720, then 720 over 3! equals 120. Answers longer than forty digits are abbreviated in place, so 100! appears as 93326215443944152681, an ellipsis, its final ten digits, and a note that the figure runs to 158 digits.
Guards and edge readings
Both boxes are meant for whole numbers between 0 and 1000. Decimal input floors silently, and anything negative or above 1000 blanks the two results behind a single instruction line. An r above n short-circuits the maths: both tiles show 0 and the steps collapse to one note that nothing can be chosen. Large counts stay honest, with P(1000,2) printing 999000 exactly. The random number generator samples the sets these figures count, and the GCD and LCM calculator shares the same integer-exact style.
Where it stops
- n above 1000 is refused outright even though the arithmetic could continue; 1000! already runs to 2568 digits.
- Display truncation means a very long answer cannot be read in full, let alone copied.
- No permutations with repetition, no multinomials, no follow-on probabilities.
- Every keystroke recomputes three full factorials, so n near 1000 can lag on slower machines.
Questions people ask
When do I read P and when C?
P counts arrangements, where handing president and treasurer different roles makes different outcomes. C counts groups, where the same trio is one set whatever the order.
Is 0! handled?
Yes. The loop for zero multiplies nothing and returns 1, matching the definition, and the steps display it.
Why does a big answer end in so many zeros?
Tens form from paired twos and fives across the product, so the tail is real arithmetic made visible by the truncation.