chore(curriculum): Remove files in wrong format

This commit is contained in:
Bouncey
2018-10-04 14:37:37 +01:00
committed by Stuart Taylor
parent 61222b1fb6
commit 8f39bc1288
2947 changed files with 118541 additions and 212907 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,73 @@
---
id: 5900f36e1000cf542c50fe80
challengeType: 5
title: 'Problem 1: Multiples of 3 and 5'
---
## Description
<section id='description'>
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below the provided parameter value <code>number</code>.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>multiplesOf3and5(1000)</code> should return 233168.
testString: 'assert.strictEqual(multiplesOf3and5(1000), 233168, ''<code>multiplesOf3and5(1000)</code> should return 233168.'');'
- text: <code>multiplesOf3and5(49)</code> should return 543.
testString: 'assert.strictEqual(multiplesOf3and5(49), 543, ''<code>multiplesOf3and5(49)</code> should return 543.'');'
- text: <code>multiplesOf3and5(19564)</code> should return 89301183.
testString: 'assert.strictEqual(multiplesOf3and5(19564), 89301183, ''<code>multiplesOf3and5(19564)</code> should return 89301183.'');'
- text: Your function is not returning the correct result using our tests values.
testString: 'assert.strictEqual(multiplesOf3and5(8456), 16687353, ''Your function is not returning the correct result using our tests values.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function multiplesOf3and5(number) {
// Good luck!
return true;
}
multiplesOf3and5(1000);
```
</div>
</section>
## Solution
<section id='solution'>
```js
const multiplesOf3and5 = (number) => {
var total = 0;
for(var i = 0; i < number; i++) {
if(i % 3 == 0 || i % 5 == 0) {
total += i;
}
}
return total;
};
```
</section>

View File

@ -0,0 +1,98 @@
---
id: 5900f3761000cf542c50fe89
challengeType: 5
title: 'Problem 10: Summation of primes'
---
## Description
<section id='description'>
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
Find the sum of all the primes below n.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>primeSummation(17)</code> should return 41.
testString: 'assert.strictEqual(primeSummation(17), 41, ''<code>primeSummation(17)</code> should return 41.'');'
- text: <code>primeSummation(2001)</code> should return 277050.
testString: 'assert.strictEqual(primeSummation(2001), 277050, ''<code>primeSummation(2001)</code> should return 277050.'');'
- text: <code>primeSummation(140759)</code> should return 873608362.
testString: 'assert.strictEqual(primeSummation(140759), 873608362, ''<code>primeSummation(140759)</code> should return 873608362.'');'
- text: <code>primeSummation(2000000)</code> should return 142913828922.
testString: 'assert.strictEqual(primeSummation(2000000), 142913828922, ''<code>primeSummation(2000000)</code> should return 142913828922.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function primeSummation(n) {
// Good luck!
return true;
}
primeSummation(2000000);
```
</div>
</section>
## Solution
<section id='solution'>
```js
//noprotect
function primeSummation(n) {
// Initialise an array containing only prime numbers
let primes = [2];
let result = 2;
function isPrime(y, primes) {
// Find sqrt(y)
const sqrt = Math.floor(Math.sqrt(y));
// Divide y by each applicable prime, return false if any of them divide y
for (let i = 0; i < primes.length && primes[i] <= sqrt; i++) {
if (y % primes[i] === 0) {
return false;
}
}
// At this point x must be prime
return true;
}
// For every odd integer, add it to the array if it is prime
for (let x = 3; x < n; x += 2) {
if (isPrime(x, primes)) {
if (x > n) {
return result;
} else {
result += x;
primes.push(x);
}
}
}
return result;
}
```
</section>

View File

@ -0,0 +1,57 @@
---
id: 5900f3d01000cf542c50fee3
challengeType: 5
title: 'Problem 100: Arranged probability'
---
## Description
<section id='description'>
If a box contains twenty-one coloured discs, composed of fifteen blue discs and six red discs, and two discs were taken at random, it can be seen that the probability of taking two blue discs, P(BB) = (15/21)×(14/20) = 1/2.
The next such arrangement, for which there is exactly 50% chance of taking two blue discs at random, is a box containing eighty-five blue discs and thirty-five red discs.
By finding the first arrangement to contain over 1012 = 1,000,000,000,000 discs in total, determine the number of blue discs that the box would contain.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler100()</code> should return 756872327473.
testString: 'assert.strictEqual(euler100(), 756872327473, ''<code>euler100()</code> should return 756872327473.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler100() {
// Good luck!
return true;
}
euler100();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,75 @@
---
id: 5900f3d21000cf542c50fee4
challengeType: 5
title: 'Problem 101: Optimum polynomial'
---
## Description
<section id='description'>
If we are presented with the first k terms of a sequence it is impossible to say with certainty the value of the next term, as there are infinitely many polynomial functions that can model the sequence.
As an example, let us consider the sequence of cube numbers. This is defined by the generating function, un = n3: 1, 8, 27, 64, 125, 216, ...
Suppose we were only given the first two terms of this sequence. Working on the principle that "simple is best" we should assume a linear relationship and predict the next term to be 15 (common difference 7). Even if we were presented with the first three terms, by the same principle of simplicity, a quadratic relationship should be assumed.
We shall define OP(k, n) to be the nth term of the optimum polynomial generating function for the first k terms of a sequence. It should be clear that OP(k, n) will accurately generate the terms of the sequence for n ≤ k, and potentially the first incorrect term (FIT) will be OP(k, k+1); in which case we shall call it a bad OP (BOP).
As a basis, if we were only given the first term of sequence, it would be most sensible to assume constancy; that is, for n ≥ 2, OP(1, n) = u1.
Hence we obtain the following OPs for the cubic sequence:
OP(1, n) = 1
1, 1, 1, 1, ...
OP(2, n) = 7n6
1, 8, 15, ...
OP(3, n) = 6n211n+6     
1, 8, 27, 58, ...
OP(4, n) = n3
1, 8, 27, 64, 125, ...
Clearly no BOPs exist for k ≥ 4.
By considering the sum of FITs generated by the BOPs (indicated in red above), we obtain 1 + 15 + 58 = 74.
Consider the following tenth degree polynomial generating function:
un = 1 n + n2 n3 + n4 n5 + n6 n7 + n8 n9 + n10
Find the sum of FITs for the BOPs.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler101()</code> should return 37076114526.
testString: 'assert.strictEqual(euler101(), 37076114526, ''<code>euler101()</code> should return 37076114526.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler101() {
// Good luck!
return true;
}
euler101();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,61 @@
---
id: 5900f3d21000cf542c50fee5
challengeType: 5
title: 'Problem 102: Triangle containment'
---
## Description
<section id='description'>
Three distinct points are plotted at random on a Cartesian plane, for which -1000 ≤ x, y ≤ 1000, such that a triangle is formed.
Consider the following two triangles:
A(-340,495), B(-153,-910), C(835,-947)
X(-175,41), Y(-421,-714), Z(574,-645)
It can be verified that triangle ABC contains the origin, whereas triangle XYZ does not.
Using triangles.txt (right click and 'Save Link/Target As...'), a 27K text file containing the co-ordinates of one thousand "random" triangles, find the number of triangles for which the interior contains the origin.
NOTE: The first two examples in the file represent the triangles in the example given above.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler102()</code> should return 228.
testString: 'assert.strictEqual(euler102(), 228, ''<code>euler102()</code> should return 228.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler102() {
// Good luck!
return true;
}
euler102();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,63 @@
---
id: 5900f3d61000cf542c50fee7
challengeType: 5
title: 'Problem 103: Special subset sums: optimum'
---
## Description
<section id='description'>
Let S(A) represent the sum of elements in set A of size n. We shall call it a special sum set if for any two non-empty disjoint subsets, B and C, the following properties are true:
S(B) ≠ S(C); that is, sums of subsets cannot be equal.
If B contains more elements than C then S(B) > S(C).
If S(A) is minimised for a given n, we shall call it an optimum special sum set. The first five optimum special sum sets are given below.
n = 1: {1}n = 2: {1, 2}n = 3: {2, 3, 4}n = 4: {3, 5, 6, 7}n = 5: {6, 9, 11, 12, 13}
It seems that for a given optimum set, A = {a1, a2, ... , an}, the next optimum set is of the form B = {b, a1+b, a2+b, ... ,an+b}, where b is the "middle" element on the previous row.
By applying this "rule" we would expect the optimum set for n = 6 to be A = {11, 17, 20, 22, 23, 24}, with S(A) = 117. However, this is not the optimum set, as we have merely applied an algorithm to provide a near optimum set. The optimum set for n = 6 is A = {11, 18, 19, 20, 22, 25}, with S(A) = 115 and corresponding set string: 111819202225.
Given that A is an optimum special sum set for n = 7, find its set string.
NOTE: This problem is related to Problem 105 and Problem 106.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler103()</code> should return 20313839404245.
testString: 'assert.strictEqual(euler103(), 20313839404245, ''<code>euler103()</code> should return 20313839404245.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler103() {
// Good luck!
return true;
}
euler103();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,58 @@
---
id: 5900f3d51000cf542c50fee6
challengeType: 5
title: 'Problem 104: Pandigital Fibonacci ends'
---
## Description
<section id='description'>
The Fibonacci sequence is defined by the recurrence relation:
Fn = Fn1 + Fn2, where F1 = 1 and F2 = 1.
It turns out that F541, which contains 113 digits, is the first Fibonacci number for which the last nine digits are 1-9 pandigital (contain all the digits 1 to 9, but not necessarily in order). And F2749, which contains 575 digits, is the first Fibonacci number for which the first nine digits are 1-9 pandigital.
Given that Fk is the first Fibonacci number for which the first nine digits AND the last nine digits are 1-9 pandigital, find k.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler104()</code> should return 329468.
testString: 'assert.strictEqual(euler104(), 329468, ''<code>euler104()</code> should return 329468.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler104() {
// Good luck!
return true;
}
euler104();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,60 @@
---
id: 5900f3d61000cf542c50fee8
challengeType: 5
title: 'Problem 105: Special subset sums: testing'
---
## Description
<section id='description'>
Let S(A) represent the sum of elements in set A of size n. We shall call it a special sum set if for any two non-empty disjoint subsets, B and C, the following properties are true:
S(B) ≠ S(C); that is, sums of subsets cannot be equal.
If B contains more elements than C then S(B) > S(C).
For example, {81, 88, 75, 42, 87, 84, 86, 65} is not a special sum set because 65 + 87 + 88 = 75 + 81 + 84, whereas {157, 150, 164, 119, 79, 159, 161, 139, 158} satisfies both rules for all possible subset pair combinations and S(A) = 1286.
Using sets.txt (right click and "Save Link/Target As..."), a 4K text file with one-hundred sets containing seven to twelve elements (the two examples given above are the first two sets in the file), identify all the special sum sets, A1, A2, ..., Ak, and find the value of S(A1) + S(A2) + ... + S(Ak).
NOTE: This problem is related to Problem 103 and Problem 106.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler105()</code> should return 73702.
testString: 'assert.strictEqual(euler105(), 73702, ''<code>euler105()</code> should return 73702.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler105() {
// Good luck!
return true;
}
euler105();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,61 @@
---
id: 5900f3d71000cf542c50fee9
challengeType: 5
title: 'Problem 106: Special subset sums: meta-testing'
---
## Description
<section id='description'>
Let S(A) represent the sum of elements in set A of size n. We shall call it a special sum set if for any two non-empty disjoint subsets, B and C, the following properties are true:
S(B) ≠ S(C); that is, sums of subsets cannot be equal.
If B contains more elements than C then S(B) > S(C).
For this problem we shall assume that a given set contains n strictly increasing elements and it already satisfies the second rule.
Surprisingly, out of the 25 possible subset pairs that can be obtained from a set for which n = 4, only 1 of these pairs need to be tested for equality (first rule). Similarly, when n = 7, only 70 out of the 966 subset pairs need to be tested.
For n = 12, how many of the 261625 subset pairs that can be obtained need to be tested for equality?
NOTE: This problem is related to Problem 103 and Problem 105.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler106()</code> should return 21384.
testString: 'assert.strictEqual(euler106(), 21384, ''<code>euler106()</code> should return 21384.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler106() {
// Good luck!
return true;
}
euler106();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,70 @@
---
id: 5900f3d91000cf542c50feea
challengeType: 5
title: 'Problem 107: Minimal network'
---
## Description
<section id='description'>
The following undirected network consists of seven vertices and twelve edges with a total weight of 243.
The same network can be represented by the matrix below.
    ABCDEFG
