freeCodeCamp/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-337-totient-stairst...

995 B

id title challengeType forumTopicId dashedName
5900f4be1000cf542c50ffd0 Problem 337: Totient Stairstep Sequences 5 301995 problem-337-totient-stairstep-sequences

--description--

Let \\{a_1, a_2, \ldots, a_n\\} be an integer sequence of length n such that:

  • a_1 = 6
  • for all 1 ≤ i < n : φ(a_i) < φ(a_{i + 1}) < a_i < a_{i + 1}

φ denotes Euler's totient function.

Let S(N) be the number of such sequences with a_n ≤ N.

For example, S(10) = 4: {6}, {6, 8}, {6, 8, 9} and {6, 10}.

We can verify that S(100) = 482\\,073\\,668 and S(10\\,000)\bmod {10}^8 = 73\\,808\\,307.

Find S(20\\,000\\,000)\bmod {10}^8.

--hints--

totientStairstepSequences() should return 85068035.

assert.strictEqual(totientStairstepSequences(), 85068035);

--seed--

--seed-contents--

function totientStairstepSequences() {

  return true;
}

totientStairstepSequences();

--solutions--

// solution required