Files
freeCodeCamp/curriculum/challenges/japanese/10-coding-interview-prep/project-euler/problem-467-superinteger.md
2022-01-23 00:08:20 +09:00

1.9 KiB

id, title, challengeType, forumTopicId, dashedName
id title challengeType forumTopicId dashedName
5900f5411000cf542c510052 問題 467: 超越整数 5 302142 problem-467-superinteger

--description--

整数 n の数字が別の整数 s の数字の部分列になる場合、整数 s を整数 n の「超越整数」と呼ぶことにします。

例えば、2718281828 は 18828 の超越整数ですが、314159 は 151 の超越整数ではありません。

p(n)n 番目の素数とし、c(n)n 番目の合成数とします。 例えば、p(1) = 2, p(10) = 29, c(1) = 4, c(10) = 18 です。

\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}

\\{p(i)\\} の数字根からなる数列を P^D とすると、次のようになります (C^D\\{c(i)\\} に対して同様に定義されます)。

\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}

P^D の最初の n 個の要素をつなげた整数を P_n とします (C_nC^D に対して同様に定義されます)。

\begin{align} & P_{10} = 2\\,357\\,248\\,152 \\\\ & C_{10} = 4\\,689\\,135\\,679 \end{align}

P_nC_n の共通の超越整数である最小の正の整数を、f(n) とします。 例えば、f(10) = 2\\,357\\,246\\,891\\,352\\,679, f(100)\bmod 1\\,000\\,000\\,007 = 771\\,661\\,825 です。

f(10\\,000)\bmod 1\\,000\\,000\\,007 を求めなさい。

--hints--

superinteger()775181359 を返す必要があります。

assert.strictEqual(superinteger(), 775181359);

--seed--

--seed-contents--

function superinteger() {

  return true;
}

superinteger();

--solutions--

// solution required