A-161221---
B16--1720--
C12--28-31-
D211728-181923
E-20-18--11
F--3119--27
G---231127-
However, it is possible to optimise the network by removing some edges and still ensure that all points on the network remain connected. The network which achieves the maximum saving is shown below. It has a weight of 93, representing a saving of 243 93 = 150 from the original network.
Using network.txt (right click and 'Save Link/Target As...'), a 6K text file containing a network with forty vertices, and given in matrix form, find the maximum saving which can be achieved by removing redundant edges whilst ensuring that the network remains connected.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler107()</code> should return 259679.
testString: 'assert.strictEqual(euler107(), 259679, ''<code>euler107()</code> should return 259679.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler107() {
// Good luck!
return true;
}
euler107();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,59 @@
---
id: 5900f3d91000cf542c50feeb
challengeType: 5
title: 'Problem 108: Diophantine Reciprocals I'
---
## Description
<section id='description'>
In the following equation x, y, and n are positive integers.
1/<var>x</var> + 1/<var>y</var> = 1/<var>n</var>
For <var>n</var> = 4 there are exactly three distinct solutions:
1/5 + 1/20 = 1/4<br />1/6 + 1/12 = 1/4<br />1/8 + 1/8 = 1/4
What is the least value of <var>n</var> for which the number of distinct solutions exceeds one-thousand?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>diophantineOne()</code> should return 180180.
testString: 'assert.strictEqual(diophantineOne(), 180180, ''<code>diophantineOne()</code> should return 180180.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function diophantineOne() {
// Good luck!
return true;
}
diophantineOne();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,101 @@
---
id: 5900f3db1000cf542c50feec
challengeType: 5
title: 'Problem 109: Darts'
---
## Description
<section id='description'>
In the game of darts a player throws three darts at a target board which is split into twenty equal sized sections numbered one to twenty.
The score of a dart is determined by the number of the region that the dart lands in. A dart landing outside the red/green outer ring scores zero. The black and cream regions inside this ring represent single scores. However, the red/green outer ring and middle ring score double and treble scores respectively.
At the centre of the board are two concentric circles called the bull region, or bulls-eye. The outer bull is worth 25 points and the inner bull is a double, worth 50 points.
There are many variations of rules but in the most popular game the players will begin with a score 301 or 501 and the first player to reduce their running total to zero is a winner. However, it is normal to play a "doubles out" system, which means that the player must land a double (including the double bulls-eye at the centre of the board) on their final dart to win; any other dart that would reduce their running total to one or lower means the score for that set of three darts is "bust".
When a player is able to finish on their current score it is called a "checkout" and the highest checkout is 170: T20 T20 D25 (two treble 20s and double bull).
There are exactly eleven distinct ways to checkout on a score of 6:
D3
D1
D2
S2
D2
D2
D1
S4
D1
S1
S1
D2
S1
T1
D1
S1
S3
D1
D1
D1
D1
D1
S2
D1
S2
S2
D1
Note that D1 D2 is considered different to D2 D1 as they finish on different doubles. However, the combination S1 T1 D1 is considered the same as T1 S1 D1.
In addition we shall not include misses in considering combinations; for example, D3 is the same as 0 D3 and 0 0 D3.
Incredibly there are 42336 distinct ways of checking out in total.
How many distinct ways can a player checkout with a score less than 100?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler109()</code> should return 38182.
testString: 'assert.strictEqual(euler109(), 38182, ''<code>euler109()</code> should return 38182.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler109() {
// Good luck!
return true;
}
euler109();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,188 @@
---
id: 5900f3781000cf542c50fe8a
challengeType: 5
title: 'Problem 11: Largest product in a grid'
---
## Description
<section id='description'>
In the 20×20 grid below, four numbers along a diagonal line have been marked in red.
<div style='text-align: center;'>08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08</div>
<div style='text-align: center;'>49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00</div>
<div style='text-align: center;'>81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65</div>
<div style='text-align: center;'>52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91</div>
<div style='text-align: center;'>22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 66 33 13 80</div>
<div style='text-align: center;'>24 47 32 60 99 03 45 02 44 75 33 53 78 36 84 20 35 17 12 50</div>
<div style='text-align: center;'>32 98 81 28 64 23 67 10 <span style='color: red'><b>26</b></span> 38 40 67 59 54 70 66 18 38 64 70</div>
<div style='text-align: center;'>67 26 20 68 02 62 12 20 95 <span style='color: red'><b>63</b></span> 94 39 63 08 40 91 66 49 94 21</div>
<div style='text-align: center;'>24 55 58 05 66 73 99 26 97 17 <span style='color: red'><b>78</b></span> 78 96 83 14 88 34 89 63 72</div>
<div style='text-align: center;'>21 36 23 09 75 00 76 44 20 45 35 <span style='color: red'><b>14</b></span> 00 61 33 97 34 31 33 95</div>
<div style='text-align: center;'>78 17 53 28 22 75 31 67 15 94 03 80 04 62 16 14 09 53 56 92</div>
<div style='text-align: center;'>16 39 05 42 96 35 31 47 55 58 88 24 00 17 54 24 36 29 85 57</div>
<div style='text-align: center;'>86 56 00 48 35 71 89 07 05 44 44 37 44 60 21 58 51 54 17 58</div>
<div style='text-align: center;'>19 80 81 68 05 94 47 69 28 73 92 13 86 52 17 77 04 89 55 40</div>
<div style='text-align: center;'>04 52 08 83 97 35 99 16 07 97 57 32 16 26 26 79 33 27 98 66</div>
<div style='text-align: center;'>88 36 68 87 57 62 20 72 03 46 33 67 46 55 12 32 63 93 53 69</div>
<div style='text-align: center;'>04 42 16 73 38 25 39 11 24 94 72 18 08 46 29 32 40 62 76 36</div>
<div style='text-align: center;'>20 69 36 41 72 30 23 88 34 62 99 69 82 67 59 85 74 04 36 16</div>
<div style='text-align: center;'>20 73 35 29 78 31 90 01 74 31 49 71 48 86 81 16 23 57 05 54</div>
<div style='text-align: center;'>01 70 54 71 83 51 54 69 16 92 33 48 61 43 52 01 89 19 67 48</div>
The product of these numbers is 26 × 63 × 78 × 14 = 1788696.
What is the greatest product of four adjacent numbers in the same direction (up, down, left, right, or diagonally) in a given <code>arr</code> grid?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>largestGridProduct(grid)</code> should return 70600674.
testString: 'assert.strictEqual(largestGridProduct(grid), 70600674, ''<code>largestGridProduct(grid)</code> should return 70600674.'');'
- text: <code>largestGridProduct(testGrid)</code> should return 14169081.
testString: 'assert.strictEqual(largestGridProduct(testGrid), 14169081, ''<code>largestGridProduct(testGrid)</code> should return 14169081.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function largestGridProduct(arr) {
// Good luck!
return arr;
}
// Only change code above this line
const grid = [
[8, 2, 22, 97, 38, 15, 0, 40, 0, 75, 4, 5, 7, 78, 52, 12, 50, 77, 91, 8],
[49, 49, 99, 40, 17, 81, 18, 57, 60, 87, 17, 40, 98, 43, 69, 48, 4, 56, 62, 0],
[81, 49, 31, 73, 55, 79, 14, 29, 93, 71, 40, 67, 53, 88, 30, 3, 49, 13, 36, 65],
[52, 70, 95, 23, 4, 60, 11, 42, 69, 24, 68, 56, 1, 32, 56, 71, 37, 2, 36, 91],
[22, 31, 16, 71, 51, 67, 63, 89, 41, 92, 36, 54, 22, 40, 40, 28, 66, 33, 13, 80],
[24, 47, 32, 60, 99, 3, 45, 2, 44, 75, 33, 53, 78, 36, 84, 20, 35, 17, 12, 50],
[32, 98, 81, 28, 64, 23, 67, 10, 26, 38, 40, 67, 59, 54, 70, 66, 18, 38, 64, 70],
[67, 26, 20, 68, 2, 62, 12, 20, 95, 63, 94, 39, 63, 8, 40, 91, 66, 49, 94, 21],
[24, 55, 58, 5, 66, 73, 99, 26, 97, 17, 78, 78, 96, 83, 14, 88, 34, 89, 63, 72],
[21, 36, 23, 9, 75, 0, 76, 44, 20, 45, 35, 14, 0, 61, 33, 97, 34, 31, 33, 95],
[78, 17, 53, 28, 22, 75, 31, 67, 15, 94, 3, 80, 4, 62, 16, 14, 9, 53, 56, 92],
[16, 39, 5, 42, 96, 35, 31, 47, 55, 58, 88, 24, 0, 17, 54, 24, 36, 29, 85, 57],
[86, 56, 0, 48, 35, 71, 89, 7, 5, 44, 44, 37, 44, 60, 21, 58, 51, 54, 17, 58],
[19, 80, 81, 68, 5, 94, 47, 69, 28, 73, 92, 13, 86, 52, 17, 77, 4, 89, 55, 40],
[4, 52, 8, 83, 97, 35, 99, 16, 7, 97, 57, 32, 16, 26, 26, 79, 33, 27, 98, 66],
[88, 36, 68, 87, 57, 62, 20, 72, 3, 46, 33, 67, 46, 55, 12, 32, 63, 93, 53, 69],
[4, 42, 16, 73, 38, 25, 39, 11, 24, 94, 72, 18, 8, 46, 29, 32, 40, 62, 76, 36],
[20, 69, 36, 41, 72, 30, 23, 88, 34, 62, 99, 69, 82, 67, 59, 85, 74, 4, 36, 16],
[20, 73, 35, 29, 78, 31, 90, 1, 74, 31, 49, 71, 48, 86, 81, 16, 23, 57, 5, 54],
[1, 70, 54, 71, 83, 51, 54, 69, 16, 92, 33, 48, 61, 43, 52, 1, 89, 19, 67, 48]
];
const testGrid = [
[40, 17, 81, 18, 57],
[74, 4, 36, 16, 29],
[36, 42, 69, 73, 45],
[51, 54, 69, 16, 92],
[7, 97, 57, 32, 16]
];
largestGridProduct(testGrid);
```
</div>
</section>
## Solution
<section id='solution'>
```js
function largestGridProduct(arr) {
let maxProduct = 0;
let currProduct = 0;
function maxProductChecker(n) {
if (n > maxProduct) {
return maxProduct = n;
}
}
// loop rows
for (let r = 0; r < arr.length; r++) {
// loop columns
for (let c = 0; c < arr[r].length; c++) {
const limit = arr[r].length - 3;
// check horizontal
if (c < limit) {
currProduct = arr[r][c] * arr[r][c + 1] * arr[r][c + 2] * arr[r][c + 3];
maxProductChecker(currProduct);
}
// check vertical
if (r < limit) {
currProduct = arr[r][c] * arr[r + 1][c] * arr[r + 2][c] * arr[r + 3][c];
maxProductChecker(currProduct);
}
// check diagonal [\]
if (c < limit && r < limit) {
currProduct = arr[r][c] * arr[r + 1][c + 1] * arr[r + 2][c + 2] * arr[r + 3][c + 3];
maxProductChecker(currProduct);
}
// check diagonal [/]
if (c > 3 && r < limit) {
currProduct = arr[r][c] * arr[r + 1][c - 1] * arr[r + 2][c - 2] * arr[r + 3][c - 3];
maxProductChecker(currProduct);
}
}
}
return maxProduct;
}
const grid = [ [8, 2, 22, 97, 38, 15, 0, 40, 0, 75, 4, 5, 7, 78, 52, 12, 50, 77, 91, 8],
[49, 49, 99, 40, 17, 81, 18, 57, 60, 87, 17, 40, 98, 43, 69, 48, 4, 56, 62, 0],
[81, 49, 31, 73, 55, 79, 14, 29, 93, 71, 40, 67, 53, 88, 30, 3, 49, 13, 36, 65],
[52, 70, 95, 23, 4, 60, 11, 42, 69, 24, 68, 56, 1, 32, 56, 71, 37, 2, 36, 91],
[22, 31, 16, 71, 51, 67, 63, 89, 41, 92, 36, 54, 22, 40, 40, 28, 66, 33, 13, 80],
[24, 47, 32, 60, 99, 3, 45, 2, 44, 75, 33, 53, 78, 36, 84, 20, 35, 17, 12, 50],
[32, 98, 81, 28, 64, 23, 67, 10, 26, 38, 40, 67, 59, 54, 70, 66, 18, 38, 64, 70],
[67, 26, 20, 68, 2, 62, 12, 20, 95, 63, 94, 39, 63, 8, 40, 91, 66, 49, 94, 21],
[24, 55, 58, 5, 66, 73, 99, 26, 97, 17, 78, 78, 96, 83, 14, 88, 34, 89, 63, 72],
[21, 36, 23, 9, 75, 0, 76, 44, 20, 45, 35, 14, 0, 61, 33, 97, 34, 31, 33, 95],
[78, 17, 53, 28, 22, 75, 31, 67, 15, 94, 3, 80, 4, 62, 16, 14, 9, 53, 56, 92],
[16, 39, 5, 42, 96, 35, 31, 47, 55, 58, 88, 24, 0, 17, 54, 24, 36, 29, 85, 57],
[86, 56, 0, 48, 35, 71, 89, 7, 5, 44, 44, 37, 44, 60, 21, 58, 51, 54, 17, 58],
[19, 80, 81, 68, 5, 94, 47, 69, 28, 73, 92, 13, 86, 52, 17, 77, 4, 89, 55, 40],
[4, 52, 8, 83, 97, 35, 99, 16, 7, 97, 57, 32, 16, 26, 26, 79, 33, 27, 98, 66],
[88, 36, 68, 87, 57, 62, 20, 72, 3, 46, 33, 67, 46, 55, 12, 32, 63, 93, 53, 69],
[4, 42, 16, 73, 38, 25, 39, 11, 24, 94, 72, 18, 8, 46, 29, 32, 40, 62, 76, 36],
[20, 69, 36, 41, 72, 30, 23, 88, 34, 62, 99, 69, 82, 67, 59, 85, 74, 4, 36, 16],
[20, 73, 35, 29, 78, 31, 90, 1, 74, 31, 49, 71, 48, 86, 81, 16, 23, 57, 5, 54],
[1, 70, 54, 71, 83, 51, 54, 69, 16, 92, 33, 48, 61, 43, 52, 1, 89, 19, 67, 48]
];
const testGrid = [
[40, 17, 81, 18, 57],
[74, 4, 36, 16, 29],
[36, 42, 69, 73, 45],
[51, 54, 69, 16, 92],
[7, 97, 57, 32, 16]
];
```
</section>

View File

@ -0,0 +1,58 @@
---
id: 5900f3db1000cf542c50feed
challengeType: 5
title: 'Problem 110: Diophantine Reciprocals II'
---
## Description
<section id='description'>
In the following equation x, y, and n are positive integers.
1/<var>x</var> + 1/<var>y</var> = 1/<var>n</var>
It can be verified that when <var>n</var> = 1260 there are 113 distinct solutions and this is the least value of <var>n</var> for which the total number of distinct solutions exceeds one hundred.
What is the least value of <var>n</var> for which the number of distinct solutions exceeds four million?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>diophantineTwo</code> should return 9350130049860600.
testString: 'assert.strictEqual(diophantineTwo(), 9350130049860600, ''<code>diophantineTwo()</code> should return 9350130049860600.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function diophantineTwo() {
// Good luck!
return true;
}
diophantineTwo();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,107 @@
---
id: 5900f3db1000cf542c50feee
challengeType: 5
title: 'Problem 111: Primes with runs'
---
## Description
<section id='description'>
Considering 4-digit primes containing repeated digits it is clear that they cannot all be the same: 1111 is divisible by 11, 2222 is divisible by 22, and so on. But there are nine 4-digit primes containing three ones:
1117, 1151, 1171, 1181, 1511, 1811, 2111, 4111, 8111
We shall say that M(n, d) represents the maximum number of repeated digits for an n-digit prime where d is the repeated digit, N(n, d) represents the number of such primes, and S(n, d) represents the sum of these primes.
So M(4, 1) = 3 is the maximum number of repeated digits for a 4-digit prime where one is the repeated digit, there are N(4, 1) = 9 such primes, and the sum of these primes is S(4, 1) = 22275. It turns out that for d = 0, it is only possible to have M(4, 0) = 2 repeated digits, but there are N(4, 0) = 13 such cases.
In the same way we obtain the following results for 4-digit primes.
Digit, d
M(4, d)
N(4, d)
S(4, d)
0
2
13
67061
1
3
9
22275
2
3
1
2221
3
3
12
46214
4
3
2
8888
5
3
1
5557
6
3
1
6661
7
3
9
57863
8
3
1
8887
9
3
7
48073
For d = 0 to 9, the sum of all S(4, d) is 273700.
Find the sum of all S(10, d).
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler111()</code> should return 612407567715.
testString: 'assert.strictEqual(euler111(), 612407567715, ''<code>euler111()</code> should return 612407567715.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler111() {
// Good luck!
return true;
}
euler111();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,60 @@
---
id: 5900f3dd1000cf542c50feef
challengeType: 5
title: 'Problem 112: Bouncy numbers'
---
## Description
<section id='description'>
Working from left-to-right if no digit is exceeded by the digit to its left it is called an increasing number; for example, 134468.
Similarly if no digit is exceeded by the digit to its right it is called a decreasing number; for example, 66420.
We shall call a positive integer that is neither increasing nor decreasing a "bouncy" number; for example, 155349.
Clearly there cannot be any bouncy numbers below one-hundred, but just over half of the numbers below one-thousand (525) are bouncy. In fact, the least number for which the proportion of bouncy numbers first reaches 50% is 538.
Surprisingly, bouncy numbers become more and more common and by the time we reach 21780 the proportion of bouncy numbers is equal to 90%.
Find the least number for which the proportion of bouncy numbers is exactly 99%.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler112()</code> should return 1587000.
testString: 'assert.strictEqual(euler112(), 1587000, ''<code>euler112()</code> should return 1587000.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler112() {
// Good luck!
return true;
}
euler112();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,59 @@
---
id: 5900f3dd1000cf542c50fef0
challengeType: 5
title: 'Problem 113: Non-bouncy numbers'
---
## Description
<section id='description'>
Working from left-to-right if no digit is exceeded by the digit to its left it is called an increasing number; for example, 134468.
Similarly if no digit is exceeded by the digit to its right it is called a decreasing number; for example, 66420.
We shall call a positive integer that is neither increasing nor decreasing a "bouncy" number; for example, 155349.
As n increases, the proportion of bouncy numbers below n increases such that there are only 12951 numbers below one-million that are not bouncy and only 277032 non-bouncy numbers below 1010.
How many numbers below a googol (10100) are not bouncy?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler113()</code> should return 51161058134250.
testString: 'assert.strictEqual(euler113(), 51161058134250, ''<code>euler113()</code> should return 51161058134250.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler113() {
// Good luck!
return true;
}
euler113();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,158 @@
---
id: 5900f3e01000cf542c50fef2
challengeType: 5
title: 'Problem 114: Counting block combinations I'
---
## Description
<section id='description'>
A row measuring seven units in length has red blocks with a minimum length of three units placed on it, such that any two red blocks (which are allowed to be different lengths) are separated by at least one black square. There are exactly seventeen ways of doing this.
How many ways can a row measuring fifty units in length be filled?
NOTE: Although the example above does not lend itself to the possibility, in general it is permitted to mix block sizes. For example, on a row measuring eight units in length you could use red (3), black (1), and red (4).
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler114()</code> should return 16475640049.
testString: 'assert.strictEqual(euler114(), 16475640049, ''<code>euler114()</code> should return 16475640049.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler114() {
// Good luck!
return true;
}
euler114();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,61 @@
---
id: 5900f3df1000cf542c50fef1
challengeType: 5
title: 'Problem 115: Counting block combinations II'
---
## Description
<section id='description'>
NOTE: This is a more difficult version of Problem 114.
A row measuring n units in length has red blocks with a minimum length of m units placed on it, such that any two red blocks (which are allowed to be different lengths) are separated by at least one black square.
Let the fill-count function, F(m, n), represent the number of ways that a row can be filled.
For example, F(3, 29) = 673135 and F(3, 30) = 1089155.
That is, for m = 3, it can be seen that n = 30 is the smallest value for which the fill-count function first exceeds one million.
In the same way, for m = 10, it can be verified that F(10, 56) = 880711 and F(10, 57) = 1148904, so n = 57 is the least value for which the fill-count function first exceeds one million.
For m = 50, find the least value of n for which the fill-count function first exceeds one million.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler115()</code> should return 168.
testString: 'assert.strictEqual(euler115(), 168, ''<code>euler115()</code> should return 168.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler115() {
// Good luck!
return true;
}
euler115();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,128 @@
---
id: 5900f3e01000cf542c50fef3
challengeType: 5
title: 'Problem 116: Red, green or blue tiles'
---
## Description
<section id='description'>
A row of five black square tiles is to have a number of its tiles replaced with coloured oblong tiles chosen from red (length two), green (length three), or blue (length four).
If red tiles are chosen there are exactly seven ways this can be done.
If green tiles are chosen there are three ways.
And if blue tiles are chosen there are two ways.
Assuming that colours cannot be mixed there are 7 + 3 + 2 = 12 ways of replacing the black tiles in a row measuring five units in length.
How many different ways can the black tiles in a row measuring fifty units in length be replaced if colours cannot be mixed and at least one coloured tile must be used?
NOTE: This is related to Problem 117.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler116()</code> should return 20492570929.
testString: 'assert.strictEqual(euler116(), 20492570929, ''<code>euler116()</code> should return 20492570929.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler116() {
// Good luck!
return true;
}
euler116();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,136 @@
---
id: 5900f3e21000cf542c50fef4
challengeType: 5
title: 'Problem 117: Red, green, and blue tiles'
---
## Description
<section id='description'>
Using a combination of black square tiles and oblong tiles chosen from: red tiles measuring two units, green tiles measuring three units, and blue tiles measuring four units, it is possible to tile a row measuring five units in length in exactly fifteen different ways.
How many ways can a row measuring fifty units in length be tiled?
NOTE: This is related to Problem 116.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler117()</code> should return 100808458960497.
testString: 'assert.strictEqual(euler117(), 100808458960497, ''<code>euler117()</code> should return 100808458960497.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler117() {
// Good luck!
return true;
}
euler117();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,56 @@
---
id: 5900f3e21000cf542c50fef5
challengeType: 5
title: 'Problem 118: Pandigital prime sets'
---
## Description
<section id='description'>
Using all of the digits 1 through 9 and concatenating them freely to form decimal integers, different sets can be formed. Interestingly with the set {2,5,47,89,631}, all of the elements belonging to it are prime.
How many distinct sets containing each of the digits one through nine exactly once contain only prime elements?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler118()</code> should return 44680.
testString: 'assert.strictEqual(euler118(), 44680, ''<code>euler118()</code> should return 44680.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler118() {
// Good luck!
return true;
}
euler118();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,58 @@
---
id: 5900f3e41000cf542c50fef6
challengeType: 5
title: 'Problem 119: Digit power sum'
---
## Description
<section id='description'>
The number 512 is interesting because it is equal to the sum of its digits raised to some power: 5 + 1 + 2 = 8, and 83 = 512. Another example of a number with this property is 614656 = 284.
We shall define an to be the nth term of this sequence and insist that a number must contain at least two digits to have a sum.
You are given that a2 = 512 and a10 = 614656.
Find a30.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler119()</code> should return 248155780267521.
testString: 'assert.strictEqual(euler119(), 248155780267521, ''<code>euler119()</code> should return 248155780267521.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler119() {
// Good luck!
return true;
}
euler119();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,105 @@
---
id: 5900f3781000cf542c50fe8b
challengeType: 5
title: 'Problem 12: Highly divisible triangular number'
---
## Description
<section id='description'>
The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be:
<div style='text-align: center;'>1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...</div>
Let us list the factors of the first seven triangle numbers:
<div style='padding-left: 4em;'><b>1:</b> 1</div>
<div style='padding-left: 4em;'><b>3:</b> 1, 3</div>
<div style='padding-left: 4em;'><b>6:</b> 1, 2, 3, 6</div>
<div style='padding-left: 4em;'><b>10:</b> 1, 2, 5, 10</div>
<div style='padding-left: 4em;'><b>15:</b> 1, 3, 5, 15</div>
<div style='padding-left: 4em;'><b>21:</b> 1, 3, 7, 21</div>
<div style='padding-left: 4em;'><b>28:</b> 1, 2, 4, 7, 14, 28</div>
We can see that 28 is the first triangle number to have over five divisors.
What is the value of the first triangle number to have over <code>n</code> divisors?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>divisibleTriangleNumber(5)</code> should return 28.
testString: 'assert.strictEqual(divisibleTriangleNumber(5), 28, ''<code>divisibleTriangleNumber(5)</code> should return 28.'');'
- text: <code>divisibleTriangleNumber(23)</code> should return 630.
testString: 'assert.strictEqual(divisibleTriangleNumber(23), 630, ''<code>divisibleTriangleNumber(23)</code> should return 630.'');'
- text: <code>divisibleTriangleNumber(167)</code> should return 1385280.
testString: 'assert.strictEqual(divisibleTriangleNumber(167), 1385280, ''<code>divisibleTriangleNumber(167)</code> should return 1385280.'');'
- text: <code>divisibleTriangleNumber(374)</code> should return 17907120.
testString: 'assert.strictEqual(divisibleTriangleNumber(374), 17907120, ''<code>divisibleTriangleNumber(374)</code> should return 17907120.'');'
- text: <code>divisibleTriangleNumber(500)</code> should return 76576500.
testString: 'assert.strictEqual(divisibleTriangleNumber(500), 76576500, ''<code>divisibleTriangleNumber(500)</code> should return 76576500.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function divisibleTriangleNumber(n) {
// Good luck!
return true;
}
divisibleTriangleNumber(500);
```
</div>
</section>
## Solution
<section id='solution'>
```js
function divisibleTriangleNumber(n) {
let counter = 1;
let triangleNumber = counter++;
function getFactors(num) {
let factors = [];
let possibleFactor = 1;
let sqrt = Math.sqrt(num);
while (possibleFactor <= sqrt) {
if (num % possibleFactor == 0) {
factors.push(possibleFactor);
var otherPossibleFactor = num / possibleFactor;
if (otherPossibleFactor > possibleFactor) {
factors.push(otherPossibleFactor);
}
}
possibleFactor++;
}
return factors;
}
while (getFactors(triangleNumber).length < n) {
triangleNumber += counter++;
}
console.log(triangleNumber)
return triangleNumber;
}
```
</section>

