49 lines
1.2 KiB
Markdown
49 lines
1.2 KiB
Markdown
![]() |
---
|
||
|
id: 5900f4c81000cf542c50ffd9
|
||
|
title: 'Problem 347: Largest integer divisible by two primes'
|
||
|
challengeType: 5
|
||
|
forumTopicId: 302006
|
||
|
dashedName: problem-347-largest-integer-divisible-by-two-primes
|
||
|
---
|
||
|
|
||
|
# --description--
|
||
|
|
||
|
The largest integer $≤ 100$ that is only divisible by both the primes 2 and 3 is 96, as $96 = 32 \times 3 = 2^5 \times 3$.
|
||
|
|
||
|
For two distinct primes $p$ and $q$ let $M(p, q, N)$ be the largest positive integer $≤ N$ only divisible by both $p$ and $q$ and $M(p, q, N)=0$ if such a positive integer does not exist.
|
||
|
|
||
|
E.g. $M(2, 3, 100) = 96$.
|
||
|
|
||
|
$M(3, 5, 100) = 75$ and not 90 because 90 is divisible by 2, 3 and 5. Also $M(2, 73, 100) = 0$ because there does not exist a positive integer $≤ 100$ that is divisible by both 2 and 73.
|
||
|
|
||
|
Let $S(N)$ be the sum of all distinct $M(p, q, N)$. $S(100)=2262$.
|
||
|
|
||
|
Find $S(10\\,000\\,000)$.
|
||
|
|
||
|
# --hints--
|
||
|
|
||
|
`integerDivisibleByTwoPrimes()` should return `11109800204052`.
|
||
|
|
||
|
```js
|
||
|
assert.strictEqual(integerDivisibleByTwoPrimes(), 11109800204052);
|
||
|
```
|
||
|
|
||
|
# --seed--
|
||
|
|
||
|
## --seed-contents--
|
||
|
|
||
|
```js
|
||
|
function integerDivisibleByTwoPrimes() {
|
||
|
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
integerDivisibleByTwoPrimes();
|
||
|
```
|
||
|
|
||
|
# --solutions--
|
||
|
|
||
|
```js
|
||
|
// solution required
|
||
|
```
|