2021-06-15 00:49:18 -07:00
|
|
|
|
---
|
|
|
|
|
id: 5900f4da1000cf542c50ffec
|
2022-03-02 20:56:06 +05:30
|
|
|
|
title: 'Problema 365: Un grande coefficiente binomiale'
|
2021-06-15 00:49:18 -07:00
|
|
|
|
challengeType: 5
|
|
|
|
|
forumTopicId: 302026
|
|
|
|
|
dashedName: problem-365-a-huge-binomial-coefficient
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# --description--
|
|
|
|
|
|
2022-03-02 20:56:06 +05:30
|
|
|
|
Il coefficiente binomiale $\displaystyle\binom{{10}^{18}}{{10}^9}$ è un numero con più di 9 miliardi ($9 × {10}^9$) di cifre.
|
2021-06-15 00:49:18 -07:00
|
|
|
|
|
2022-03-02 20:56:06 +05:30
|
|
|
|
Sia $M(n, k, m)$ il coefficiente binomiale $\displaystyle\binom{n}{k}$ modulo $m$.
|
2021-06-15 00:49:18 -07:00
|
|
|
|
|
2022-03-02 20:56:06 +05:30
|
|
|
|
Calcola $\sum M({10}^{18}, {10}^9, p \times q \times r)$ per $1000 < p < q < r < 5000$ e $p$, $q$, $r$ numeri primi.
|
2021-06-15 00:49:18 -07:00
|
|
|
|
|
|
|
|
|
# --hints--
|
|
|
|
|
|
2022-03-02 20:56:06 +05:30
|
|
|
|
`hugeBinomialCoefficient()` dovrebbe restituire `162619462356610300`.
|
2021-06-15 00:49:18 -07:00
|
|
|
|
|
|
|
|
|
```js
|
2022-03-02 20:56:06 +05:30
|
|
|
|
assert.strictEqual(hugeBinomialCoefficient(), 162619462356610300);
|
2021-06-15 00:49:18 -07:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
# --seed--
|
|
|
|
|
|
|
|
|
|
## --seed-contents--
|
|
|
|
|
|
|
|
|
|
```js
|
2022-03-02 20:56:06 +05:30
|
|
|
|
function hugeBinomialCoefficient() {
|
2021-06-15 00:49:18 -07:00
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-02 20:56:06 +05:30
|
|
|
|
hugeBinomialCoefficient();
|
2021-06-15 00:49:18 -07:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
# --solutions--
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
// solution required
|
|
|
|
|
```
|