mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-02-20 07:01:03 -05:00
2.7 KiB
2.7 KiB
id, title, challengeType, forumTopicId, dashedName
| id | title | challengeType | forumTopicId | dashedName |
|---|---|---|---|---|
| 5900f3e81000cf542c50fefb | Problem 124: Ordered radicals | 1 | 301751 | problem-124-ordered-radicals |
--description--
The radical of n, rad(n), is the product of the distinct prime factors of n. For example, 504 = 2^3 × 3^2 × 7, so rad(504) = 2 × 3 × 7 = 42.
If we calculate rad(n) for 1 ≤ n ≤ 10, then sort them on rad(n), and sorting on n if the radical values are equal, we get:
| $Unsorted$ | $Sorted$ | ||||
| $n$ | $rad(n)$ | $n$ | $rad(n)$ | $k$ | |
| 1 | 1 | 1 | 1 | 1 | |
| 2 | 2 | 2 | 2 | 2 | |
| 3 | 3 | 4 | 2 | 3 | |
| 4 | 2 | 8 | 2 | 4 | |
| 5 | 5 | 3 | 3 | 5 | |
| 6 | 6 | 9 | 3 | 6 | |
| 7 | 7 | 5 | 5 | 7 | |
| 8 | 2 | 6 | 6 | 8 | |
| 9 | 3 | 7 | 7 | 9 | |
| 10 | 10 | 10 | 10 | 10 | |
Lasse E(k) das $k$th Element in der geordneten n Spalte sein; zum Beispiel, E(4) = 8 und E(6) = 9. Wenn rad(n) für 1 ≤ n ≤ 100000 geordnet ist, findest du E(10000).
--hints--
orderedRadicals() sollte 21417 zurückgeben.
assert.strictEqual(orderedRadicals(), 21417);
--seed--
--seed-contents--
function orderedRadicals() {
return true;
}
orderedRadicals();
--solutions--
// solution required