2018-09-30 23:01:58 +01:00
|
|
|
---
|
|
|
|
id: 5900f53d1000cf542c51004f
|
|
|
|
title: 'Problem 464: Möbius function and intervals'
|
2020-11-27 19:02:05 +01:00
|
|
|
challengeType: 5
|
2019-08-05 09:17:33 -07:00
|
|
|
forumTopicId: 302139
|
2021-01-13 03:31:00 +01:00
|
|
|
dashedName: problem-464-mbius-function-and-intervals
|
2018-09-30 23:01:58 +01:00
|
|
|
---
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --description--
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-30 17:32:21 +02:00
|
|
|
The Möbius function, denoted $μ(n)$, is defined as:
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-30 17:32:21 +02:00
|
|
|
- $μ(n) = (-1)^{ω(n)}$ if $n$ is squarefree (where $ω(n)$ is the number of distinct prime factors of $n$)
|
|
|
|
- $μ(n) = 0$ if $n$ is not squarefree.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-30 17:32:21 +02:00
|
|
|
Let $P(a, b)$ be the number of integers $n$ in the interval $[a, b]$ such that $μ(n) = 1$.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-30 17:32:21 +02:00
|
|
|
Let $N(a, b)$ be the number of integers $n$ in the interval $[a, b]$ such that $μ(n) = -1$.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-30 17:32:21 +02:00
|
|
|
For example, $P(2, 10) = 2$ and $N(2, 10) = 4$.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-30 17:32:21 +02:00
|
|
|
Let $C(n)$ be the number of integer pairs $(a, b)$ such that:
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-30 17:32:21 +02:00
|
|
|
- $1 ≤ a ≤ b ≤ n$,
|
|
|
|
- $99 \times N(a, b) ≤ 100 \times P(a, b)$, and
|
|
|
|
- $99 \times P(a, b) ≤ 100 \times N(a, b)$.
|
|
|
|
|
|
|
|
For example, $C(10) = 13$, $C(500) = 16\\,676$ and $C(10\\,000) = 20\\,155\\,319$.
|
|
|
|
|
|
|
|
Find $C(20\\,000\\,000)$.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --hints--
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-30 17:32:21 +02:00
|
|
|
`mobiusFunctionAndIntervals()` should return `198775297232878`.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
```js
|
2021-07-30 17:32:21 +02:00
|
|
|
assert.strictEqual(mobiusFunctionAndIntervals(), 198775297232878);
|
2018-09-30 23:01:58 +01:00
|
|
|
```
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --seed--
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
## --seed-contents--
|
2018-09-30 23:01:58 +01:00
|
|
|
|
|
|
|
```js
|
2021-07-30 17:32:21 +02:00
|
|
|
function mobiusFunctionAndIntervals() {
|
2020-09-15 09:57:40 -07:00
|
|
|
|
2018-09-30 23:01:58 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-07-30 17:32:21 +02:00
|
|
|
mobiusFunctionAndIntervals();
|
2018-09-30 23:01:58 +01:00
|
|
|
```
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --solutions--
|
2018-09-30 23:01:58 +01:00
|
|
|
|
|
|
|
```js
|
|
|
|
// solution required
|
|
|
|
```
|