| Karim Belabas on Wed, 14 Jun 2023 23:59:49 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: Give up with MT, need help!!! |
* Bill Allombert [2023-06-14 21:30]:
[...]
> But this is not the right way to compute this. You should use
> the recurrence formula for the factorial
> k! = k*(k-1)! and not recompute k!^3, (3*k)!, (6*k)! for all k from scratch.
> (3*k)!= (3*k)*(3*k-1)*(3*k-2)*(3*(k-1))!
> etc.
> Also you should factor out 640320^(3/2) to avoid recomputing it.
... and use binary splitting to have the right complexity
(a multithreaded version remains possible, but harder to get right).
Cheers,
K.B.
--
Pr. Karim Belabas, U. Bordeaux, Vice-président en charge du Numérique
Institut de Mathématiques de Bordeaux UMR 5251 - (+33) 05 40 00 29 77
http://www.math.u-bordeaux.fr/~kbelabas/