Birthday paradox, 1 test case failed, why?

Your code doesn’t give right ans for p = 1
It should be 366

If your doubt is resolved please mark it as closed.