365日で23人の誕生日が衝突する可能性は50%
total = 365.0
1 - (2..23).inject((total - 1) / total) { |result, n| result * (total - n + 1) / total }
=> 0.5072972343239855
Go to list of users who liked
More than 3 years have passed since last update.
365日で23人の誕生日が衝突する可能性は50%
total = 365.0
1 - (2..23).inject((total - 1) / total) { |result, n| result * (total - n + 1) / total }
=> 0.5072972343239855
Register as a new user and use Qiita more conveniently
Go to list of users who liked