CoCalc Shared Filesbirthday.htmlOpen in CoCalc with one click!
Authors: Brian Erickson, Naveen Gadela
Views : 7
Description: Jupyter html version of birthday.ipynb
birthday
In [24]:
def birthday(n):
    if n == 0:
        return 0.
    l = birthday(n-1)
    return l + (1-l)*(n-1)/365.
In [25]:
birthday(1)
Out[25]:
0.0
In [26]:
birthday(2)
Out[26]:
0.0027397260273972603
In [27]:
birthday(17)
Out[27]:
0.31500766529656066
In [28]:
birthday(22)
Out[28]:
0.4756953076625501
In [29]:
birthday(23)
Out[29]:
0.5072972343239854
In [30]:
birthday(30)
Out[30]:
0.7063162427192686
In [31]:
birthday(365)
Out[31]:
1.0
In [ ]: