/* No birthdays in Picat. From John Allen Paulos https://twitter.com/JohnAllenPaulos/status/1584278111579181056 """ Randomly select 365 people and mark their birthdays on a calendar. Days on which none of the 365 people have a birthday will remain unmarked. Let U be the number of such unmarked days. Then 365/U is approximately the transcendentally ubiquitous number e, 2.718 … Eerie! """ Cf my Gamble model gamble_no_birthdays.rkt This program was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ import ppl_distributions, ppl_utils. import util. % import ordset. main => go. /* var : p Probabilities (truncated): 2.744360902255639: 0.0661000000000000 2.723880597014925: 0.0653000000000000 2.703703703703704: 0.0643500000000000 2.765151515151515: 0.0628500000000000 ......... 2.32484076433121: 0.0001500000000000 3.201754385964912: 0.0001000000000000 3.258928571428572: 0.0000500000000000 2.29559748427673: 0.0000500000000000 mean = 2.72667 */ go ?=> reset_store, run_model(10_000,$model,[show_probs_trunc,mean % , % show_percentiles, % show_hpd_intervals,hpd_intervals=[0.94], % show_histogram, % min_accepted_samples=1000,show_accepted_samples=true ]), nl, % show_store_lengths,nl, % fail, nl. go => true. model() => N = 365, P = N / (N - random_integer1_n(N,N).remove_dups.len), add("p",P).