Dividing factorials on 15C CE
|
01-10-2024, 08:38 PM
Post: #21
|
|||
|
|||
RE: Dividing factorials on 15C CE
(01-10-2024 07:54 PM)Thomas Klemm Wrote: I just hope we clarified that David was not talking about the division 49/2 but about (1 * 50/1 * 49)/2. I understood it in that way too, but I already knew this property of the algorithm. Now about my previous comment: (01-09-2024 04:38 PM)J-F Garnier Wrote:(01-09-2024 01:23 AM)Thomas Klemm Wrote: P(50, 45) = 1 * 50 * 49 * 48 * 47 * 46 Nobody responded to my remark, and I'm not sure Thomas fully understood it. My point is that Perm(50, 45) is NOT 1 * 50 * 49 * 48 * 47 * 46 . This is Perm(50,5). And so the Python perm code Thomas posted is wrong. Also, the Python comb code is very inefficient to compute simple values such as comb(50,5), that the code computes as: comb(50,5) = 1 * 50/1 * 49/2 * 48/3 * 47/4 * 46/5 * 45/6 * 44/7 * 43/8 * ... * 7/44 * 6/45 This kills the claim of avoiding rounding errors. Instead it should just be: comb(50,5) = 1 * 50/1 * 49/2 * 48/3 * 47/4 * 46/5 J-F |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)