View File

@ -0,0 +1,57 @@
---
id: 5900f3e41000cf542c50fef7
challengeType: 5
title: 'Problem 120: Square remainders'
---
## Description
<section id='description'>
Let r be the remainder when (a1)n + (a+1)n is divided by a2.
For example, if a = 7 and n = 3, then r = 42: 63 + 83 = 728 ≡ 42 mod 49. And as n varies, so too will r, but for a = 7 it turns out that rmax = 42.
For 3 ≤ a ≤ 1000, find ∑ rmax.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler120()</code> should return 333082500.
testString: 'assert.strictEqual(euler120(), 333082500, ''<code>euler120()</code> should return 333082500.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler120() {
// Good luck!
return true;
}
euler120();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,58 @@
---
id: 5900f3e51000cf542c50fef8
challengeType: 5
title: 'Problem 121: Disc game prize fund'
---
## Description
<section id='description'>
A bag contains one red disc and one blue disc. In a game of chance a player takes a disc at random and its colour is noted. After each turn the disc is returned to the bag, an extra red disc is added, and another disc is taken at random.
The player pays £1 to play and wins if they have taken more blue discs than red discs at the end of the game.
If the game is played for four turns, the probability of a player winning is exactly 11/120, and so the maximum prize fund the banker should allocate for winning in this game would be £10 before they would expect to incur a loss. Note that any payout will be a whole number of pounds and also includes the original £1 paid to play the game, so in the example given the player actually wins £9.
Find the maximum prize fund that should be allocated to a single game in which fifteen turns are played.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler121()</code> should return 2269.
testString: 'assert.strictEqual(euler121(), 2269, ''<code>euler121()</code> should return 2269.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler121() {
// Good luck!
return true;
}
euler121();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,62 @@
---
id: 5900f3e61000cf542c50fef9
challengeType: 5
title: 'Problem 122: Efficient exponentiation'
---
## Description
<section id='description'>
The most naive way of computing n15 requires fourteen multiplications:
n × n × ... × n = n15
But using a "binary" method you can compute it in six multiplications:
n × n = n2n2 × n2 = n4n4 × n4 = n8n8 × n4 = n12n12 × n2 = n14n14 × n = n15
However it is yet possible to compute it in only five multiplications:
n × n = n2n2 × n = n3n3 × n3 = n6n6 × n6 = n12n12 × n3 = n15
We shall define m(k) to be the minimum number of multiplications to compute nk; for example m(15) = 5.
For 1 ≤ k ≤ 200, find ∑ m(k).
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler122()</code> should return 1582.
testString: 'assert.strictEqual(euler122(), 1582, ''<code>euler122()</code> should return 1582.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler122() {
// Good luck!
return true;
}
euler122();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,58 @@
---
id: 5900f3e71000cf542c50fefa
challengeType: 5
title: 'Problem 123: Prime square remainders'
---
## Description
<section id='description'>
Let pn be the nth prime: 2, 3, 5, 7, 11, ..., and let r be the remainder when (pn1)n + (pn+1)n is divided by pn2.
For example, when n = 3, p3 = 5, and 43 + 63 = 280 ≡ 5 mod 25.
The least value of n for which the remainder first exceeds 109 is 7037.
Find the least value of n for which the remainder first exceeds 1010.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler123()</code> should return 21035.
testString: 'assert.strictEqual(euler123(), 21035, ''<code>euler123()</code> should return 21035.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler123() {
// Good luck!
return true;
}
euler123();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,97 @@
---
id: 5900f3e81000cf542c50fefb
challengeType: 5
title: 'Problem 124: Ordered radicals'
---
## Description
<section id='description'>
The radical of n, rad(n), is the product of the distinct prime factors of n. For example, 504 = 23 × 32 × 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
11
111
22
222
33
423
42
824
55
335
66
936
77
557
82
668
93
779
1010
101010
Let E(k) be the kth element in the sorted n column; for example, E(4) = 8 and E(6) = 9.
If rad(n) is sorted for 1 ≤ n ≤ 100000, find E(10000).
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler124()</code> should return 21417.
testString: 'assert.strictEqual(euler124(), 21417, ''<code>euler124()</code> should return 21417.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler124() {
// Good luck!
return true;
}
euler124();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,57 @@
---
id: 5900f3e91000cf542c50fefc
challengeType: 5
title: 'Problem 125: Palindromic sums'
---
## Description
<section id='description'>
The palindromic number 595 is interesting because it can be written as the sum of consecutive squares: 62 + 72 + 82 + 92 + 102 + 112 + 122.
There are exactly eleven palindromes below one-thousand that can be written as consecutive square sums, and the sum of these palindromes is 4164. Note that 1 = 02 + 12 has not been included as this problem is concerned with the squares of positive integers.
Find the sum of all the numbers less than 108 that are both palindromic and can be written as the sum of consecutive squares.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler125()</code> should return 2906969179.
testString: 'assert.strictEqual(euler125(), 2906969179, ''<code>euler125()</code> should return 2906969179.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler125() {
// Good luck!
return true;
}
euler125();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,62 @@
---
id: 5900f3ea1000cf542c50fefd
challengeType: 5
title: 'Problem 126: Cuboid layers'
---
## Description
<section id='description'>
The minimum number of cubes to cover every visible face on a cuboid measuring 3 x 2 x 1 is twenty-two.
If we then add a second layer to this solid it would require forty-six cubes to cover every visible face, the third layer would require seventy-eight cubes, and the fourth layer would require one-hundred and eighteen cubes to cover every visible face.
However, the first layer on a cuboid measuring 5 x 1 x 1 also requires twenty-two cubes; similarly the first layer on cuboids measuring 5 x 3 x 1, 7 x 2 x 1, and 11 x 1 x 1 all contain forty-six cubes.
We shall define C(n) to represent the number of cuboids that contain n cubes in one of its layers. So C(22) = 2, C(46) = 4, C(78) = 5, and C(118) = 8.
It turns out that 154 is the least value of n for which C(n) = 10.
Find the least value of n for which C(n) = 1000.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler126()</code> should return 18522.
testString: 'assert.strictEqual(euler126(), 18522, ''<code>euler126()</code> should return 18522.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler126() {
// Good luck!
return true;
}
euler126();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,67 @@
---
id: 5900f3ec1000cf542c50fefe
challengeType: 5
title: 'Problem 127: abc-hits'
---
## Description
<section id='description'>
The radical of n, rad(n), is the product of distinct prime factors of n. For example, 504 = 23 × 32 × 7, so rad(504) = 2 × 3 × 7 = 42.
We shall define the triplet of positive integers (a, b, c) to be an abc-hit if:
GCD(a, b) = GCD(a, c) = GCD(b, c) = 1
a < b
a + b = c
rad(abc) < c
For example, (5, 27, 32) is an abc-hit, because:
GCD(5, 27) = GCD(5, 32) = GCD(27, 32) = 1
5 < 27
5 + 27 = 32
rad(4320) = 30 < 32
It turns out that abc-hits are quite rare and there are only thirty-one abc-hits for c < 1000, with c = 12523.
Find c for c < 120000.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler127()</code> should return 18407904.
testString: 'assert.strictEqual(euler127(), 18407904, ''<code>euler127()</code> should return 18407904.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler127() {
// Good luck!
return true;
}
euler127();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,64 @@
---
id: 5900f3ec1000cf542c50feff
challengeType: 5
title: 'Problem 128: Hexagonal tile differences'
---
## Description
<section id='description'>
A hexagonal tile with number 1 is surrounded by a ring of six hexagonal tiles, starting at "12 o'clock" and numbering the tiles 2 to 7 in an anti-clockwise direction.
New rings are added in the same fashion, with the next rings being numbered 8 to 19, 20 to 37, 38 to 61, and so on. The diagram below shows the first three rings.
By finding the difference between tile n and each of its six neighbours we shall define PD(n) to be the number of those differences which are prime.
For example, working clockwise around tile 8 the differences are 12, 29, 11, 6, 1, and 13. So PD(8) = 3.
In the same way, the differences around tile 17 are 1, 17, 16, 1, 11, and 10, hence PD(17) = 2.
It can be shown that the maximum value of PD(n) is 3.
If all of the tiles for which PD(n) = 3 are listed in ascending order to form a sequence, the 10th tile would be 271.
Find the 2000th tile in this sequence.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler128()</code> should return 14516824220.
testString: 'assert.strictEqual(euler128(), 14516824220, ''<code>euler128()</code> should return 14516824220.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler128() {
// Good luck!
return true;
}
euler128();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,58 @@
---
id: 5900f3ef1000cf542c50ff01
challengeType: 5
title: 'Problem 129: Repunit divisibility'
---
## Description
<section id='description'>
A number consisting entirely of ones is called a repunit. We shall define R(k) to be a repunit of length k; for example, R(6) = 111111.
Given that n is a positive integer and GCD(n, 10) = 1, it can be shown that there always exists a value, k, for which R(k) is divisible by n, and let A(n) be the least such value of k; for example, A(7) = 6 and A(41) = 5.
The least value of n for which A(n) first exceeds ten is 17.
Find the least value of n for which A(n) first exceeds one-million.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler129()</code> should return 1000023.
testString: 'assert.strictEqual(euler129(), 1000023, ''<code>euler129()</code> should return 1000023.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler129() {
// Good luck!
return true;
}
euler129();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,295 @@
---
id: 5900f37a1000cf542c50fe8c
challengeType: 5
title: 'Problem 13: Large sum'
---
## Description
<section id='description'>
Work out the first ten digits of the sum of the following one-hundred 50-digit numbers.
37107287533902102798797998220837590246510135740250
46376937677490009712648124896970078050417018260538
74324986199524741059474233309513058123726617309629
91942213363574161572522430563301811072406154908250
23067588207539346171171980310421047513778063246676
89261670696623633820136378418383684178734361726757
28112879812849979408065481931592621691275889832738
44274228917432520321923589422876796487670272189318
47451445736001306439091167216856844588711603153276
70386486105843025439939619828917593665686757934951
62176457141856560629502157223196586755079324193331
64906352462741904929101432445813822663347944758178
92575867718337217661963751590579239728245598838407
58203565325359399008402633568948830189458628227828
80181199384826282014278194139940567587151170094390
35398664372827112653829987240784473053190104293586
86515506006295864861532075273371959191420517255829
71693888707715466499115593487603532921714970056938
54370070576826684624621495650076471787294438377604
53282654108756828443191190634694037855217779295145
36123272525000296071075082563815656710885258350721
45876576172410976447339110607218265236877223636045
17423706905851860660448207621209813287860733969412
81142660418086830619328460811191061556940512689692
51934325451728388641918047049293215058642563049483
62467221648435076201727918039944693004732956340691
15732444386908125794514089057706229429197107928209
55037687525678773091862540744969844508330393682126
18336384825330154686196124348767681297534375946515
80386287592878490201521685554828717201219257766954
78182833757993103614740356856449095527097864797581
16726320100436897842553539920931837441497806860984
48403098129077791799088218795327364475675590848030
87086987551392711854517078544161852424320693150332
59959406895756536782107074926966537676326235447210
69793950679652694742597709739166693763042633987085
41052684708299085211399427365734116182760315001271
65378607361501080857009149939512557028198746004375
35829035317434717326932123578154982629742552737307
94953759765105305946966067683156574377167401875275
88902802571733229619176668713819931811048770190271
25267680276078003013678680992525463401061632866526
36270218540497705585629946580636237993140746255962
24074486908231174977792365466257246923322810917141
91430288197103288597806669760892938638285025333403
34413065578016127815921815005561868836468420090470
23053081172816430487623791969842487255036638784583
11487696932154902810424020138335124462181441773470
63783299490636259666498587618221225225512486764533
67720186971698544312419572409913959008952310058822
95548255300263520781532296796249481641953868218774
76085327132285723110424803456124867697064507995236
37774242535411291684276865538926205024910326572967
23701913275725675285653248258265463092207058596522
29798860272258331913126375147341994889534765745501
18495701454879288984856827726077713721403798879715
38298203783031473527721580348144513491373226651381
34829543829199918180278916522431027392251122869539
40957953066405232632538044100059654939159879593635
29746152185502371307642255121183693803580388584903
41698116222072977186158236678424689157993532961922
62467957194401269043877107275048102390895523597457
23189706772547915061505504953922979530901129967519
86188088225875314529584099251203829009407770775672
11306739708304724483816533873502340845647058077308
82959174767140363198008187129011875491310547126581
97623331044818386269515456334926366572897563400500
42846280183517070527831839425882145521227251250327
55121603546981200581762165212827652751691296897789
32238195734329339946437501907836945765883352399886
75506164965184775180738168837861091527357929701337
62177842752192623401942399639168044983993173312731
32924185707147349566916674687634660915035914677504
99518671430235219628894890102423325116913619626622
73267460800591547471830798392868535206946944540724
76841822524674417161514036427982273348055556214818
97142617910342598647204516893989422179826088076852
87783646182799346313767754307809363333018982642090
10848802521674670883215120185883543223812876952786
71329612474782464538636993009049310363619763878039
62184073572399794223406235393808339651327408011116
66627891981488087797941876876144230030984490851411
60661826293682836764744779239180335110989069790714
85786944089552990653640447425576083659976645795096
66024396409905389607120198219976047599490197230297
64913982680032973156037120041377903785566085089252
16730939319872750275468906903707539413042652315011
94809377245048795150954100921645863754710598436791
78639167021187492431995700641917969777599028300699
15368713711936614952811305876380278410754449733078
40789923115535562561142322423255033685442488917353
44889911501440648020369068063960672322193204149535
41503128880339536053299340368006977710650566631954
81234880673210146739058568557934581403627822703280
82616570773948327592232845941706525094512325230608
22918802058777319719839450180888072429661980811197
77158542502016545090413245809786882778948721859617
72107838435069186155435662884062257473692284509516
20849603980134001723930671666823555245252804609722
53503534226472524250874054075591789781264330331690
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>largeSum(testNums)</code> should return 8348422521.
testString: 'assert.strictEqual(largeSum(testNums), 8348422521, ''<code>largeSum(testNums)</code> should return 8348422521.'');'
- text: <code>largeSum(fiftyDigitNums)</code> should return 5537376230.
testString: 'assert.strictEqual(largeSum(fiftyDigitNums), 5537376230, ''<code>largeSum(fiftyDigitNums)</code> should return 5537376230.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function largeSum(arr) {
// Good luck!
return true;
}
// only change code above this line
const testNums = [
'37107287533902102798797998220837590246510135740250',
'46376937677490009712648124896970078050417018260538'
];
largeSum(testNums);
```
</div>
### Before Test
<div id='js-setup'>
```js
const fiftyDigitNums = [
'37107287533902102798797998220837590246510135740250',
'46376937677490009712648124896970078050417018260538',
'74324986199524741059474233309513058123726617309629',
'91942213363574161572522430563301811072406154908250',
'23067588207539346171171980310421047513778063246676',
'89261670696623633820136378418383684178734361726757',
'28112879812849979408065481931592621691275889832738',
'44274228917432520321923589422876796487670272189318',
'47451445736001306439091167216856844588711603153276',
'70386486105843025439939619828917593665686757934951',
'62176457141856560629502157223196586755079324193331',
'64906352462741904929101432445813822663347944758178',
'92575867718337217661963751590579239728245598838407',
'58203565325359399008402633568948830189458628227828',
'80181199384826282014278194139940567587151170094390',
'35398664372827112653829987240784473053190104293586',
'86515506006295864861532075273371959191420517255829',
'71693888707715466499115593487603532921714970056938',
'54370070576826684624621495650076471787294438377604',
'53282654108756828443191190634694037855217779295145',
'36123272525000296071075082563815656710885258350721',
'45876576172410976447339110607218265236877223636045',
'17423706905851860660448207621209813287860733969412',
'81142660418086830619328460811191061556940512689692',
'51934325451728388641918047049293215058642563049483',
'62467221648435076201727918039944693004732956340691',
'15732444386908125794514089057706229429197107928209',
'55037687525678773091862540744969844508330393682126',
'18336384825330154686196124348767681297534375946515',
'80386287592878490201521685554828717201219257766954',
'78182833757993103614740356856449095527097864797581',
'16726320100436897842553539920931837441497806860984',
'48403098129077791799088218795327364475675590848030',
'87086987551392711854517078544161852424320693150332',
'59959406895756536782107074926966537676326235447210',
'69793950679652694742597709739166693763042633987085',
'41052684708299085211399427365734116182760315001271',
'65378607361501080857009149939512557028198746004375',
'35829035317434717326932123578154982629742552737307',
'94953759765105305946966067683156574377167401875275',
'88902802571733229619176668713819931811048770190271',
'25267680276078003013678680992525463401061632866526',
'36270218540497705585629946580636237993140746255962',
'24074486908231174977792365466257246923322810917141',
'91430288197103288597806669760892938638285025333403',
'34413065578016127815921815005561868836468420090470',
'23053081172816430487623791969842487255036638784583',
'11487696932154902810424020138335124462181441773470',
'63783299490636259666498587618221225225512486764533',
'67720186971698544312419572409913959008952310058822',
'95548255300263520781532296796249481641953868218774',
'76085327132285723110424803456124867697064507995236',
'37774242535411291684276865538926205024910326572967',
'23701913275725675285653248258265463092207058596522',
'29798860272258331913126375147341994889534765745501',
'18495701454879288984856827726077713721403798879715',
'38298203783031473527721580348144513491373226651381',
'34829543829199918180278916522431027392251122869539',
'40957953066405232632538044100059654939159879593635',
'29746152185502371307642255121183693803580388584903',
'41698116222072977186158236678424689157993532961922',
'62467957194401269043877107275048102390895523597457',
'23189706772547915061505504953922979530901129967519',
'86188088225875314529584099251203829009407770775672',
'11306739708304724483816533873502340845647058077308',
'82959174767140363198008187129011875491310547126581',
'97623331044818386269515456334926366572897563400500',
'42846280183517070527831839425882145521227251250327',
'55121603546981200581762165212827652751691296897789',
'32238195734329339946437501907836945765883352399886',
'75506164965184775180738168837861091527357929701337',
'62177842752192623401942399639168044983993173312731',
'32924185707147349566916674687634660915035914677504',
'99518671430235219628894890102423325116913619626622',
'73267460800591547471830798392868535206946944540724',
'76841822524674417161514036427982273348055556214818',
'97142617910342598647204516893989422179826088076852',
'87783646182799346313767754307809363333018982642090',
'10848802521674670883215120185883543223812876952786',
'71329612474782464538636993009049310363619763878039',
'62184073572399794223406235393808339651327408011116',
'66627891981488087797941876876144230030984490851411',
'60661826293682836764744779239180335110989069790714',
'85786944089552990653640447425576083659976645795096',
'66024396409905389607120198219976047599490197230297',
'64913982680032973156037120041377903785566085089252',
'16730939319872750275468906903707539413042652315011',
'94809377245048795150954100921645863754710598436791',
'78639167021187492431995700641917969777599028300699',
'15368713711936614952811305876380278410754449733078',
'40789923115535562561142322423255033685442488917353',
'44889911501440648020369068063960672322193204149535',
'41503128880339536053299340368006977710650566631954',
'81234880673210146739058568557934581403627822703280',
'82616570773948327592232845941706525094512325230608',
'22918802058777319719839450180888072429661980811197',
'77158542502016545090413245809786882778948721859617',
'72107838435069186155435662884062257473692284509516',
'20849603980134001723930671666823555245252804609722',
'53503534226472524250874054075591789781264330331690'
];
const testNums = [
'37107287533902102798797998220837590246510135740250',
'46376937677490009712648124896970078050417018260538'
];
```
</div>
</section>
## Solution
<section id='solution'>
```js
function largeSum(arr) {
let sum = 0;
arr.forEach(function(num) {
sum += parseInt(num, 10);
});
sum = sum.toString(10);
sum = sum.substr(0, 1) + sum.substr(2);
let firstTen = sum.slice(0, 10);
return parseInt(firstTen, 10);
}
```
</section>

View File

@ -0,0 +1,59 @@
---
id: 5900f3ee1000cf542c50ff00
challengeType: 5
title: 'Problem 130: Composites with prime repunit property'
---
## Description
<section id='description'>
A number consisting entirely of ones is called a repunit. We shall define R(k) to be a repunit of length k; for example, R(6) = 111111.
Given that n is a positive integer and GCD(n, 10) = 1, it can be shown that there always exists a value, k, for which R(k) is divisible by n, and let A(n) be the least such value of k; for example, A(7) = 6 and A(41) = 5.
You are given that for all primes, p > 5, that p 1 is divisible by A(p). For example, when p = 41, A(41) = 5, and 40 is divisible by 5.
However, there are rare composite values for which this is also true; the first five examples being 91, 259, 451, 481, and 703.
Find the sum of the first twenty-five composite values of n for whichGCD(n, 10) = 1 and n 1 is divisible by A(n).
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler130()</code> should return 149253.
testString: 'assert.strictEqual(euler130(), 149253, ''<code>euler130()</code> should return 149253.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler130() {
// Good luck!
return true;
}
euler130();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,58 @@
---
id: 5900f3ef1000cf542c50ff02
challengeType: 5
title: 'Problem 131: Prime cube partnership'
---
## Description
<section id='description'>
There are some prime values, p, for which there exists a positive integer, n, such that the expression n3 + n2p is a perfect cube.
For example, when p = 19, 83 + 82×19 = 123.
What is perhaps most surprising is that for each prime with this property the value of n is unique, and there are only four such primes below one-hundred.
How many primes below one million have this remarkable property?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler131()</code> should return 173.
testString: 'assert.strictEqual(euler131(), 173, ''<code>euler131()</code> should return 173.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler131() {
// Good luck!
return true;
}
euler131();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,57 @@
---
id: 5900f3f11000cf542c50ff03
challengeType: 5
title: 'Problem 132: Large repunit factors'
---
## Description
<section id='description'>
A number consisting entirely of ones is called a repunit. We shall define R(k) to be a repunit of length k.
For example, R(10) = 1111111111 = 11×41×271×9091, and the sum of these prime factors is 9414.
Find the sum of the first forty prime factors of R(109).
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler132()</code> should return 843296.
testString: 'assert.strictEqual(euler132(), 843296, ''<code>euler132()</code> should return 843296.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler132() {
// Good luck!
return true;
}
euler132();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,58 @@
---
id: 5900f3f21000cf542c50ff04
challengeType: 5
title: 'Problem 133: Repunit nonfactors'
---
## Description
<section id='description'>
A number consisting entirely of ones is called a repunit. We shall define R(k) to be a repunit of length k; for example, R(6) = 111111.
Let us consider repunits of the form R(10n).
Although R(10), R(100), or R(1000) are not divisible by 17, R(10000) is divisible by 17. Yet there is no value of n for which R(10n) will divide by 19. In fact, it is remarkable that 11, 17, 41, and 73 are the only four primes below one-hundred that can be a factor of R(10n).
Find the sum of all the primes below one-hundred thousand that will never be a factor of R(10n).
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler133()</code> should return 453647705.
testString: 'assert.strictEqual(euler133(), 453647705, ''<code>euler133()</code> should return 453647705.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler133() {
// Good luck!
return true;
}
euler133();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,57 @@
---
id: 5900f3f21000cf542c50ff05
challengeType: 5
title: 'Problem 134: Prime pair connection'
---
## Description
<section id='description'>
Consider the consecutive primes p1 = 19 and p2 = 23. It can be verified that 1219 is the smallest number such that the last digits are formed by p1 whilst also being divisible by p2.
In fact, with the exception of p1 = 3 and p2 = 5, for every pair of consecutive primes, p2 > p1, there exist values of n for which the last digits are formed by p1 and n is divisible by p2. Let S be the smallest of these values of n.
Find ∑ S for every pair of consecutive primes with 5 ≤ p1 ≤ 1000000.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler134()</code> should return 18613426663617120.
testString: 'assert.strictEqual(euler134(), 18613426663617120, ''<code>euler134()</code> should return 18613426663617120.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler134() {
// Good luck!
return true;
}
euler134();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,58 @@
---
id: 5900f3f31000cf542c50ff06
challengeType: 5
title: 'Problem 135: Same differences'
---
## Description
<section id='description'>
Given the positive integers, x, y, and z, are consecutive terms of an arithmetic progression, the least value of the positive integer, n, for which the equation, x2 y2 z2 = n, has exactly two solutions is n = 27:
342 272 202 = 122 92 62 = 27
It turns out that n = 1155 is the least value which has exactly ten solutions.
How many values of n less than one million have exactly ten distinct solutions?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler135()</code> should return 4989.
testString: 'assert.strictEqual(euler135(), 4989, ''<code>euler135()</code> should return 4989.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler135() {
// Good luck!
return true;
}
euler135();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,58 @@
---
id: 5900f3f51000cf542c50ff07
challengeType: 5
title: 'Problem 136: Singleton difference'
---
## Description
<section id='description'>
The positive integers, x, y, and z, are consecutive terms of an arithmetic progression. Given that n is a positive integer, the equation, x2 y2 z2 = n, has exactly one solution when n = 20:
132 102 72 = 20
In fact there are twenty-five values of n below one hundred for which the equation has a unique solution.
How many values of n less than fifty million have exactly one solution?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler136()</code> should return 2544559.
testString: 'assert.strictEqual(euler136(), 2544559, ''<code>euler136()</code> should return 2544559.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler136() {
// Good luck!
return true;
}
euler136();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,76 @@
---
id: 5900f3f51000cf542c50ff08
challengeType: 5
title: 'Problem 137: Fibonacci golden nuggets'
---
## Description
<section id='description'>
Consider the infinite polynomial series AF(x) = xF1 + x2F2 + x3F3 + ..., where Fk is the kth term in the Fibonacci sequence: 1, 1, 2, 3, 5, 8, ... ; that is, Fk = Fk1 + Fk2, F1 = 1 and F2 = 1.
For this problem we shall be interested in values of x for which AF(x) is a positive integer.
Surprisingly AF(1/2)
 = 
(1/2).1 + (1/2)2.1 + (1/2)3.2 + (1/2)4.3 + (1/2)5.5 + ...
 = 
1/2 + 1/4 + 2/8 + 3/16 + 5/32 + ...
 = 
2
The corresponding values of x for the first five natural numbers are shown below.
xAF(x)
√211
1/22
(√132)/33
(√895)/84
(√343)/55
We shall call AF(x) a golden nugget if x is rational, because they become increasingly rarer; for example, the 10th golden nugget is 74049690.
Find the 15th golden nugget.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler137()</code> should return 1120149658760.
testString: 'assert.strictEqual(euler137(), 1120149658760, ''<code>euler137()</code> should return 1120149658760.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler137() {
// Good luck!
return true;
}
euler137();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,60 @@
---
id: 5900f3f61000cf542c50ff09
challengeType: 5
title: 'Problem 138: Special isosceles triangles'
---
## Description
<section id='description'>
Consider the isosceles triangle with base length, b = 16, and legs, L = 17.
By using the Pythagorean theorem it can be seen that the height of the triangle, h = √(172 82) = 15, which is one less than the base length.
With b = 272 and L = 305, we get h = 273, which is one more than the base length, and this is the second smallest isosceles triangle with the property that h = b ± 1.
Find ∑ L for the twelve smallest isosceles triangles for which h = b ± 1 and b, L are positive integers.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler138()</code> should return 1118049290473932.
testString: 'assert.strictEqual(euler138(), 1118049290473932, ''<code>euler138()</code> should return 1118049290473932.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler138() {
// Good luck!
return true;
}
euler138();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,60 @@
---
id: 5900f3f71000cf542c50ff0a
challengeType: 5
title: 'Problem 139: Pythagorean tiles'
---
## Description
<section id='description'>
Let (a, b, c) represent the three sides of a right angle triangle with integral length sides. It is possible to place four such triangles together to form a square with length c.
For example, (3, 4, 5) triangles can be placed together to form a 5 by 5 square with a 1 by 1 hole in the middle and it can be seen that the 5 by 5 square can be tiled with twenty-five 1 by 1 squares.
However, if (5, 12, 13) triangles were used then the hole would measure 7 by 7 and these could not be used to tile the 13 by 13 square.
Given that the perimeter of the right triangle is less than one-hundred million, how many Pythagorean triangles would allow such a tiling to take place?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler139()</code> should return 10057761.
testString: 'assert.strictEqual(euler139(), 10057761, ''<code>euler139()</code> should return 10057761.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler139() {
// Good luck!
return true;
}
euler139();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,100 @@
---
id: 5900f37a1000cf542c50fe8d
challengeType: 5
title: 'Problem 14: Longest Collatz sequence'
---
## Description
<section id='description'>
The following iterative sequence is defined for the set of positive integers:
<div style='padding-left: 4em;'><var>n</var><var>n</var>/2 (<var>n</var> is even)</div>
<div style='padding-left: 4em;'><var>n</var> → 3<var>n</var> + 1 (<var>n</var> is odd)</div>
Using the rule above and starting with 13, we generate the following sequence:
<div style='text-align: center;'>13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1</div>
It can be seen that this sequence (starting at 13 and finishing at 1) contains 10 terms. Although it has not been proved yet (Collatz Problem), it is thought that all starting numbers finish at 1.
Which starting number, under the given <code>limit</code>, produces the longest chain?
NOTE: Once the chain starts the terms are allowed to go above one million.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>longestCollatzSequence(14)</code> should return 9.
testString: 'assert.strictEqual(longestCollatzSequence(14), 9, ''<code>longestCollatzSequence(14)</code> should return 9.'');'
- text: <code>longestCollatzSequence(5847)</code> should return 3711.
testString: 'assert.strictEqual(longestCollatzSequence(5847), 3711, ''<code>longestCollatzSequence(5847)</code> should return 3711.'');'
- text: <code>longestCollatzSequence(46500)</code> should return 35655.
testString: 'assert.strictEqual(longestCollatzSequence(46500), 35655, ''<code>longestCollatzSequence(46500)</code> should return 35655.'');'
- text: <code>longestCollatzSequence(54512)</code> should return 52527.
testString: 'assert.strictEqual(longestCollatzSequence(54512), 52527, ''<code>longestCollatzSequence(54512)</code> should return 52527.'');'
- text: <code>longestCollatzSequence(1000000)</code> should return 837799.
testString: 'assert.strictEqual(longestCollatzSequence(1000000), 837799, ''<code>longestCollatzSequence(1000000)</code> should return 837799.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function longestCollatzSequence(limit) {
// Good luck!
return true;
}
longestCollatzSequence(14);
```
</div>
</section>
## Solution
<section id='solution'>
```js
function longestCollatzSequence(limit) {
let longestSequenceLength = 0;
let startingNum = 0;
function sequenceLength(num) {
let length = 1;
while (num >= 1) {
if (num === 1) { break;
} else if (num % 2 === 0) {
num = num / 2;
length++;
} else {
num = num * 3 + 1;
length++;
}
}
return length;
}
for (let i = 2; i < limit; i++) {
let currSequenceLength = sequenceLength(i);
if (currSequenceLength > longestSequenceLength) {
longestSequenceLength = currSequenceLength;
startingNum = i;
}
}
return startingNum;
}
```
</section>

