# Solving an equation containing a Factorial

I have a question regarding the code to solve a particular equation. This is the equation:

364! / [(365-n)! * 365^(n-1)] <= 0.5


and I need to solve for n.

The code I used is:

Clear[n];
Solve[364!/{(365-n)! 365^(n-1)} <= 0.5, n]


However, it's not solving for n and only expanding 364! with the rest of the equation as it is. Can anyone point out if I'm making a mistake in the code?

• You are using {} and [] parenteses, where you need () – Coolwater Sep 14 '15 at 7:30
• The solution set is infinite... but give Solve[364!/((365 - n)! 365^(n - 1)) <= 1/2 && 0 <= n <= 365, n, Integers] a spin, and ArgMin[{Abs[364!/((365 - n)! 365^(n - 1)) - 1/2], 0 <= n <= 365}, n, Integers] might be more what you're after. – ciao Sep 14 '15 at 7:41

## 2 Answers

For this ("birthday puzzle"), it just easy enough to visualize and "solve immediately" (i.e brute force), e.g.

f[n_] := N[364!/((365 - n)! 365^(n - 1))]
DiscretePlot[f[n], {n, 0, 30}, GridLines -> {None, {1/2}},
Frame -> True]


n->23 or

TableForm[Table[{j, f[j]}, {j, 20, 25}],
TableHeadings -> {None, {"n", "f[n]"}}]


• And now the probability that at least three people (in general m people) share a common birthday. ;-) – Dr. Wolfgang Hintze Sep 14 '15 at 11:07
• math.ucdavis.edu/~tracy/courses/math135A/UsefullCourseMaterial/… – ubpdqn Sep 14 '15 at 12:20
• @Dr.WolfgangHintze tricky indeed :) hyperlink above – ubpdqn Sep 14 '15 at 12:21
• @Dr.WolfgangHintze: Trivial, just a multinomial... or do you mean the reverse problem (number to have >=.5 p)? – ciao Sep 14 '15 at 21:38
• @ciao yes the joy of multinomials...too busy lately...hoping for clear air to play but nothing on horizon...:) – ubpdqn Sep 14 '15 at 21:53

Try this:

    FindRoot[364!/((365 - n)!*365^(n - 1)) == 0.5, {n, 25}]

(*  {n -> 22.7677}   *)


Have fun!