2018-09-30 22:01:58 +00:00
---
id: 5900f5141000cf542c510027
title: 'Problem 423: Consecutive die throws'
2020-11-27 18:02:05 +00:00
challengeType: 5
2019-08-05 16:17:33 +00:00
forumTopicId: 302093
2021-01-13 02:31:00 +00:00
dashedName: problem-423-consecutive-die-throws
2018-09-30 22:01:58 +00:00
---
2020-11-27 18:02:05 +00:00
# --description--
2018-09-30 22:01:58 +00:00
Let n be a positive integer.
2020-11-27 18:02:05 +00:00
2018-09-30 22:01:58 +00:00
A 6-sided die is thrown n times. Let c be the number of pairs of consecutive throws that give the same value.
2020-11-27 18:02:05 +00:00
For example, if n = 7 and the values of the die throws are (1,1,5,6,6,6,3), then the following pairs of consecutive throws give the same value: (1,1,5,6,6,6,3) (1,1,5,6,6,6,3) (1,1,5,6,6,6,3) Therefore, c = 3 for (1,1,5,6,6,6,3).
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
Define C(n) as the number of outcomes of throwing a 6-sided die n times such that c does not exceed π(n).1 For example, C(3) = 216, C(4) = 1290, C(11) = 361912500 and C(24) = 4727547363281250000.
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
Define S(L) as ∑ C(n) for 1 ≤ n ≤ L. For example, S(50) mod 1 000 000 007 = 832833871.
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
Find S(50 000 000) mod 1 000 000 007.
2018-09-30 22:01:58 +00:00
1 π denotes the prime-counting function, i.e. π(n) is the number of primes ≤ n.
2020-11-27 18:02:05 +00:00
# --hints--
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
`euler423()` should return 653972374.
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
```js
assert.strictEqual(euler423(), 653972374);
2018-09-30 22:01:58 +00:00
```
2020-11-27 18:02:05 +00:00
# --seed--
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
## --seed-contents--
2018-09-30 22:01:58 +00:00
```js
function euler423() {
2020-09-15 16:57:40 +00:00
2018-09-30 22:01:58 +00:00
return true;
}
euler423();
```
2020-11-27 18:02:05 +00:00
# --solutions--
2018-09-30 22:01:58 +00:00
```js
// solution required
```