Files
freeCodeCamp/curriculum/challenges/italian/10-coding-interview-prep/project-euler/problem-464-mbius-function-and-intervals.md
2022-03-04 19:46:29 +05:30

1.3 KiB

id, title, challengeType, forumTopicId, dashedName
id title challengeType forumTopicId dashedName
5900f53d1000cf542c51004f Problema 464: Funzione di Möbius e intervalli 5 302139 problem-464-mbius-function-and-intervals

--description--

La funzione di Möbius, indicata con μ(n), è definita come:

  • μ(n) = (-1)^{ω(n)} se n è quadrato (dove ω(n) è il numero di fattori primi distinti di n)
  • μ(n) = 0 se n non è privo di quadrati.

Sia P(a, b) il numero di interi n nell'intervallo [a, b] in modo che μ(n) = 1.

Sia N(a, b) il numero di interi n nell'intervallo [a, b] in modo che μ(n) = -1.

Per esempio, P(2, 10) = 2 e N(2, 10) = 4.

Sia C(n) il numero di coppie intere (a, b) in modo che:

  • 1 ≤ a ≤ b ≤ n,
  • 99 \times N(a, b) ≤ 100 \times P(a, b), e
  • 99 \times P(a, b) ≤ 100 \times N(a, b).

Per esempio, C(10) = 13, C(500) = 16\\,676 e C(10\\,000) = 20\\,155\\,319.

Trova C(20\\,000\\,000).

--hints--

mobiusFunctionAndIntervals() dovrebbe restituire 198775297232878.

assert.strictEqual(mobiusFunctionAndIntervals(), 198775297232878);

--seed--

--seed-contents--

function mobiusFunctionAndIntervals() {

  return true;
}

mobiusFunctionAndIntervals();

--solutions--

// solution required