View File

@ -0,0 +1,67 @@
---
id: 5900f3fa1000cf542c50ff0c
challengeType: 5
title: 'Problem 140: Modified Fibonacci golden nuggets'
---
## Description
<section id='description'>
Consider the infinite polynomial series AG(x) = xG1 + x2G2 + x3G3 + ..., where Gk is the kth term of the second order recurrence relation Gk = Gk1 + Gk2, G1 = 1 and G2 = 4; that is, 1, 4, 5, 9, 14, 23, ... .
For this problem we shall be concerned with values of x for which AG(x) is a positive integer.
The corresponding values of x for the first five natural numbers are shown below.
xAG(x)
(√51)/41
2/52
(√222)/63
(√1375)/144
1/25
We shall call AG(x) a golden nugget if x is rational, because they become increasingly rarer; for example, the 20th golden nugget is 211345365.
Find the sum of the first thirty golden nuggets.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler140()</code> should return 5673835352990.
testString: 'assert.strictEqual(euler140(), 5673835352990, ''<code>euler140()</code> should return 5673835352990.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler140() {
// Good luck!
return true;
}
euler140();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,59 @@
---
id: 5900f3f91000cf542c50ff0b
challengeType: 5
title: 'Problem 141: Investigating progressive numbers, n, which are also square'
---
## Description
<section id='description'>
A positive integer, n, is divided by d and the quotient and remainder are q and r respectively. In addition d, q, and r are consecutive positive integer terms in a geometric sequence, but not necessarily in that order.
For example, 58 divided by 6 has quotient 9 and remainder 4. It can also be seen that 4, 6, 9 are consecutive terms in a geometric sequence (common ratio 3/2).
We will call such numbers, n, progressive.
Some progressive numbers, such as 9 and 10404 = 1022, happen to also be perfect squares. The sum of all progressive perfect squares below one hundred thousand is 124657.
Find the sum of all progressive perfect squares below one trillion (1012).
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler141()</code> should return 878454337159.
testString: 'assert.strictEqual(euler141(), 878454337159, ''<code>euler141()</code> should return 878454337159.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler141() {
// Good luck!
return true;
}
euler141();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,55 @@
---
id: 5900f3fa1000cf542c50ff0d
challengeType: 5
title: 'Problem 142: Perfect Square Collection'
---
## Description
<section id='description'>
Find the smallest x + y + z with integers x > y > z > 0 such that x + y, x y, x + z, x z, y + z, y z are all perfect squares.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler142()</code> should return 1006193.
testString: 'assert.strictEqual(euler142(), 1006193, ''<code>euler142()</code> should return 1006193.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler142() {
// Good luck!
return true;
}
euler142();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,60 @@
---
id: 5900f3fc1000cf542c50ff0e
challengeType: 5
title: 'Problem 143: Investigating the Torricelli point of a triangle'
---
## Description
<section id='description'>
Let ABC be a triangle with all interior angles being less than 120 degrees. Let X be any point inside the triangle and let XA = p, XC = q, and XB = r.
Fermat challenged Torricelli to find the position of X such that p + q + r was minimised.
Torricelli was able to prove that if equilateral triangles AOB, BNC and AMC are constructed on each side of triangle ABC, the circumscribed circles of AOB, BNC, and AMC will intersect at a single point, T, inside the triangle. Moreover he proved that T, called the Torricelli/Fermat point, minimises p + q + r. Even more remarkable, it can be shown that when the sum is minimised, AN = BM = CO = p + q + r and that AN, BM and CO also intersect at T.
If the sum is minimised and a, b, c, p, q and r are all positive integers we shall call triangle ABC a Torricelli triangle. For example, a = 399, b = 455, c = 511 is an example of a Torricelli triangle, with p + q + r = 784.
Find the sum of all distinct values of p + q + r ≤ 120000 for Torricelli triangles.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler143()</code> should return 30758397.
testString: 'assert.strictEqual(euler143(), 30758397, ''<code>euler143()</code> should return 30758397.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler143() {
// Good luck!
return true;
}
euler143();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,64 @@
---
id: 5900f3fc1000cf542c50ff0f
challengeType: 5
title: 'Problem 144: Investigating multiple reflections of a laser beam'
---
## Description
<section id='description'>
In laser physics, a "white cell" is a mirror system that acts as a delay line for the laser beam. The beam enters the cell, bounces around on the mirrors, and eventually works its way back out.
The specific white cell we will be considering is an ellipse with the equation 4x2 + y2 = 100
The section corresponding to 0.01 ≤ x ≤ +0.01 at the top is missing, allowing the light to enter and exit through the hole.
The light beam in this problem starts at the point (0.0,10.1) just outside the white cell, and the beam first impacts the mirror at (1.4,-9.6).
Each time the laser beam hits the surface of the ellipse, it follows the usual law of reflection "angle of incidence equals angle of reflection." That is, both the incident and reflected beams make the same angle with the normal line at the point of incidence.
In the figure on the left, the red line shows the first two points of contact between the laser beam and the wall of the white cell; the blue line shows the line tangent to the ellipse at the point of incidence of the first bounce.The slope m of the tangent line at any point (x,y) of the given ellipse is: m = 4x/yThe normal line is perpendicular to this tangent line at the point of incidence.
The animation on the right shows the first 10 reflections of the beam.
How many times does the beam hit the internal surface of the white cell before exiting?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler144()</code> should return 354.
testString: 'assert.strictEqual(euler144(), 354, ''<code>euler144()</code> should return 354.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler144() {
// Good luck!
return true;
}
euler144();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,59 @@
---
id: 5900f3fd1000cf542c50ff10
challengeType: 5
title: 'Problem 145: How many reversible numbers are there below one-billion?'
---
## Description
<section id='description'>
Some positive integers n have the property that the sum [ n + reverse(n) ] consists entirely of odd (decimal) digits. For instance, 36 + 63 = 99 and 409 + 904 = 1313. We will call such numbers reversible; so 36, 63, 409, and 904 are reversible. Leading zeroes are not allowed in either n or reverse(n).
There are 120 reversible numbers below one-thousand.
How many reversible numbers are there below one-billion (109)?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler145()</code> should return 608720.
testString: 'assert.strictEqual(euler145(), 608720, ''<code>euler145()</code> should return 608720.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler145() {
// Good luck!
return true;
}
euler145();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,57 @@
---
id: 5900f3fe1000cf542c50ff11
challengeType: 5
title: 'Problem 146: Investigating a Prime Pattern'
---
## Description
<section id='description'>
The smallest positive integer n for which the numbers n2+1, n2+3, n2+7, n2+9, n2+13, and n2+27 are consecutive primes is 10. The sum of all such integers n below one-million is 1242490.
What is the sum of all such integers n below 150 million?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler146()</code> should return 676333270.
testString: 'assert.strictEqual(euler146(), 676333270, ''<code>euler146()</code> should return 676333270.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler146() {
// Good luck!
return true;
}
euler146();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,66 @@
---
id: 5900f3ff1000cf542c50ff12
challengeType: 5
title: 'Problem 147: Rectangles in cross-hatched grids'
---
## Description
<section id='description'>
In a 3x2 cross-hatched grid, a total of 37 different rectangles could be situated within that grid as indicated in the sketch.
There are 5 grids smaller than 3x2, vertical and horizontal dimensions being important, i.e. 1x1, 2x1, 3x1, 1x2 and 2x2. If each of them is cross-hatched, the following number of different rectangles could be situated within those smaller grids:
1x1: 1
2x1: 4
3x1: 8
1x2: 4
2x2: 18
Adding those to the 37 of the 3x2 grid, a total of 72 different rectangles could be situated within 3x2 and smaller grids.
How many different rectangles could be situated within 47x43 and smaller grids?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler147()</code> should return 846910284.
testString: 'assert.strictEqual(euler147(), 846910284, ''<code>euler147()</code> should return 846910284.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler147() {
// Good luck!
return true;
}
euler147();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,128 @@
---
id: 5900f4021000cf542c50ff14
challengeType: 5
title: 'Problem 148: Exploring Pascal''s triangle'
---
## Description
<section id='description'>
We can easily verify that none of the entries in the first seven rows of Pascal's triangle are divisible by 7:
 1
 1
 1
 1
 2
 1
 1
 3
 3
 1
 1
 4
 6
 4
 1
 1
 5
