mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-08 09:00:38 -04:00
1.3 KiB
1.3 KiB
id, title, challengeType, forumTopicId, dashedName
| id | title | challengeType | forumTopicId | dashedName |
|---|---|---|---|---|
| 5900f53d1000cf542c51004f | Problema 464: Funzione di Möbius e intervalli | 1 | 302139 | problem-464-mbius-function-and-intervals |
--description--
La funzione di Möbius, indicata con μ(n), è definita come:
μ(n) = (-1)^{ω(n)}senè quadrato (doveω(n)è il numero di fattori primi distinti din)μ(n) = 0sennon è 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), e99 \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