2018-09-30 22:01:58 +00:00
|
|
|
---
|
|
|
|
id: 5900f4381000cf542c50ff4b
|
|
|
|
challengeType: 5
|
|
|
|
title: 'Problem 204: Generalised Hamming Numbers'
|
2019-08-05 16:17:33 +00:00
|
|
|
forumTopicId: 301845
|
2018-09-30 22:01:58 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
## Description
|
|
|
|
<section id='description'>
|
|
|
|
A Hamming number is a positive number which has no prime factor larger than 5.
|
|
|
|
So the first few Hamming numbers are 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15.
|
|
|
|
There are 1105 Hamming numbers not exceeding 108.
|
|
|
|
|
|
|
|
We will call a positive number a generalised Hamming number of type n, if it has no prime factor larger than n.
|
|
|
|
Hence the Hamming numbers are the generalised Hamming numbers of type 5.
|
|
|
|
|
|
|
|
How many generalised Hamming numbers of type 100 are there which don't exceed 109?
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Instructions
|
|
|
|
<section id='instructions'>
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Tests
|
|
|
|
<section id='tests'>
|
|
|
|
|
|
|
|
```yml
|
2018-10-04 13:37:37 +00:00
|
|
|
tests:
|
|
|
|
- text: <code>euler204()</code> should return 2944730.
|
2019-07-27 02:26:37 +00:00
|
|
|
testString: assert.strictEqual(euler204(), 2944730);
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Challenge Seed
|
|
|
|
<section id='challengeSeed'>
|
|
|
|
|
|
|
|
<div id='js-seed'>
|
|
|
|
|
|
|
|
```js
|
|
|
|
function euler204() {
|
|
|
|
// Good luck!
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
euler204();
|
|
|
|
```
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Solution
|
|
|
|
<section id='solution'>
|
|
|
|
|
|
|
|
```js
|
|
|
|
// solution required
|
|
|
|
```
|
2019-07-18 15:24:12 +00:00
|
|
|
|
2018-09-30 22:01:58 +00:00
|
|
|
</section>
|