10
10
 5
 1
1
 6
15
20
15
 6
 1
However, if we check the first one hundred rows, we will find that only 2361 of the 5050 entries are not divisible by 7.
Find the number of entries which are not divisible by 7 in the first one billion (109) rows of Pascal's triangle.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler148()</code> should return 2129970655314432.
testString: 'assert.strictEqual(euler148(), 2129970655314432, ''<code>euler148()</code> should return 2129970655314432.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler148() {
// Good luck!
return true;
}
euler148();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,71 @@
---
id: 5900f4021000cf542c50ff13
challengeType: 5
title: 'Problem 149: Searching for a maximum-sum subsequence'
---
## Description
<section id='description'>
Looking at the table below, it is easy to verify that the maximum possible sum of adjacent numbers in any direction (horizontal, vertical, diagonal or anti-diagonal) is 16 (= 8 + 7 + 1).
253296513273184  8
Now, let us repeat the search, but on a much larger scale:
First, generate four million pseudo-random numbers using a specific form of what is known as a "Lagged Fibonacci Generator":
For 1 ≤ k ≤ 55, sk = [100003 200003k + 300007k3] (modulo 1000000) 500000.
For 56 ≤ k ≤ 4000000, sk = [sk24 + sk55 + 1000000] (modulo 1000000) 500000.
Thus, s10 = 393027 and s100 = 86613.
The terms of s are then arranged in a 2000×2000 table, using the first 2000 numbers to fill the first row (sequentially), the next 2000 numbers to fill the second row, and so on.
Finally, find the greatest sum of (any number of) adjacent entries in any direction (horizontal, vertical, diagonal or anti-diagonal).
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler149()</code> should return 52852124.
testString: 'assert.strictEqual(euler149(), 52852124, ''<code>euler149()</code> should return 52852124.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler149() {
// Good luck!
return true;
}
euler149();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,73 @@
---
id: 5900f37b1000cf542c50fe8e
challengeType: 5
title: 'Problem 15: Lattice paths'
---
## Description
<section id='description'>
Starting in the top left corner of a 2×2 grid, and only being able to move to the right and down, there are exactly 6 routes to the bottom right corner.
<img class="img-responsive center-block" alt="a diagram of 6 2 by 2 grids showing all the routes to the bottom right corner" src="https://i.imgur.com/1Atixoj.gif">
How many such routes are there through a given <code>gridSize</code>?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>latticePaths(4)</code> should return 70.
testString: 'assert.strictEqual(latticePaths(4), 70, ''<code>latticePaths(4)</code> should return 70.'');'
- text: <code>latticePaths(9)</code> should return 48620.
testString: 'assert.strictEqual(latticePaths(9), 48620, ''<code>latticePaths(9)</code> should return 48620.'');'
- text: <code>latticePaths(20)</code> should return 137846528820.
testString: 'assert.strictEqual(latticePaths(20), 137846528820, ''<code>latticePaths(20)</code> should return 137846528820.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function latticePaths(gridSize) {
// Good luck!
return true;
}
latticePaths(4);
```
</div>
</section>
## Solution
<section id='solution'>
```js
function latticePaths(gridSize) {
let paths = 1;
for (let i = 0; i < gridSize; i++) {
paths *= (2 * gridSize) - i;
paths /= i + 1;
}
return paths;
}
```
</section>

View File

@ -0,0 +1,80 @@
---
id: 5900f4031000cf542c50ff15
challengeType: 5
title: 'Problem 150: Searching a triangular array for a sub-triangle having minimum-sum'
---
## Description
<section id='description'>
In a triangular array of positive and negative integers, we wish to find a sub-triangle such that the sum of the numbers it contains is the smallest possible.
In the example below, it can be easily verified that the marked triangle satisfies this condition having a sum of 42.
We wish to make such a triangular array with one thousand rows, so we generate 500500 pseudo-random numbers sk in the range ±219, using a type of random number generator (known as a Linear Congruential Generator) as follows:
t := 0
for k = 1 up to k = 500500:
    t := (615949*t + 797807) modulo 220
    sk := t219
Thus: s1 = 273519, s2 = 153582, s3 = 450905 etc
Our triangular array is then formed using the pseudo-random numbers thus:
s1
s2  s3
s4  s5  s6 
s7  s8  s9  s10
...
Sub-triangles can start at any element of the array and extend down as far as we like (taking-in the two elements directly below it from the next row, the three elements directly below from the row after that, and so on).
The "sum of a sub-triangle" is defined as the sum of all the elements it contains.
Find the smallest possible sub-triangle sum.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler150()</code> should return -271248680.
testString: 'assert.strictEqual(euler150(), -271248680, ''<code>euler150()</code> should return -271248680.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler150() {
// Good luck!
return true;
}
euler150();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,62 @@
---
id: 5900f4031000cf542c50ff16
challengeType: 5
title: 'Problem 151: Paper sheets of standard sizes: an expected-value problem'
---
## Description
<section id='description'>
A printing shop runs 16 batches (jobs) every week and each batch requires a sheet of special colour-proofing paper of size A5.
Every Monday morning, the foreman opens a new envelope, containing a large sheet of the special paper with size A1.
He proceeds to cut it in half, thus getting two sheets of size A2. Then he cuts one of them in half to get two sheets of size A3 and so on until he obtains the A5-size sheet needed for the first batch of the week.
All the unused sheets are placed back in the envelope.
At the beginning of each subsequent batch, he takes from the envelope one sheet of paper at random. If it is of size A5, he uses it. If it is larger, he repeats the 'cut-in-half' procedure until he has what he needs and any remaining sheets are always placed back in the envelope.
Excluding the first and last batch of the week, find the expected number of times (during each week) that the foreman finds a single sheet of paper in the envelope.
Give your answer rounded to six decimal places using the format x.xxxxxx .
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler151()</code> should return 0.464399.
testString: 'assert.strictEqual(euler151(), 0.464399, ''<code>euler151()</code> should return 0.464399.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler151() {
// Good luck!
return true;
}
euler151();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,59 @@
---
id: 5900f4041000cf542c50ff17
challengeType: 5
title: 'Problem 152: Writing one half as a sum of inverse squares'
---
## Description
<section id='description'>
There are several ways to write the number 1/2 as a sum of inverse squares using distinct integers.
For instance, the numbers {2,3,4,5,7,12,15,20,28,35} can be used:
In fact, only using integers between 2 and 45 inclusive, there are exactly three ways to do it, the remaining two being: {2,3,4,6,7,9,10,20,28,35,36,45} and {2,3,4,6,7,9,12,15,28,30,35,36,45}.
How many ways are there to write the number 1/2 as a sum of inverse squares using distinct integers between 2 and 80 inclusive?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler152()</code> should return 301.
testString: 'assert.strictEqual(euler152(), 301, ''<code>euler152()</code> should return 301.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler152() {
// Good luck!
return true;
}
euler152();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,99 @@
---
id: 5900f4051000cf542c50ff18
challengeType: 5
title: 'Problem 153: Investigating Gaussian Integers'
---
## Description
<section id='description'>
As we all know the equation x2=-1 has no solutions for real x.
If we however introduce the imaginary number i this equation has two solutions: x=i and x=-i.
If we go a step further the equation (x-3)2=-4 has two complex solutions: x=3+2i and x=3-2i.
x=3+2i and x=3-2i are called each others' complex conjugate.
Numbers of the form a+bi are called complex numbers.
In general a+bi and abi are each other's complex conjugate.
A Gaussian Integer is a complex number a+bi such that both a and b are integers.
The regular integers are also Gaussian integers (with b=0).
To distinguish them from Gaussian integers with b ≠ 0 we call such integers "rational integers."
A Gaussian integer is called a divisor of a rational integer n if the result is also a Gaussian integer.
If for example we divide 5 by 1+2i we can simplify in the following manner:
Multiply numerator and denominator by the complex conjugate of 1+2i: 12i.
The result is
.
So 1+2i is a divisor of 5.
Note that 1+i is not a divisor of 5 because .
Note also that if the Gaussian Integer (a+bi) is a divisor of a rational integer n, then its complex conjugate (abi) is also a divisor of n.
In fact, 5 has six divisors such that the real part is positive: {1, 1 + 2i, 1 2i, 2 + i, 2 i, 5}.
The following is a table of all of the divisors for the first five positive rational integers:
n Gaussian integer divisors
with positive real partSum s(n) of these
divisors111
21, 1+i, 1-i, 25
31, 34
41, 1+i, 1-i, 2, 2+2i, 2-2i,413
51, 1+2i, 1-2i, 2+i, 2-i, 512
For divisors with positive real parts, then, we have: .
For 1 ≤ n ≤ 105, ∑ s(n)=17924657155.
What is ∑ s(n) for 1 ≤ n ≤ 108?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler153()</code> should return 17971254122360636.
testString: 'assert.strictEqual(euler153(), 17971254122360636, ''<code>euler153()</code> should return 17971254122360636.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler153() {
// Good luck!
return true;
}
euler153();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,62 @@
---
id: 5900f4071000cf542c50ff19
challengeType: 5
title: 'Problem 154: Exploring Pascal''s pyramid'
---
## Description
<section id='description'>
A triangular pyramid is constructed using spherical balls so that each ball rests on exactly three balls of the next lower level.
Then, we calculate the number of paths leading from the apex to each position:
A path starts at the apex and progresses downwards to any of the three spheres directly below the current position.
Consequently, the number of paths to reach a certain position is the sum of the numbers immediately above it (depending on the position, there are up to three numbers above it).
The result is Pascal's pyramid and the numbers at each level n are the coefficients of the trinomial expansion
(x + y + z)n.
How many coefficients in the expansion of (x + y + z)200000 are multiples of 1012?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler154()</code> should return 479742450.
testString: 'assert.strictEqual(euler154(), 479742450, ''<code>euler154()</code> should return 479742450.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler154() {
// Good luck!
return true;
}
euler154();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,64 @@
---
id: 5900f4081000cf542c50ff1a
challengeType: 5
title: 'Problem 155: Counting Capacitor Circuits'
---
## Description
<section id='description'>
An electric circuit uses exclusively identical capacitors of the same value C.
The capacitors can be connected in series or in parallel to form sub-units, which can then be connected in series or in parallel with other capacitors or other sub-units to form larger sub-units, and so on up to a final circuit.
Using this simple procedure and up to n identical capacitors, we can make circuits having a range of different total capacitances. For example, using up to n=3 capacitors of 60 F each, we can obtain the following 7 distinct total capacitance values:
If we denote by D(n) the number of distinct total capacitance values we can obtain when using up to n equal-valued capacitors and the simple procedure described above, we have: D(1)=1, D(2)=3, D(3)=7 ...
Find D(18).
Reminder : When connecting capacitors C1, C2 etc in parallel, the total capacitance is CT = C1 + C2 +...,
whereas when connecting them in series, the overall capacitance is given by:
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler155()</code> should return 3857447.
testString: 'assert.strictEqual(euler155(), 3857447, ''<code>euler155()</code> should return 3857447.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler155() {
// Good luck!
return true;
}
euler155();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,87 @@
---
id: 5900f4091000cf542c50ff1b
challengeType: 5
title: 'Problem 156: Counting Digits'
---
## Description
<section id='description'>
Starting from zero the natural numbers are written down in base 10 like this:
0 1 2 3 4 5 6 7 8 9 10 11 12....
Consider the digit d=1. After we write down each number n, we will update the number of ones that have occurred and call this number f(n,1). The first values for f(n,1), then, are as follows:
nf(n,1)
00
11
21
31
41
51
61
71
81
91
102
114
125
Note that f(n,1) never equals 3.
So the first two solutions of the equation f(n,1)=n are n=0 and n=1. The next solution is n=199981.
In the same manner the function f(n,d) gives the total number of digits d that have been written down after the number n has been written.
In fact, for every digit d ≠ 0, 0 is the first solution of the equation f(n,d)=n.
Let s(d) be the sum of all the solutions for which f(n,d)=n.
You are given that s(1)=22786974071.
Find ∑ s(d) for 1 ≤ d ≤ 9.
Note: if, for some n, f(n,d)=n
for more than one value of d this value of n is counted again for every value of d for which f(n,d)=n.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler156()</code> should return 21295121502550.
testString: 'assert.strictEqual(euler156(), 21295121502550, ''<code>euler156()</code> should return 21295121502550.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler156() {
// Good luck!
return true;
}
euler156();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,77 @@
---
id: 5900f4091000cf542c50ff1c
challengeType: 5
title: 'Problem 157: Solving the diophantine equation'
---
## Description
<section id='description'>
Consider the diophantine equation 1/a+1/b= p/10n with a, b, p, n positive integers and a ≤ b.
For n=1 this equation has 20 solutions that are listed below:
1/1+1/1=20/10
1/1+1/2=15/10
1/1+1/5=12/10
1/1+1/10=11/10
1/2+1/2=10/10
1/2+1/5=7/10
1/2+1/10=6/10
1/3+1/6=5/10
1/3+1/15=4/10
1/4+1/4=5/10
1/4+1/20=3/10
1/5+1/5=4/10
1/5+1/10=3/10
1/6+1/30=2/10
1/10+1/10=2/10
1/11+1/110=1/10
1/12+1/60=1/10
1/14+1/35=1/10
1/15+1/30=1/10
1/20+1/20=1/10
How many solutions has this equation for 1 ≤ n ≤ 9?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler157()</code> should return 53490.
testString: 'assert.strictEqual(euler157(), 53490, ''<code>euler157()</code> should return 53490.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler157() {
// Good luck!
return true;
}
euler157();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,62 @@
---
id: 5900f40a1000cf542c50ff1d
challengeType: 5
title: 'Problem 158: Exploring strings for which only one character comes lexicographically after its neighbour to the left'
---
## Description
<section id='description'>
Taking three different letters from the 26 letters of the alphabet, character strings of length three can be formed.
Examples are 'abc', 'hat' and 'zyx'.
When we study these three examples we see that for 'abc' two characters come lexicographically after its neighbour to the left.
For 'hat' there is exactly one character that comes lexicographically after its neighbour to the left. For 'zyx' there are zero characters that come lexicographically after its neighbour to the left.
In all there are 10400 strings of length 3 for which exactly one character comes lexicographically after its neighbour to the left.
We now consider strings of n ≤ 26 different characters from the alphabet.
For every n, p(n) is the number of strings of length n for which exactly one character comes lexicographically after its neighbour to the left.
What is the maximum value of p(n)?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler158()</code> should return 409511334375.
testString: 'assert.strictEqual(euler158(), 409511334375, ''<code>euler158()</code> should return 409511334375.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler158() {
// Good luck!
return true;
}
euler158();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,80 @@
---
id: 5900f40c1000cf542c50ff1e
challengeType: 5
title: 'Problem 159: Digital root sums of factorisations'
---
## Description
<section id='description'>
A composite number can be factored many different ways.
For instance, not including multiplication by one, 24 can be factored in 7 distinct ways:
24 = 2x2x2x3
24 = 2x3x4
24 = 2x2x6
24 = 4x6
24 = 3x8
24 = 2x12
24 = 24
Recall that the digital root of a number, in base 10, is found by adding together the digits of that number,
and repeating that process until a number is arrived at that is less than 10.
Thus the digital root of 467 is 8.
We shall call a Digital Root Sum (DRS) the sum of the digital roots of the individual factors of our number.
The chart below demonstrates all of the DRS values for 24.
FactorisationDigital Root Sum2x2x2x3
92x3x4
92x2x6
104x6
103x8
112x12
524
6The maximum Digital Root Sum of 24 is 11.
The function mdrs(n) gives the maximum Digital Root Sum of n. So mdrs(24)=11.
Find ∑mdrs(n) for 1 < n < 1,000,000.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler159()</code> should return 14489159.
testString: 'assert.strictEqual(euler159(), 14489159, ''<code>euler159()</code> should return 14489159.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler159() {
// Good luck!
return true;
}
euler159();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,89 @@
---
id: 5900f37d1000cf542c50fe8f
challengeType: 5
title: 'Problem 16: Power digit sum'
---
## Description
<section id='description'>
2<sup>15</sup> = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.
What is the sum of the digits of the number 2<sup><code>exponent</code></sup>?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>powerDigitSum(15)</code> should return 26.
testString: 'assert.strictEqual(powerDigitSum(15), 26, ''<code>powerDigitSum(15)</code> should return 26.'');'
- text: <code>powerDigitSum(128)</code> should return 166.
testString: 'assert.strictEqual(powerDigitSum(128), 166, ''<code>powerDigitSum(128)</code> should return 166.'');'
- text: <code>powerDigitSum(1000)</code> should return 1366.
testString: 'assert.strictEqual(powerDigitSum(1000), 1366, ''<code>powerDigitSum(1000)</code> should return 1366.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function powerDigitSum(exponent) {
// Good luck!
return true;
}
powerDigitSum(15);
```
</div>
</section>
## Solution
<section id='solution'>
```js
function powerDigitSum(exponent) {
const bigNum = [1];
let sum = 0;
for (let i = 1; i <= exponent; i++) {
let count = bigNum.length + 1;
let overflow = 0;
for (let j = 0; j < count; j++) {
let digit = bigNum[j] || 0;
digit = 2 * digit + overflow;
if (digit > 9) {
digit -= 10;
overflow = 1;
} else {
overflow = 0;
}
bigNum[j] = digit;
}
}
bigNum.forEach(function(num) {
return sum += num;
});
return sum;
}
```
</section>

