One way to find the probability of no birthday match in a room with $n=25$ people is shown in the Wikipedia link of my first Comment. Here is a slightly different way to write it:
$$P(\text{No Match}) = \frac{{}_{365}P_{25}}{365^{25}}
= \prod_{i=0}^{24}\left(1 - \frac{i}{365}\right) = 0.4313.$$
In R, this can be evaluated as follows. [In R, 0:24
is a list
of the integers from 0 through 24; similarly for other uses of :
.]
prod((365:(365-24))/365)
[1] 0.4313003
prod(1 - (0:24)/365)
[1] 0.4313003
prod(365:341)/365^25
[1] 0.4313003
So $P(\text{At least one match}) = 1 - 0.4313 = 0.5687.$
You can use R to make the first figure in the Wikipedia article as shown below.
The green line shows that for 23 people or more the probability of at
least one birthday match exceeds $1/2.$
n = 1:60
p = numeric(60)
for (i in n) {
q = prod(1 - (0:(i-1))/365)
p[i] = 1 - q
}
plot(n, p)
lines(c(0,23,23), c(.5,.5,0), col="green2")
Some people are surprised that matches occur with such high probability.
Maybe they are thinking at it would take 366 people in a room to be
sure of a match. But the graph shows that probability does not
increase linearly with room size. So it is "nearly sure" (probability 0.9941) to get a
match in a room of only 60 people. And the probability of at least one
match is above 1/2 in a room of 23 people.
Here is a table of some of these 60 probabilities (truncated at 30):
cbind(n, p)
n p
[1,] 1 0.000000000
[2,] 2 0.002739726
[3,] 3 0.008204166
[4,] 4 0.016355912
[5,] 5 0.027135574
[6,] 6 0.040462484
[7,] 7 0.056235703
[8,] 8 0.074335292
[9,] 9 0.094623834
[10,] 10 0.116948178
[11,] 11 0.141141378
[12,] 12 0.167024789
[13,] 13 0.194410275
[14,] 14 0.223102512
[15,] 15 0.252901320
[16,] 16 0.283604005
[17,] 17 0.315007665
[18,] 18 0.346911418
[19,] 19 0.379118526
[20,] 20 0.411438384
[21,] 21 0.443688335
[22,] 22 0.475695308
[23,] 23 0.507297234 # first to exceed 1/2
[24,] 24 0.538344258
[25,] 25 0.568699704
[26,] 26 0.598240820
[27,] 27 0.626859282
[28,] 28 0.654461472
[29,] 29 0.680968537
[30,] 30 0.706316243
...
[60,] 60 0.994122661
Notes: I agree with @Ben (+1) that your equation doesn't work to get the probability of a match between
two randomly chosen people. however, suppose you're among the 25 people in a room, then with probability $1 -\left(\frac{364}{365}\right)^{24} = 0.0637$ at least one other person in the room will match your birthday.
Thus, another wrong 'intuitive' approach to the main birthday problem
above is to confuse the probability someone will match your birthday
with the larger probability that some two (or more) people will have matching birthdays. (Among 25 people there are ${25 \choose 2} = 300$ pairs of people who may have matching birthdays.)
Finally, this Q&A shows a method of simulating the probability of a birthday match. With a slight modification, that method can also be used
to find the expected number of matches.