2018-09-30 23:01:58 +01:00
---
id: 5900f3ba1000cf542c50fecd
title: 'Problem 78: Coin partitions'
2020-11-27 19:02:05 +01:00
challengeType: 5
2019-08-05 09:17:33 -07:00
forumTopicId: 302191
2018-09-30 23:01:58 +01:00
---
2020-11-27 19:02:05 +01:00
# --description--
2020-02-28 21:39:47 +09:00
2018-09-30 23:01:58 +01:00
Let p(n) represent the number of different ways in which n coins can be separated into piles. For example, five coins can be separated into piles in exactly seven different ways, so p(5)=7.
2020-02-07 17:47:35 +09:00
< div style = 'text-align: center;' >
2020-11-27 19:02:05 +01:00
| Coin piles |
| ----------------- |
| OOOOO |
| OOOO O |
| OOO OO |
| OOO O O |
| OO OO O |
| OO O O O |
| O O O O O |
2020-02-07 17:47:35 +09:00
< / div >
2020-11-27 19:02:05 +01:00
Find the least value of `n` for which p(`n` ) is divisible by one million.
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
# --hints--
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
`coinPartitions()` should return a number.
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
```js
assert(typeof coinPartitions() === 'number');
```
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
`coinPartitions()` should return 55374.
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
```js
assert.strictEqual(coinPartitions(), 55374);
2018-09-30 23:01:58 +01:00
```
2020-11-27 19:02:05 +01:00
# --seed--
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
## --seed-contents--
2018-09-30 23:01:58 +01:00
```js
2020-02-28 21:39:47 +09:00
function coinPartitions() {
2020-09-15 09:57:40 -07:00
2018-09-30 23:01:58 +01:00
return true;
}
2020-02-28 21:39:47 +09:00
coinPartitions();
2018-09-30 23:01:58 +01:00
```
2020-11-27 19:02:05 +01:00
# --solutions--
2018-09-30 23:01:58 +01:00
```js
// solution required
```