View File

@ -0,0 +1,60 @@
---
id: 5900f40d1000cf542c50ff1f
challengeType: 5
title: 'Problem 160: Factorial trailing digits'
---
## Description
<section id='description'>
For any N, let f(N) be the last five digits before the trailing zeroes in N!.
For example,
9! = 362880 so f(9)=36288
10! = 3628800 so f(10)=36288
20! = 2432902008176640000 so f(20)=17664
Find f(1,000,000,000,000)
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler160()</code> should return 16576.
testString: 'assert.strictEqual(euler160(), 16576, ''<code>euler160()</code> should return 16576.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler160() {
// Good luck!
return true;
}
euler160();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,69 @@
---
id: 5900f40d1000cf542c50ff20
challengeType: 5
title: 'Problem 161: Triominoes'
---
## Description
<section id='description'>
A triomino is a shape consisting of three squares joined via the edges.
There are two basic forms:
If all possible orientations are taken into account there are six:
Any n by m grid for which nxm is divisible by 3 can be tiled with triominoes.
If we consider tilings that can be obtained by reflection or rotation from another tiling as different there are 41 ways a 2 by 9 grid can be tiled with triominoes:
In how many ways can a 9 by 12 grid be tiled in this way by triominoes?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler161()</code> should return 20574308184277972.
testString: 'assert.strictEqual(euler161(), 20574308184277972, ''<code>euler161()</code> should return 20574308184277972.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler161() {
// Good luck!
return true;
}
euler161();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,62 @@
---
id: 5900f40e1000cf542c50ff21
challengeType: 5
title: 'Problem 162: Hexadecimal numbers'
---
## Description
<section id='description'>
In the hexadecimal number system numbers are represented using 16 different digits:
0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
The hexadecimal number AF when written in the decimal number system equals 10x16+15=175.
In the 3-digit hexadecimal numbers 10A, 1A0, A10, and A01 the digits 0,1 and A are all present.
Like numbers written in base ten we write hexadecimal numbers without leading zeroes.
How many hexadecimal numbers containing at most sixteen hexadecimal digits exist with all of the digits 0,1, and A present at least once?
Give your answer as a hexadecimal number.
(A,B,C,D,E and F in upper case, without any leading or trailing code that marks the number as hexadecimal and without leading zeroes , e.g. 1A3F and not: 1a3f and not 0x1a3f and not $1A3F and not #1A3F and not 0000001A3F)
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler162()</code> should return 3D58725572C62302.
testString: 'assert.strictEqual(euler162(), 3D58725572C62302, ''<code>euler162()</code> should return 3D58725572C62302.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler162() {
// Good luck!
return true;
}
euler162();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,62 @@
---
id: 5900f40f1000cf542c50ff22
challengeType: 5
title: 'Problem 163: Cross-hatched triangles'
---
## Description
<section id='description'>
Consider an equilateral triangle in which straight lines are drawn from each vertex to the middle of the opposite side, such as in the size 1 triangle in the sketch below.
Sixteen triangles of either different shape or size or orientation or location can now be observed in that triangle. Using size 1 triangles as building blocks, larger triangles can be formed, such as the size 2 triangle in the above sketch. One-hundred and four triangles of either different shape or size or orientation or location can now be observed in that size 2 triangle.
It can be observed that the size 2 triangle contains 4 size 1 triangle building blocks. A size 3 triangle would contain 9 size 1 triangle building blocks and a size n triangle would thus contain n2 size 1 triangle building blocks.
If we denote T(n) as the number of triangles present in a triangle of size n, then
T(1) = 16
T(2) = 104
Find T(36).
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler163()</code> should return 343047.
testString: 'assert.strictEqual(euler163(), 343047, ''<code>euler163()</code> should return 343047.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler163() {
// Good luck!
return true;
}
euler163();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,55 @@
---
id: 5900f4111000cf542c50ff23
challengeType: 5
title: 'Problem 164: Numbers for which no three consecutive digits have a sum greater than a given value'
---
## Description
<section id='description'>
How many 20 digit numbers n (without any leading zero) exist such that no three consecutive digits of n have a sum greater than 9?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler164()</code> should return 378158756814587.
testString: 'assert.strictEqual(euler164(), 378158756814587, ''<code>euler164()</code> should return 378158756814587.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler164() {
// Good luck!
return true;
}
euler164();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,72 @@
---
id: 5900f4111000cf542c50ff24
challengeType: 5
title: 'Problem 165: Intersections'
---
## Description
<section id='description'>
A segment is uniquely defined by its two endpoints. By considering two line segments in plane geometry there are three possibilities:
the segments have zero points, one point, or infinitely many points in common.
Moreover when two segments have exactly one point in common it might be the case that that common point is an endpoint of either one of the segments or of both. If a common point of two segments is not an endpoint of either of the segments it is an interior point of both segments.
We will call a common point T of two segments L1 and L2 a true intersection point of L1 and L2 if T is the only common point of L1 and L2 and T is an interior point of both segments.
Consider the three segments L1, L2, and L3:
L1: (27, 44) to (12, 32)
L2: (46, 53) to (17, 62)
L3: (46, 70) to (22, 40)
It can be verified that line segments L2 and L3 have a true intersection point. We note that as the one of the end points of L3: (22,40) lies on L1 this is not considered to be a true point of intersection. L1 and L2 have no common point. So among the three line segments, we find one true intersection point.
Now let us do the same for 5000 line segments. To this end, we generate 20000 numbers using the so-called "Blum Blum Shub" pseudo-random number generator.
s0 = 290797
sn+1 = sn×sn (modulo 50515093)
tn = sn (modulo 500)
To create each line segment, we use four consecutive numbers tn. That is, the first line segment is given by:
(t1, t2) to (t3, t4)
The first four numbers computed according to the above generator should be: 27, 144, 12 and 232. The first segment would thus be (27,144) to (12,232).
How many distinct true intersection points are found among the 5000 line segments?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler165()</code> should return 2868868.
testString: 'assert.strictEqual(euler165(), 2868868, ''<code>euler165()</code> should return 2868868.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler165() {
// Good luck!
return true;
}
euler165();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,67 @@
---
id: 5900f4131000cf542c50ff25
challengeType: 5
title: 'Problem 166: Criss Cross'
---
## Description
<section id='description'>
A 4x4 grid is filled with digits d, 0 ≤ d ≤ 9.
It can be seen that in the grid
6 3 3 0
5 0 4 3
0 7 1 4
1 2 4 5
the sum of each row and each column has the value 12. Moreover the sum of each diagonal is also 12.
In how many ways can you fill a 4x4 grid with the digits d, 0 ≤ d ≤ 9 so that each row, each column, and both diagonals have the same sum?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler166()</code> should return 7130034.
testString: 'assert.strictEqual(euler166(), 7130034, ''<code>euler166()</code> should return 7130034.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler166() {
// Good luck!
return true;
}
euler166();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,60 @@
---
id: 5900f4141000cf542c50ff26
challengeType: 5
title: 'Problem 167: Investigating Ulam sequences'
---
## Description
<section id='description'>
For two positive integers a and b, the Ulam sequence U(a,b) is defined by U(a,b)1 = a, U(a,b)2 = b and for k > 2,
U(a,b)k is the smallest integer greater than U(a,b)(k-1) which can be written in exactly one way as the sum of two distinct previous members of U(a,b).
For example, the sequence U(1,2) begins with
1, 2, 3 = 1 + 2, 4 = 1 + 3, 6 = 2 + 4, 8 = 2 + 6, 11 = 3 + 8;
5 does not belong to it because 5 = 1 + 4 = 2 + 3 has two representations as the sum of two previous members, likewise 7 = 1 + 6 = 3 + 4.
Find ∑U(2,2n+1)k for 2 ≤ n ≤10, where k = 1011.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler167()</code> should return 3916160068885.
testString: 'assert.strictEqual(euler167(), 3916160068885, ''<code>euler167()</code> should return 3916160068885.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler167() {
// Good luck!
return true;
}
euler167();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,58 @@
---
id: 5900f4151000cf542c50ff27
challengeType: 5
title: 'Problem 168: Number Rotations'
---
## Description
<section id='description'>
Consider the number 142857. We can right-rotate this number by moving the last digit (7) to the front of it, giving us 714285.
It can be verified that 714285=5×142857.
This demonstrates an unusual property of 142857: it is a divisor of its right-rotation.
Find the last 5 digits of the sum of all integers n, 10 < n < 10100, that have this property.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler168()</code> should return 59206.
testString: 'assert.strictEqual(euler168(), 59206, ''<code>euler168()</code> should return 59206.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler168() {
// Good luck!
return true;
}
euler168();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,61 @@
---
id: 5900f4151000cf542c50ff28
challengeType: 5
title: 'Problem 169: Exploring the number of different ways a number can be expressed as a sum of powers of 2'
---
## Description
<section id='description'>
Define f(0)=1 and f(n) to be the number of different ways n can be expressed as a sum of integer powers of 2 using each power no more than twice.
For example, f(10)=5 since there are five different ways to express 10:
1 + 1 + 8
1 + 1 + 4 + 41 + 1 + 2 + 2 + 4
2 + 4 + 4
2 + 8
What is f(1025)?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler169()</code> should return 178653872807.
testString: 'assert.strictEqual(euler169(), 178653872807, ''<code>euler169()</code> should return 178653872807.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler169() {
// Good luck!
return true;
}
euler169();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,134 @@
---
id: 5900f37d1000cf542c50fe90
challengeType: 5
title: 'Problem 17: Number letter counts'
---
## Description
<section id='description'>
If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.
If all the numbers from 1 to given <code>limit</code> inclusive were written out in words, how many letters would be used?
<b>NOTE:</b> Do not count spaces or hyphens. For example, 342 (three hundred and forty-two) contains 23 letters and 115 (one hundred and fifteen) contains 20 letters. The use of "and" when writing out numbers is in compliance with British usage.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>numberLetterCounts(5)</code> should return 19.
testString: 'assert.strictEqual(numberLetterCounts(5), 19, ''<code>numberLetterCounts(5)</code> should return 19.'');'
- text: <code>numberLetterCounts(150)</code> should return 1903.
testString: 'assert.strictEqual(numberLetterCounts(150), 1903, ''<code>numberLetterCounts(150)</code> should return 1903.'');'
- text: <code>numberLetterCounts(1000)</code> should return 21124.
testString: 'assert.strictEqual(numberLetterCounts(1000), 21124, ''<code>numberLetterCounts(1000)</code> should return 21124.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function numberLetterCounts(limit) {
// Good luck!
return true;
}
numberLetterCounts(5);
```
</div>
</section>
## Solution
<section id='solution'>
```js
function numberLetterCounts(limit) {
const dictionary = {
0: '',
1: 'one',
2: 'two',
3: 'three',
4: 'four',
5: 'five',
6: 'six',
7: 'seven',
8: 'eight',
9: 'nine',
10: 'ten',
11: 'eleven',
12: 'twelve',
13: 'thirteen',
14: 'fourteen',
15: 'fifteen',
16: 'sixteen',
17: 'seventeen',
18: 'eighteen',
19: 'nineteen',
20: 'twenty',
30: 'thirty',
40: 'forty',
50: 'fifty',
60: 'sixty',
70: 'seventy',
80: 'eighty',
90: 'ninety',
1000: 'onethousand'
};
let numString = '';
function convertToString(num) {
// check dictionary for number
if (dictionary[num]) {
return dictionary[num];
} else {
const hundreds = Math.floor(num / 100);
const tens = Math.floor((num / 10) % 10) * 10;
const remainder = num % 10;
let tempStr = '';
if (hundreds === 0) {
tempStr += dictionary[tens] + dictionary[remainder];
} else {
tempStr += dictionary[hundreds] + 'hundred';
if (tens !== 0 || remainder !== 0) {
tempStr += 'and';
}
if (tens < 20) {
const lessThanTwenty = tens + remainder;
tempStr += dictionary[lessThanTwenty];
} else {
tempStr += dictionary[tens] + dictionary[remainder];
}
}
// console.log(num, hundreds, tens, remainder);
return tempStr;
}
}
for (let i = 1; i <= limit; i++) {
numString += convertToString(i);
}
return numString.length;
}
```
</section>

View File

@ -0,0 +1,64 @@
---
id: 5900f4161000cf542c50ff29
challengeType: 5
title: 'Problem 170: Find the largest 0 to 9 pandigital that can be formed by concatenating products'
---
## Description
<section id='description'>
Take the number 6 and multiply it by each of 1273 and 9854:
6 × 1273 = 7638
6 × 9854 = 59124
By concatenating these products we get the 1 to 9 pandigital 763859124. We will call 763859124 the "concatenated product of 6 and (1273,9854)". Notice too, that the concatenation of the input numbers, 612739854, is also 1 to 9 pandigital.
The same can be done for 0 to 9 pandigital numbers.
What is the largest 0 to 9 pandigital 10-digit concatenated product of an integer with two or more other integers, such that the concatenation of the input numbers is also a 0 to 9 pandigital 10-digit number?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler170()</code> should return 9857164023.
testString: 'assert.strictEqual(euler170(), 9857164023, ''<code>euler170()</code> should return 9857164023.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler170() {
// Good luck!
return true;
}
euler170();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,59 @@
---
id: 5900f4181000cf542c50ff2a
challengeType: 5
title: 'Problem 171: Finding numbers for which the sum of the squares of the digits is a square'
---
## Description
<section id='description'>
For a positive integer n, let f(n) be the sum of the squares of the digits (in base 10) of n, e.g.
f(3) = 32 = 9,
f(25) = 22 + 52 = 4 + 25 = 29,
f(442) = 42 + 42 + 22 = 16 + 16 + 4 = 36
Find the last nine digits of the sum of all n, 0 < n < 1020, such that f(n) is a perfect square.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler171()</code> should return 142989277.
testString: 'assert.strictEqual(euler171(), 142989277, ''<code>euler171()</code> should return 142989277.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler171() {
// Good luck!
return true;
}
euler171();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,55 @@
---
id: 5900f4181000cf542c50ff2b
challengeType: 5
title: 'Problem 172: Investigating numbers with few repeated digits'
---
## Description
<section id='description'>
How many 18-digit numbers n (without leading zeros) are there such that no digit occurs more than three times in n?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler172()</code> should return 227485267000992000.
testString: 'assert.strictEqual(euler172(), 227485267000992000, ''<code>euler172()</code> should return 227485267000992000.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler172() {
// Good luck!
return true;
}
euler172();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,59 @@
---
id: 5900f41a1000cf542c50ff2c
challengeType: 5
title: 'Problem 173: Using up to one million tiles how many different "hollow" square laminae can be formed?'
---
## Description
<section id='description'>
We shall define a square lamina to be a square outline with a square "hole" so that the shape possesses vertical and horizontal symmetry. For example, using exactly thirty-two square tiles we can form two different square laminae:
With one-hundred tiles, and not necessarily using all of the tiles at one time, it is possible to form forty-one different square laminae.
Using up to one million tiles how many different square laminae can be formed?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler173()</code> should return 1572729.
testString: 'assert.strictEqual(euler173(), 1572729, ''<code>euler173()</code> should return 1572729.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler173() {
// Good luck!
return true;
}
euler173();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,61 @@
---
id: 5900f41a1000cf542c50ff2d
challengeType: 5
title: 'Problem 174: Counting the number of "hollow" square laminae that can form one, two, three, ... distinct arrangements'
---
## Description
<section id='description'>
We shall define a square lamina to be a square outline with a square "hole" so that the shape possesses vertical and horizontal symmetry.
Given eight tiles it is possible to form a lamina in only one way: 3x3 square with a 1x1 hole in the middle. However, using thirty-two tiles it is possible to form two distinct laminae.
If t represents the number of tiles used, we shall say that t = 8 is type L(1) and t = 32 is type L(2).
Let N(n) be the number of t ≤ 1000000 such that t is type L(n); for example, N(15) = 832.
What is ∑ N(n) for 1 ≤ n ≤ 10?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler174()</code> should return 209566.
testString: 'assert.strictEqual(euler174(), 209566, ''<code>euler174()</code> should return 209566.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler174() {
// Good luck!
return true;
}
euler174();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,64 @@
---
id: 5900f41c1000cf542c50ff2e
challengeType: 5
title: 'Problem 175: Fractions involving the number of different ways a number can be expressed as a sum of powers of 2'
---
## Description
<section id='description'>
Define f(0)=1 and f(n) to be the number of ways to write n as a sum of powers of 2 where no power occurs more than twice.
For example, f(10)=5 since there are five different ways to express 10:10 = 8+2 = 8+1+1 = 4+4+2 = 4+2+2+1+1 = 4+4+1+1
It can be shown that for every fraction p/q (p>0, q>0) there exists at least one integer n such that f(n)/f(n-1)=p/q.
For instance, the smallest n for which f(n)/f(n-1)=13/17 is 241.
The binary expansion of 241 is 11110001.
Reading this binary number from the most significant bit to the least significant bit there are 4 one's, 3 zeroes and 1 one. We shall call the string 4,3,1 the Shortened Binary Expansion of 241.
Find the Shortened Binary Expansion of the smallest n for which f(n)/f(n-1)=123456789/987654321.
Give your answer as comma separated integers, without any whitespaces.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: '<code>euler175()</code> should return 1, 13717420, 8.'
testString: 'assert.strictEqual(euler175(), 1, 13717420, 8, ''<code>euler175()</code> should return 1, 13717420, 8.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler175() {
// Good luck!
return true;
}
euler175();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,56 @@
---
id: 5900f41c1000cf542c50ff2f
challengeType: 5
title: 'Problem 176: Right-angled triangles that share a cathetus'
---
## Description
<section id='description'>
The four right-angled triangles with sides (9,12,15), (12,16,20), (5,12,13) and (12,35,37) all have one of the shorter sides (catheti) equal to 12. It can be shown that no other integer sided right-angled triangle exists with one of the catheti equal to 12.
Find the smallest integer that can be the length of a cathetus of exactly 47547 different integer sided right-angled triangles.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler176()</code> should return 96818198400000.
testString: 'assert.strictEqual(euler176(), 96818198400000, ''<code>euler176()</code> should return 96818198400000.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler176() {
// Good luck!
return true;
}
euler176();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,60 @@
---
id: 5900f41e1000cf542c50ff30
challengeType: 5
title: 'Problem 177: Integer angled Quadrilaterals'
---
## Description
<section id='description'>
Let ABCD be a convex quadrilateral, with diagonals AC and BD. At each vertex the diagonal makes an angle with each of the two sides, creating eight corner angles.
For example, at vertex A, the two angles are CAD, CAB.
We call such a quadrilateral for which all eight corner angles have integer values when measured in degrees an "integer angled quadrilateral". An example of an integer angled quadrilateral is a square, where all eight corner angles are 45°. Another example is given by DAC = 20°, BAC = 60°, ABD = 50°, CBD = 30°, BCA = 40°, DCA = 30°, CDB = 80°, ADB = 50°.
What is the total number of non-similar integer angled quadrilaterals?
Note: In your calculations you may assume that a calculated angle is integral if it is within a tolerance of 10-9 of an integer value.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler177()</code> should return 129325.
testString: 'assert.strictEqual(euler177(), 129325, ''<code>euler177()</code> should return 129325.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler177() {
// Good luck!
return true;
}
euler177();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,60 @@
---
id: 5900f41e1000cf542c50ff31
challengeType: 5
title: 'Problem 178: Step Numbers'
---
## Description
<section id='description'>
Consider the number 45656.
It can be seen that each pair of consecutive digits of 45656 has a difference of one.
A number for which every pair of consecutive digits has a difference of one is called a step number.
A pandigital number contains every decimal digit from 0 to 9 at least once.
How many pandigital step numbers less than 1040 are there?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler178()</code> should return 126461847755.
testString: 'assert.strictEqual(euler178(), 126461847755, ''<code>euler178()</code> should return 126461847755.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler178() {
// Good luck!
return true;
}
euler178();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,55 @@
---
id: 5900f41f1000cf542c50ff32
challengeType: 5
title: 'Problem 179: Consecutive positive divisors'
---
## Description
<section id='description'>
Find the number of integers 1 < n < 107, for which n and n + 1 have the same number of positive divisors. For example, 14 has the positive divisors 1, 2, 7, 14 while 15 has 1, 3, 5, 15.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler179()</code> should return 986262.
testString: 'assert.strictEqual(euler179(), 986262, ''<code>euler179()</code> should return 986262.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler179() {
// Good luck!
return true;
}
euler179();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,96 @@
---
id: 5900f37e1000cf542c50fe91
challengeType: 5
title: 'Problem 18: Maximum path sum I'
---
## Description
<section id='description'>
By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23.
<span style='display: block; text-align: center;'><b style='color: red;'>3</b><br><b style='color: red;'>7</b> 4<br>2 <b style='color: red;'>4</b> 6<br>8 5 <b style='color: red;'>9</b> 3</span>
That is, 3 + 7 + 4 + 9 = 23.
Find the maximum total from top to bottom of the triangle below:
<span style='display: block; text-align: center;'>75<br>95 64<br>17 47 82<br>18 35 87 10<br>20 04 82 47 65<br>19 01 23 75 03 34<br>88 02 77 73 07 63 67<br>99 65 04 28 06 16 70 92<br>41 41 26 56 83 40 80 70 33<br>41 48 72 33 47 32 37 16 94 29<br>53 71 44 65 25 43 91 52 97 51 14<br>70 11 33 28 77 73 17 78 39 68 17 57<br>91 71 52 38 17 14 91 43 58 50 27 29 48<br>63 66 04 68 89 53 67 30 73 16 69 87 40 31<br>04 62 98 27 23 09 70 98 73 93 38 53 60 04 23</span>
<b>NOTE:</b> As there are only 16384 routes, it is possible to solve this problem by trying every route. However, Problem 67, is the same challenge with a triangle containing one-hundred rows; it cannot be solved by brute force, and requires a clever method! ;o)
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>maximumPathSumI(testTriangle)</code> should return 23.
testString: 'assert.strictEqual(maximumPathSumI(testTriangle), 23, ''<code>maximumPathSumI(testTriangle)</code> should return 23.'');'
- text: <code>maximumPathSumI(numTriangle)</code> should return 1074.
testString: 'assert.strictEqual(maximumPathSumI(numTriangle), 1074, ''<code>maximumPathSumI(numTriangle)</code> should return 1074.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function maximumPathSumI(triangle) {
// Good luck!
return true;
}
const testTriangle = [[3, 0, 0, 0],
[7, 4, 0, 0],
[2, 4, 6, 0],
[8, 5, 9, 3]];
maximumPathSumI(testTriangle);
```
</div>
### Before Test
<div id='js-setup'>
```js
const numTriangle = [[75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [95, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [17, 47, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [18, 35, 87, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [20, 4, 82, 47, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [19, 1, 23, 75, 3, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0], [88, 2, 77, 73, 7, 63, 67, 0, 0, 0, 0, 0, 0, 0, 0], [99, 65, 4, 28, 6, 16, 70, 92, 0, 0, 0, 0, 0, 0, 0], [41, 41, 26, 56, 83, 40, 80, 70, 33, 0, 0, 0, 0, 0, 0], [41, 48, 72, 33, 47, 32, 37, 16, 94, 29, 0, 0, 0, 0, 0], [53, 71, 44, 65, 25, 43, 91, 52, 97, 51, 14, 0, 0, 0, 0], [70, 11, 33, 28, 77, 73, 17, 78, 39, 68, 17, 57, 0, 0, 0], [91, 71, 52, 38, 17, 14, 91, 43, 58, 50, 27, 29, 48, 0, 0], [63, 66, 4, 68, 89, 53, 67, 30, 73, 16, 69, 87, 40, 31, 0], [4, 62, 98, 27, 23, 9, 70, 98, 73, 93, 38, 53, 60, 4, 23]];
```
</div>
</section>
## Solution
<section id='solution'>
```js
const testTriangle = [[3, 0, 0, 0],
[7, 4, 0, 0],
[2, 4, 6, 0],
[8, 5, 9, 3]];
function maximumPathSumI(triangle) {
let maxSum = triangle.slice();
for (let i = triangle.length - 1; i > 0; i--) {
let currentRow = maxSum[i];
let previousRow = maxSum[i - 1];
const temp = [];
for (let j = 0; j < i; j++) {
temp.push(Math.max((currentRow[j] + previousRow[j]), (currentRow[j + 1] + previousRow[j])));
}
maxSum[i - 1] = temp;
maxSum.pop();
}
return maxSum[0][0];
}
```
</section>

