It's true that 23 people is enough, but your supporting logic is flawed. 23*22/2=253 which is more than half of 365, sure. But that's not why the odds are greater than 50%. If that's all it took, 20 people would be enough. 20*19/2=190 which is also more than half of 365. But running the simulation, you'll see 20 people is not sufficient. The correct calculation is much more involved than just k*(k-1)/2. It's 1-n!/(n^k*(n-k)!). Plug in n=365 and k=23.