fix(curriculum): clean-up Project Euler 462-480 (#43069)

* fix: clean-up Project Euler 462-480

* fix: missing image extension

* fix: corrections from review

Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>

Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>
This commit is contained in:
gikf
2021-07-30 17:32:21 +02:00
committed by GitHub
parent a2b2ef3f75
commit 397a9f0c3e
19 changed files with 309 additions and 240 deletions

View File

@ -8,26 +8,41 @@ dashedName: problem-467-superinteger
# --description--
An integer s is called a superinteger of another integer n if the digits of n form a subsequence of the digits of s.
An integer $s$ is called a superinteger of another integer $n$ if the digits of $n$ form a subsequence of the digits of $s$.
For example, 2718281828 is a superinteger of 18828, while 314159 is not a superinteger of 151.
Let p(n) be the nth prime number, and let c(n) be the nth composite number. For example, p(1) = 2, p(10) = 29, c(1) = 4 and c(10) = 18. {p(i) : i ≥ 1} = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, ...} {c(i) : i ≥ 1} = {4, 6, 8, 9, 10, 12, 14, 15, 16, 18, ...}
Let $p(n)$ be the $n$th prime number, and let $c(n)$ be the $n$th composite number. For example, $p(1) = 2$, $p(10) = 29$, $c(1) = 4$ and $c(10) = 18$.
Let PD the sequence of the digital roots of {p(i)} (CD is defined similarly for {c(i)}): PD = {2, 3, 5, 7, 2, 4, 8, 1, 5, 2, ...} CD = {4, 6, 8, 9, 1, 3, 5, 6, 7, 9, ...}
$$\begin{align}
& \\{p(i) : i ≥ 1\\} = \\{2, 3, 5, 7, 11, 13, 17, 19, 23, 29, \ldots \\} \\\\
& \\{c(i) : i ≥ 1\\} = \\{4, 6, 8, 9, 10, 12, 14, 15, 16, 18, \ldots \\}
\end{align}$$
Let Pn be the integer formed by concatenating the first n elements of PD (Cn is defined similarly for CD). P10 = 2357248152 C10 = 4689135679
Let $P^D$ the sequence of the digital roots of $\\{p(i)\\}$ ($C^D$ is defined similarly for $\\{c(i)\\}$):
Let f(n) be the smallest positive integer that is a common superinteger of Pn and Cn. For example, f(10) = 2357246891352679, and f(100) mod 1 000 000 007 = 771661825.
$$\begin{align}
& P^D = \\{2, 3, 5, 7, 2, 4, 8, 1, 5, 2, \ldots \\} \\\\
& C^D = \\{4, 6, 8, 9, 1, 3, 5, 6, 7, 9, \ldots \\}
\end{align}$$
Find f(10 000) mod 1 000 000 007.
Let $P_n$ be the integer formed by concatenating the first $n$ elements of $P^D$ ($C_n$ is defined similarly for $C^D$).
$$\begin{align}
& P_{10} = 2\\,357\\,248\\,152 \\\\
& C_{10} = 4\\,689\\,135\\,679
\end{align}$$
Let $f(n)$ be the smallest positive integer that is a common superinteger of $P_n$ and $C_n$. For example, $f(10) = 2\\,357\\,246\\,891\\,352\\,679$, and $f(100)\bmod 1\\,000\\,000\\,007 = 771\\,661\\,825$.
Find $f(10\\,000)\bmod 1\\,000\\,000\\,007$.
# --hints--
`euler467()` should return 775181359.
`superinteger()` should return `775181359`.
```js
assert.strictEqual(euler467(), 775181359);
assert.strictEqual(superinteger(), 775181359);
```
# --seed--
@ -35,12 +50,12 @@ assert.strictEqual(euler467(), 775181359);
## --seed-contents--
```js
function euler467() {
function superinteger() {
return true;
}
euler467();
superinteger();
```
# --solutions--