View File

@ -0,0 +1,63 @@
---
id: 5900f4201000cf542c50ff33
challengeType: 5
title: 'Problem 180: Rational zeros of a function of three variables'
---
## Description
<section id='description'>
For any integer n, consider the three functions
f1,n(x,y,z) = xn+1 + yn+1 zn+1f2,n(x,y,z) = (xy + yz + zx)*(xn-1 + yn-1 zn-1)f3,n(x,y,z) = xyz*(xn-2 + yn-2 zn-2)
and their combination
fn(x,y,z) = f1,n(x,y,z) + f2,n(x,y,z) f3,n(x,y,z)
We call (x,y,z) a golden triple of order k if x, y, and z are all rational numbers of the form a / b with
0 < a < b k and there is (at least) one integer n, so that fn(x,y,z) = 0.
Let s(x,y,z) = x + y + z.
Let t = u / v be the sum of all distinct s(x,y,z) for all golden triples (x,y,z) of order 35. All the s(x,y,z) and t must be in reduced form.
Find u + v.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler180()</code> should return 285196020571078980.
testString: 'assert.strictEqual(euler180(), 285196020571078980, ''<code>euler180()</code> should return 285196020571078980.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler180() {
// Good luck!
return true;
}
euler180();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,58 @@
---
id: 5900f4231000cf542c50ff34
challengeType: 5
title: 'Problem 181: Investigating in how many ways objects of two different colours can be grouped'
---
## Description
<section id='description'>
Having three black objects B and one white object W they can be grouped in 7 ways like this:
(BBBW)(B,BBW)(B,B,BW)(B,B,B,W)
(B,BB,W)(BBB,W)(BB,BW)
In how many ways can sixty black objects B and forty white objects W be thus grouped?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler181()</code> should return 83735848679360670.
testString: 'assert.strictEqual(euler181(), 83735848679360670, ''<code>euler181()</code> should return 83735848679360670.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler181() {
// Good luck!
return true;
}
euler181();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,69 @@
---
id: 5900f4231000cf542c50ff35
challengeType: 5
title: 'Problem 182: RSA encryption'
---
## Description
<section id='description'>
The RSA encryption is based on the following procedure:
Generate two distinct primes p and q.Compute n=pq and φ=(p-1)(q-1).
Find an integer e, 1<e<φ, such that gcd(e,φ)=1.
A message in this system is a number in the interval [0,n-1].
A text to be encrypted is then somehow converted to messages (numbers in the interval [0,n-1]).
To encrypt the text, for each message, m, c=me mod n is calculated.
To decrypt the text, the following procedure is needed: calculate d such that ed=1 mod φ, then for each encrypted message, c, calculate m=cd mod n.
There exist values of e and m such that me mod n=m.We call messages m for which me mod n=m unconcealed messages.
An issue when choosing e is that there should not be too many unconcealed messages. For instance, let p=19 and q=37.
Then n=19*37=703 and φ=18*36=648.
If we choose e=181, then, although gcd(181,648)=1 it turns out that all possible messagesm (0mn-1) are unconcealed when calculating me mod n.
For any valid choice of e there exist some unconcealed messages.
It's important that the number of unconcealed messages is at a minimum.
Choose p=1009 and q=3643.
Find the sum of all values of e, 1<e<φ(1009,3643) and gcd(e,φ)=1, so that the number of unconcealed messages for this value of e is at a minimum.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler182()</code> should return 399788195976.
testString: 'assert.strictEqual(euler182(), 399788195976, ''<code>euler182()</code> should return 399788195976.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler182() {
// Good luck!
return true;
}
euler182();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,70 @@
---
id: 5900f4231000cf542c50ff36
challengeType: 5
title: 'Problem 183: Maximum product of parts'
---
## Description
<section id='description'>
Let N be a positive integer and let N be split into k equal parts, r = N/k, so that N = r + r + ... + r.
Let P be the product of these parts, P = r × r × ... × r = rk.
For example, if 11 is split into five equal parts, 11 = 2.2 + 2.2 + 2.2 + 2.2 + 2.2, then P = 2.25 = 51.53632.
Let M(N) = Pmax for a given value of N.
It turns out that the maximum for N = 11 is found by splitting eleven into four equal parts which leads to Pmax = (11/4)4; that is, M(11) = 14641/256 = 57.19140625, which is a terminating decimal.
However, for N = 8 the maximum is achieved by splitting it into three equal parts, so M(8) = 512/27, which is a non-terminating decimal.
Let D(N) = N if M(N) is a non-terminating decimal and D(N) = -N if M(N) is a terminating decimal.
For example, ΣD(N) for 5 ≤ N ≤ 100 is 2438.
Find ΣD(N) for 5 ≤ N ≤ 10000.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler183()</code> should return 48861552.
testString: 'assert.strictEqual(euler183(), 48861552, ''<code>euler183()</code> should return 48861552.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler183() {
// Good luck!
return true;
}
euler183();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,61 @@
---
id: 5900f4241000cf542c50ff37
challengeType: 5
title: 'Problem 184: Triangles containing the origin'
---
## Description
<section id='description'>
Consider the set Ir of points (x,y) with integer co-ordinates in the interior of the circle with radius r, centered at the origin, i.e. x2 + y2 < r2.
For a radius of 2, I2 contains the nine points (0,0), (1,0), (1,1), (0,1), (-1,1), (-1,0), (-1,-1), (0,-1) and (1,-1). There are eight triangles having all three vertices in I2 which contain the origin in the interior. Two of them are shown below, the others are obtained from these by rotation.
For a radius of 3, there are 360 triangles containing the origin in the interior and having all vertices in I3 and for I5 the number is 10600.
How many triangles are there containing the origin in the interior and having all three vertices in I105?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler184()</code> should return 1725323624056.
testString: 'assert.strictEqual(euler184(), 1725323624056, ''<code>euler184()</code> should return 1725323624056.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler184() {
// Good luck!
return true;
}
euler184();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,92 @@
---
id: 5900f4251000cf542c50ff38
challengeType: 5
title: 'Problem 185: Number Mind'
---
## Description
<section id='description'>
The game Number Mind is a variant of the well known game Master Mind.
Instead of coloured pegs, you have to guess a secret sequence of digits. After each guess you're only told in how many places you've guessed the correct digit. So, if the sequence was 1234 and you guessed 2036, you'd be told that you have one correct digit; however, you would NOT be told that you also have another digit in the wrong place.
For instance, given the following guesses for a 5-digit secret sequence,
90342 ;2 correct
70794 ;0 correct
39458 ;2 correct
34109 ;1 correct
51545 ;2 correct
12531 ;1 correct
The correct sequence 39542 is unique.
Based on the following guesses,
5616185650518293 ;2 correct
3847439647293047 ;1 correct
5855462940810587 ;3 correct
9742855507068353 ;3 correct
4296849643607543 ;3 correct
3174248439465858 ;1 correct
4513559094146117 ;2 correct
7890971548908067 ;3 correct
8157356344118483 ;1 correct
2615250744386899 ;2 correct
8690095851526254 ;3 correct
6375711915077050 ;1 correct
6913859173121360 ;1 correct
6442889055042768 ;2 correct
2321386104303845 ;0 correct
2326509471271448 ;2 correct
5251583379644322 ;2 correct
1748270476758276 ;3 correct
4895722652190306 ;1 correct
3041631117224635 ;3 correct
1841236454324589 ;3 correct
2659862637316867 ;2 correct
Find the unique 16-digit secret sequence.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler185()</code> should return 4640261571849533.
testString: 'assert.strictEqual(euler185(), 4640261571849533, ''<code>euler185()</code> should return 4640261571849533.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler185() {
// Good luck!
return true;
}
euler185();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,67 @@
---
id: 5900f4281000cf542c50ff39
challengeType: 5
title: 'Problem 186: Connectedness of a network'
---
## Description
<section id='description'>
Here are the records from a busy telephone system with one million users:
RecNrCallerCalled120000710005326001835004393600863701497.........
The telephone number of the caller and the called number in record n are Caller(n) = S2n-1 and Called(n) = S2n where S1,2,3,... come from the "Lagged Fibonacci Generator":
For 1 ≤ k ≤ 55, Sk = [100003 - 200003k + 300007k3] (modulo 1000000)
For 56 ≤ k, Sk = [Sk-24 + Sk-55] (modulo 1000000)
If Caller(n) = Called(n) then the user is assumed to have misdialled and the call fails; otherwise the call is successful.
From the start of the records, we say that any pair of users X and Y are friends if X calls Y or vice-versa. Similarly, X is a friend of a friend of Z if X is a friend of Y and Y is a friend of Z; and so on for longer chains.
The Prime Minister's phone number is 524287. After how many successful calls, not counting misdials, will 99% of the users (including the PM) be a friend, or a friend of a friend etc., of the Prime Minister?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler186()</code> should return 2325629.
testString: 'assert.strictEqual(euler186(), 2325629, ''<code>euler186()</code> should return 2325629.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler186() {
// Good luck!
return true;
}
euler186();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,60 @@
---
id: 5900f4291000cf542c50ff3a
challengeType: 5
title: 'Problem 187: Semiprimes'
---
## Description
<section id='description'>
A composite is a number containing at least two prime factors. For example, 15 = 3 × 5; 9 = 3 × 3; 12 = 2 × 2 × 3.
There are ten composites below thirty containing precisely two, not necessarily distinct, prime factors:
4, 6, 9, 10, 14, 15, 21, 22, 25, 26.
How many composite integers, n < 108, have precisely two, not necessarily distinct, prime factors?
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler187()</code> should return 17427258.
testString: 'assert.strictEqual(euler187(), 17427258, ''<code>euler187()</code> should return 17427258.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler187() {
// Good luck!
return true;
}
euler187();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

View File

@ -0,0 +1,60 @@
---
id: 5900f4291000cf542c50ff3b
challengeType: 5
title: 'Problem 188: The hyperexponentiation of a number'
---
## Description
<section id='description'>
The hyperexponentiation or tetration of a number a by a positive integer b, denoted by a↑↑b or ba, is recursively defined by:
a↑↑1 = a,
a↑↑(k+1) = a(a↑↑k).
Thus we have e.g. 3↑↑2 = 33 = 27, hence 3↑↑3 = 327 = 7625597484987 and 3↑↑4 is roughly 103.6383346400240996*10^12.
Find the last 8 digits of 1777↑↑1855.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler188()</code> should return 95962097.
testString: 'assert.strictEqual(euler188(), 95962097, ''<code>euler188()</code> should return 95962097.'');'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler188() {
// Good luck!
return true;
}
euler188();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>

Some files were not shown because too many files have changed in this diff Show More