chore: manual translations (#42811)

This commit is contained in:
Nicholas Carrigan (he/him)
2021-07-09 21:23:54 -07:00
committed by GitHub
parent a3395269a0
commit c4fd49e5b7
806 changed files with 8935 additions and 4378 deletions

View File

@ -10,26 +10,30 @@ dashedName: problem-101-optimum-polynomial
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, ...
As an example, let us consider the sequence of cube numbers. This is defined by the generating function, $u_n = n^3: 1, 8, 27, 64, 125, 216, \ldots$
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).
We shall define $OP(k, n)$ to be the $n^{th}$ 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.
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) = u_1$.
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, ...
$$\begin{array}{ll} OP(1, n) = 1 & 1, {\color{red}1}, 1, 1, \ldots \\\\ OP(2, n) = 7n6 & 1, 8, {\color{red}{15}}, \ldots \\\\ OP(3, n) = 6n^211n+6 & 1, 8, 27, {\color{red}{58}}, \ldots \\\\ OP(4, n) = n^3 & 1, 8, 27, 64, 125, \ldots \end{array}$$
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.
Clearly no BOPs exist for k ≥ 4. By considering the sum of FITs generated by the BOPs (indicated in $\color{red}{red}$ above), we obtain 1 + 15 + 58 = 74. Consider the following tenth degree polynomial generating function:
$$u_n = 1 n + n^2 n^3 + n^4 n^5 + n^6 n^7 + n^8 n^9 + n^{10}$$
Find the sum of FITs for the BOPs.
# --hints--
`euler101()` should return 37076114526.
`optimumPolynomial()` should return `37076114526`.
```js
assert.strictEqual(euler101(), 37076114526);
assert.strictEqual(optimumPolynomial(), 37076114526);
```
# --seed--
@ -37,12 +41,12 @@ assert.strictEqual(euler101(), 37076114526);
## --seed-contents--
```js
function euler101() {
function optimumPolynomial() {
return true;
}
euler101();
optimumPolynomial();
```
# --solutions--

View File

@ -8,30 +8,29 @@ dashedName: problem-103-special-subset-sums-optimum
# --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:
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.
1. $S(B) ≠ S(C)$; that is, sums of subsets cannot be equal.
2. If B contains more elements than C then $S(B) > S(C)$.
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.
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.
$$\begin{align} & 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\\} \\\\ \end{align}$$
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 = \\{a_1, a_2, \ldots, a_n\\}$, the next optimum set is of the form $B = \\{b, a_1 + b, a_2 + b, \ldots, a_n + b\\}$, where b is the "middle" element on the previous row.
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`.
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.
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.
**Note:** This problem is related to Problem 105 and Problem 106.
# --hints--
`euler103()` should return 20313839404245.
`optimumSpecialSumSet()` should return the string `20313839404245`.
```js
assert.strictEqual(euler103(), 20313839404245);
assert.strictEqual(optimumSpecialSumSet(), '20313839404245');
```
# --seed--
@ -39,12 +38,12 @@ assert.strictEqual(euler103(), 20313839404245);
## --seed-contents--
```js
function euler103() {
function optimumSpecialSumSet() {
return true;
}
euler103();
optimumSpecialSumSet();
```
# --solutions--

View File

@ -10,18 +10,18 @@ dashedName: problem-104-pandigital-fibonacci-ends
The Fibonacci sequence is defined by the recurrence relation:
Fn = Fn1 + Fn2, where F1 = 1 and F2 = 1.
$F_n = F_{n 1} + F_{n 2}$, where $F_1 = 1$ and $F_2 = 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.
It turns out that $F_{541}$, 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 $F_{2749}$, 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.
Given that $F_k$ is the first Fibonacci number for which the first nine digits AND the last nine digits are 1 - 9 pandigital, find `k`.
# --hints--
`euler104()` should return 329468.
`pandigitalFibonacciEnds()` should return `329468`.
```js
assert.strictEqual(euler104(), 329468);
assert.strictEqual(pandigitalFibonacciEnds(), 329468);
```
# --seed--
@ -29,12 +29,12 @@ assert.strictEqual(euler104(), 329468);
## --seed-contents--
```js
function euler104() {
function pandigitalFibonacciEnds() {
return true;
}
euler104();
pandigitalFibonacciEnds();
```
# --solutions--

View File

@ -8,37 +8,48 @@ dashedName: problem-105-special-subset-sums-testing
# --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:
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.
1. $S(B) ≠ S(C)$; that is, sums of subsets cannot be equal.
2. If B contains more elements than C then $S(B) > S(C)$.
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$.
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`, an array with one-hundred sets, containing seven to twelve elements (the two examples given above are the first two sets), identify all the special sum sets, $A_1, A_2, \ldots, A_k$, and find the value of $(A_1) + S(A_2) + \cdots + S(A_k)$.
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.
**Note:** This problem is related to Problem 103 and Problem 106.
# --hints--
`euler105()` should return 73702.
`testingSpecialSubsetSums(testSets)` should return `73702`.
```js
assert.strictEqual(euler105(), 73702);
assert.strictEqual(testingSpecialSubsetSums(_testSets), 73702);
```
# --seed--
## --after-user-code--
```js
const _testSets = [
[81,88,75,42,87,84,86,65],[157,150,164,119,79,159,161,139,158],[673,465,569,603,629,592,584,300,601,599,600],[90,85,83,84,65,87,76,46],[165,168,169,190,162,85,176,167,127],[224,275,278,249,277,279,289,295,139],[354,370,362,384,359,324,360,180,350,270],[599,595,557,298,448,596,577,667,597,588,602],[175,199,137,88,187,173,168,171,174],[93,187,196,144,185,178,186,202,182],[157,155,81,158,119,176,152,167,159],[184,165,159,166,163,167,174,124,83],[1211,1212,1287,605,1208,1189,1060,1216,1243,1200,908,1210],[339,299,153,305,282,304,313,306,302,228],[94,104,63,112,80,84,93,96],[41,88,82,85,61,74,83,81],[90,67,84,83,82,97,86,41],[299,303,151,301,291,302,307,377,333,280],[55,40,48,44,25,42,41],[1038,1188,1255,1184,594,890,1173,1151,1186,1203,1187,1195],[76,132,133,144,135,99,128,154],[77,46,108,81,85,84,93,83],[624,596,391,605,529,610,607,568,604,603,453],[83,167,166,189,163,174,160,165,133],[308,281,389,292,346,303,302,304,300,173],[593,1151,1187,1184,890,1040,1173,1186,1195,1255,1188,1203],[68,46,64,33,60,58,65],[65,43,88,87,86,99,93,90],[83,78,107,48,84,87,96,85],[1188,1173,1256,1038,1187,1151,890,1186,1184,1203,594,1195],[302,324,280,296,294,160,367,298,264,299],[521,760,682,687,646,664,342,698,692,686,672],[56,95,86,97,96,89,108,120],[344,356,262,343,340,382,337,175,361,330],[47,44,42,27,41,40,37],[139,155,161,158,118,166,154,156,78],[118,157,164,158,161,79,139,150,159],[299,292,371,150,300,301,281,303,306,262],[85,77,86,84,44,88,91,67],[88,85,84,44,65,91,76,86],[138,141,127,96,136,154,135,76],[292,308,302,346,300,324,304,305,238,166],[354,342,341,257,348,343,345,321,170,301],[84,178,168,167,131,170,193,166,162],[686,701,706,673,694,687,652,343,683,606,518],[295,293,301,367,296,279,297,263,323,159],[1038,1184,593,890,1188,1173,1187,1186,1195,1150,1203,1255],[343,364,388,402,191,383,382,385,288,374],[1187,1036,1183,591,1184,1175,888,1197,1182,1219,1115,1167],[151,291,307,303,345,238,299,323,301,302],[140,151,143,138,99,69,131,137],[29,44,42,59,41,36,40],[348,329,343,344,338,315,169,359,375,271],[48,39,34,37,50,40,41],[593,445,595,558,662,602,591,297,610,580,594],[686,651,681,342,541,687,691,707,604,675,699],[180,99,189,166,194,188,144,187,199],[321,349,335,343,377,176,265,356,344,332],[1151,1255,1195,1173,1184,1186,1188,1187,1203,593,1038,891],[90,88,100,83,62,113,80,89],[308,303,238,300,151,304,324,293,346,302],[59,38,50,41,42,35,40],[352,366,174,355,344,265,343,310,338,331],[91,89,93,90,117,85,60,106],[146,186,166,175,202,92,184,183,189],[82,67,96,44,80,79,88,76],[54,50,58,66,31,61,64],[343,266,344,172,308,336,364,350,359,333],[88,49,87,82,90,98,86,115],[20,47,49,51,54,48,40],[159,79,177,158,157,152,155,167,118],[1219,1183,1182,1115,1035,1186,591,1197,1167,887,1184,1175],[611,518,693,343,704,667,686,682,677,687,725],[607,599,634,305,677,604,603,580,452,605,591],[682,686,635,675,692,730,687,342,517,658,695],[662,296,573,598,592,584,553,593,595,443,591],[180,185,186,199,187,210,93,177,149],[197,136,179,185,156,182,180,178,99],[271,298,218,279,285,282,280,238,140],[1187,1151,890,593,1194,1188,1184,1173,1038,1186,1255,1203],[169,161,177,192,130,165,84,167,168],[50,42,43,41,66,39,36],[590,669,604,579,448,599,560,299,601,597,598],[174,191,206,179,184,142,177,180,90],[298,299,297,306,164,285,374,269,329,295],[181,172,162,138,170,195,86,169,168],[1184,1197,591,1182,1186,889,1167,1219,1183,1033,1115,1175],[644,695,691,679,667,687,340,681,770,686,517],[606,524,592,576,628,593,591,584,296,444,595],[94,127,154,138,135,74,136,141],[179,168,172,178,177,89,198,186,137],[302,299,291,300,298,149,260,305,280,370],[678,517,670,686,682,768,687,648,342,692,702],[302,290,304,376,333,303,306,298,279,153],[95,102,109,54,96,75,85,97],[150,154,146,78,152,151,162,173,119],[150,143,157,152,184,112,154,151,132],[36,41,54,40,25,44,42],[37,48,34,59,39,41,40],[681,603,638,611,584,303,454,607,606,605,596]
];
```
## --seed-contents--
```js
function euler105() {
function testingSpecialSubsetSums(sets) {
return true;
}
euler105();
const testSets = [
[81,88,75,42,87,84,86,65],[157,150,164,119,79,159,161,139,158],[673,465,569,603,629,592,584,300,601,599,600],[90,85,83,84,65,87,76,46],[165,168,169,190,162,85,176,167,127],[224,275,278,249,277,279,289,295,139],[354,370,362,384,359,324,360,180,350,270],[599,595,557,298,448,596,577,667,597,588,602],[175,199,137,88,187,173,168,171,174],[93,187,196,144,185,178,186,202,182],[157,155,81,158,119,176,152,167,159],[184,165,159,166,163,167,174,124,83],[1211,1212,1287,605,1208,1189,1060,1216,1243,1200,908,1210],[339,299,153,305,282,304,313,306,302,228],[94,104,63,112,80,84,93,96],[41,88,82,85,61,74,83,81],[90,67,84,83,82,97,86,41],[299,303,151,301,291,302,307,377,333,280],[55,40,48,44,25,42,41],[1038,1188,1255,1184,594,890,1173,1151,1186,1203,1187,1195],[76,132,133,144,135,99,128,154],[77,46,108,81,85,84,93,83],[624,596,391,605,529,610,607,568,604,603,453],[83,167,166,189,163,174,160,165,133],[308,281,389,292,346,303,302,304,300,173],[593,1151,1187,1184,890,1040,1173,1186,1195,1255,1188,1203],[68,46,64,33,60,58,65],[65,43,88,87,86,99,93,90],[83,78,107,48,84,87,96,85],[1188,1173,1256,1038,1187,1151,890,1186,1184,1203,594,1195],[302,324,280,296,294,160,367,298,264,299],[521,760,682,687,646,664,342,698,692,686,672],[56,95,86,97,96,89,108,120],[344,356,262,343,340,382,337,175,361,330],[47,44,42,27,41,40,37],[139,155,161,158,118,166,154,156,78],[118,157,164,158,161,79,139,150,159],[299,292,371,150,300,301,281,303,306,262],[85,77,86,84,44,88,91,67],[88,85,84,44,65,91,76,86],[138,141,127,96,136,154,135,76],[292,308,302,346,300,324,304,305,238,166],[354,342,341,257,348,343,345,321,170,301],[84,178,168,167,131,170,193,166,162],[686,701,706,673,694,687,652,343,683,606,518],[295,293,301,367,296,279,297,263,323,159],[1038,1184,593,890,1188,1173,1187,1186,1195,1150,1203,1255],[343,364,388,402,191,383,382,385,288,374],[1187,1036,1183,591,1184,1175,888,1197,1182,1219,1115,1167],[151,291,307,303,345,238,299,323,301,302],[140,151,143,138,99,69,131,137],[29,44,42,59,41,36,40],[348,329,343,344,338,315,169,359,375,271],[48,39,34,37,50,40,41],[593,445,595,558,662,602,591,297,610,580,594],[686,651,681,342,541,687,691,707,604,675,699],[180,99,189,166,194,188,144,187,199],[321,349,335,343,377,176,265,356,344,332],[1151,1255,1195,1173,1184,1186,1188,1187,1203,593,1038,891],[90,88,100,83,62,113,80,89],[308,303,238,300,151,304,324,293,346,302],[59,38,50,41,42,35,40],[352,366,174,355,344,265,343,310,338,331],[91,89,93,90,117,85,60,106],[146,186,166,175,202,92,184,183,189],[82,67,96,44,80,79,88,76],[54,50,58,66,31,61,64],[343,266,344,172,308,336,364,350,359,333],[88,49,87,82,90,98,86,115],[20,47,49,51,54,48,40],[159,79,177,158,157,152,155,167,118],[1219,1183,1182,1115,1035,1186,591,1197,1167,887,1184,1175],[611,518,693,343,704,667,686,682,677,687,725],[607,599,634,305,677,604,603,580,452,605,591],[682,686,635,675,692,730,687,342,517,658,695],[662,296,573,598,592,584,553,593,595,443,591],[180,185,186,199,187,210,93,177,149],[197,136,179,185,156,182,180,178,99],[271,298,218,279,285,282,280,238,140],[1187,1151,890,593,1194,1188,1184,1173,1038,1186,1255,1203],[169,161,177,192,130,165,84,167,168],[50,42,43,41,66,39,36],[590,669,604,579,448,599,560,299,601,597,598],[174,191,206,179,184,142,177,180,90],[298,299,297,306,164,285,374,269,329,295],[181,172,162,138,170,195,86,169,168],[1184,1197,591,1182,1186,889,1167,1219,1183,1033,1115,1175],[644,695,691,679,667,687,340,681,770,686,517],[606,524,592,576,628,593,591,584,296,444,595],[94,127,154,138,135,74,136,141],[179,168,172,178,177,89,198,186,137],[302,299,291,300,298,149,260,305,280,370],[678,517,670,686,682,768,687,648,342,692,702],[302,290,304,376,333,303,306,298,279,153],[95,102,109,54,96,75,85,97],[150,154,146,78,152,151,162,173,119],[150,143,157,152,184,112,154,151,132],[36,41,54,40,25,44,42],[37,48,34,59,39,41,40],[681,603,638,611,584,303,454,607,606,605,596]
];
testingSpecialSubsetSums(testSets);
```
# --solutions--

View File

@ -8,11 +8,10 @@ dashedName: problem-106-special-subset-sums-meta-testing
# --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:
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).
1. $S(B) ≠ S(C)$; that is, sums of subsets cannot be equal.
2. 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.
@ -20,14 +19,14 @@ Surprisingly, out of the 25 possible subset pairs that can be obtained from a se
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.
**Note:** This problem is related to Problem 103 and Problem 105.
# --hints--
`euler106()` should return 21384.
`subsetSumsMetaTesting()` should return `21384`.
```js
assert.strictEqual(euler106(), 21384);
assert.strictEqual(subsetSumsMetaTesting(), 21384);
```
# --seed--
@ -35,12 +34,12 @@ assert.strictEqual(euler106(), 21384);
## --seed-contents--
```js
function euler106() {
function subsetSumsMetaTesting() {
return true;
}
euler106();
subsetSumsMetaTesting();
```
# --solutions--

View File

@ -10,19 +10,17 @@ dashedName: problem-108-diophantine-reciprocals-i
In the following equation x, y, and n are positive integers.
1/`x` + 1/`y` = 1/`n`
$$\frac{1}{x} + \frac{1}{y} = \frac{1}{n}$$
For `n` = 4 there are exactly three distinct solutions:
1/5 + 1/20 = 1/4
1/6 + 1/12 = 1/4
1/8 + 1/8 = 1/4
$$\begin{align} & \frac{1}{5} + \frac{1}{20} = \frac{1}{4}\\\\ \\\\ & \frac{1}{6} + \frac{1}{12} = \frac{1}{4}\\\\ \\\\ & \frac{1}{8} + \frac{1}{8} = \frac{1}{4} \end{align}$$
What is the least value of `n` for which the number of distinct solutions exceeds one-thousand?
# --hints--
`diophantineOne()` should return 180180.
`diophantineOne()` should return `180180`.
```js
assert.strictEqual(diophantineOne(), 180180);

View File

@ -10,28 +10,26 @@ dashedName: problem-109-darts
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:
<img class="img-responsive center-block" alt="Darts board" src="https://cdn.freecodecamp.org/curriculum/project-euler/darts.png" style="background-color: white; padding: 10px;" />
D3
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.
D1 D2
At the center 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.
S2 D2
There are many variations of rules but in the most popular game the players will begin with a score of 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 center 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".
D2 D1
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:
S4 D1
$$\begin{array} \text{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 \end{array}$$
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?
Note that D1 D2 is considered different from 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?
# --hints--
`euler109()` should return 38182.
`darts()` should return `38182`.
```js
assert.strictEqual(euler109(), 38182);
assert.strictEqual(darts(), 38182);
```
# --seed--
@ -39,12 +37,12 @@ assert.strictEqual(euler109(), 38182);
## --seed-contents--
```js
function euler109() {
function darts() {
return true;
}
euler109();
darts();
```
# --solutions--

View File

@ -10,15 +10,17 @@ dashedName: problem-110-diophantine-reciprocals-ii
In the following equation x, y, and n are positive integers.
1/`x` + 1/`y` = 1/`n`
$$\frac{1}{x} + \frac{1}{y} = \frac{1}{n}$$
It can be verified that when `n` = 1260 there are 113 distinct solutions and this is the least value of `n` for which the total number of distinct solutions exceeds one hundred.
What is the least value of `n` for which the number of distinct solutions exceeds four million?
**Note:** This problem is a much more difficult version of Problem 108 and as it is well beyond the limitations of a brute force approach it requires a clever implementation.
# --hints--
`diophantineTwo()` should return 9350130049860600.
`diophantineTwo()` should return `9350130049860600`.
```js
assert.strictEqual(diophantineTwo(), 9350130049860600);

View File

@ -10,24 +10,35 @@ dashedName: problem-111-primes-with-runs
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
$$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.
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.
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
| 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).
For d = 0 to 9, the sum of all $S(4, d)$ is 273700. Find the sum of all $S(10, d)$.
# --hints--
`euler111()` should return 612407567715.
`primesWithRuns()` should return `612407567715`.
```js
assert.strictEqual(euler111(), 612407567715);
assert.strictEqual(primesWithRuns(), 612407567715);
```
# --seed--
@ -35,12 +46,12 @@ assert.strictEqual(euler111(), 612407567715);
## --seed-contents--
```js
function euler111() {
function primesWithRuns() {
return true;
}
euler111();
primesWithRuns();
```
# --solutions--

View File

@ -22,10 +22,10 @@ Find the least number for which the proportion of bouncy numbers is exactly 99%.
# --hints--
`euler112()` should return 1587000.
`bouncyNumbers()` should return `1587000`.
```js
assert.strictEqual(euler112(), 1587000);
assert.strictEqual(bouncyNumbers(), 1587000);
```
# --seed--
@ -33,12 +33,12 @@ assert.strictEqual(euler112(), 1587000);
## --seed-contents--
```js
function euler112() {
function bouncyNumbers() {
return true;
}
euler112();
bouncyNumbers();
```
# --solutions--

View File

@ -14,16 +14,16 @@ Similarly if no digit is exceeded by the digit to its right it is called a decre
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.
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 ${10}^{10}$.
How many numbers below a googol (10100) are not bouncy?
How many numbers below a googol (${10}^{100}$) are not bouncy?
# --hints--
`euler113()` should return 51161058134250.
`nonBouncyNumbers()` should return `51161058134250`.
```js
assert.strictEqual(euler113(), 51161058134250);
assert.strictEqual(nonBouncyNumbers(), 51161058134250);
```
# --seed--
@ -31,12 +31,12 @@ assert.strictEqual(euler113(), 51161058134250);
## --seed-contents--
```js
function euler113() {
function nonBouncyNumbers() {
return true;
}
euler113();
nonBouncyNumbers();
```
# --solutions--

View File

@ -10,14 +10,18 @@ dashedName: problem-114-counting-block-combinations-i
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).
<img class="img-responsive center-block" alt="Possible ways of placing block with a minimum length of three units, on a row with length of seven units" src="https://cdn.freecodecamp.org/curriculum/project-euler/counting-block-combinations-i.png" style="background-color: white; padding: 10px;" />
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).
# --hints--
`euler114()` should return 16475640049.
`countingBlockOne()` should return `16475640049`.
```js
assert.strictEqual(euler114(), 16475640049);
assert.strictEqual(countingBlockOne(), 16475640049);
```
# --seed--
@ -25,12 +29,12 @@ assert.strictEqual(euler114(), 16475640049);
## --seed-contents--
```js
function euler114() {
function countingBlockOne() {
return true;
}
euler114();
countingBlockOne();
```
# --solutions--

View File

@ -8,26 +8,26 @@ dashedName: problem-115-counting-block-combinations-ii
# --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.
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.
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.
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.
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.
For m = 50, find the least value of `n` for which the fill-count function first exceeds one million.
**Note:** This is a more difficult version of Problem 114.
# --hints--
`euler115()` should return 168.
`countingBlockTwo()` should return `168`.
```js
assert.strictEqual(euler115(), 168);
assert.strictEqual(countingBlockTwo(), 168);
```
# --seed--
@ -35,12 +35,12 @@ assert.strictEqual(euler115(), 168);
## --seed-contents--
```js
function euler115() {
function countingBlockTwo() {
return true;
}
euler115();
countingBlockTwo();
```
# --solutions--

View File

@ -12,18 +12,26 @@ A row of five black square tiles is to have a number of its tiles replaced with
If red tiles are chosen there are exactly seven ways this can be done.
<img class="img-responsive center-block" alt="Possible ways to placing red oblong on a row with length of five units" src="https://cdn.freecodecamp.org/curriculum/project-euler/red-green-or-blue-tiles-1.png" style="background-color: white; padding: 10px;" />
If green tiles are chosen there are three ways.
<img class="img-responsive center-block" alt="Possible ways of placing green oblong on a row with length of five units" src="https://cdn.freecodecamp.org/curriculum/project-euler/red-green-or-blue-tiles-2.png" style="background-color: white; padding: 10px;" />
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.
<img class="img-responsive center-block" alt="Possible ways of placing blue oblong on a row with length of five units" src="https://cdn.freecodecamp.org/curriculum/project-euler/red-green-or-blue-tiles-3.png" style="background-color: white; padding: 10px;" />
Assuming that colors 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 colors cannot be mixed and at least one colored tile must be used?
**Note:** This is related to Problem 117.
# --hints--
`euler116()` should return 20492570929.
`redGreenBlueOne()` should return `20492570929`.
```js
assert.strictEqual(euler116(), 20492570929);
assert.strictEqual(redGreenBlueOne(), 20492570929);
```
# --seed--
@ -31,12 +39,12 @@ assert.strictEqual(euler116(), 20492570929);
## --seed-contents--
```js
function euler116() {
function redGreenBlueOne() {
return true;
}
euler116();
redGreenBlueOne();
```
# --solutions--

View File

@ -10,14 +10,18 @@ dashedName: problem-117-red-green-and-blue-tiles
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.
<img class="img-responsive center-block" alt="Possible ways of placing red, green and blue oblongs on a row with length of five units" src="https://cdn.freecodecamp.org/curriculum/project-euler/red-green-and-blue-tiles.png" style="background-color: white; padding: 10px;" />
How many ways can a row measuring fifty units in length be tiled?
**Note**: This is related to Problem 116.
# --hints--
`euler117()` should return 100808458960497.
`redGreenBlueTilesTwo()` should return `100808458960497`.
```js
assert.strictEqual(euler117(), 100808458960497);
assert.strictEqual(redGreenBlueTilesTwo(), 100808458960497);
```
# --seed--
@ -25,12 +29,12 @@ assert.strictEqual(euler117(), 100808458960497);
## --seed-contents--
```js
function euler117() {
function redGreenBlueTilesTwo() {
return true;
}
euler117();
redGreenBlueTilesTwo();
```
# --solutions--

View File

@ -8,16 +8,16 @@ dashedName: problem-118-pandigital-prime-sets
# --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.
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?
# --hints--
`euler118()` should return 44680.
`pandigitalPrimeSets()` should return `44680`.
```js
assert.strictEqual(euler118(), 44680);
assert.strictEqual(pandigitalPrimeSets(), 44680);
```
# --seed--
@ -25,12 +25,12 @@ assert.strictEqual(euler118(), 44680);
## --seed-contents--
```js
function euler118() {
function pandigitalPrimeSets() {
return true;
}
euler118();
pandigitalPrimeSets();
```
# --solutions--

View File

@ -8,20 +8,20 @@ dashedName: problem-119-digit-power-sum
# --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.
The number 512 is interesting because it is equal to the sum of its digits raised to some power: $5 + 1 + 2 = 8$, and $8^3 = 512$. Another example of a number with this property is $614656 = 28^4$.
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.
We shall define an to be the $n-th$ 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.
You are given that $a_2 = 512$ and $a_{10} = 614656$.
Find a30.
Find $a_{30}$.
# --hints--
`euler119()` should return 248155780267521.
`digitPowerSum()` should return `248155780267521`.
```js
assert.strictEqual(euler119(), 248155780267521);
assert.strictEqual(digitPowerSum(), 248155780267521);
```
# --seed--
@ -29,12 +29,12 @@ assert.strictEqual(euler119(), 248155780267521);
## --seed-contents--
```js
function euler119() {
function digitPowerSum() {
return true;
}
euler119();
digitPowerSum();
```
# --solutions--

View File

@ -8,18 +8,18 @@ dashedName: problem-120-square-remainders
# --description--
Let r be the remainder when (a1)n + (a+1)n is divided by a2.
Let `r` be the remainder when ${(a 1)}^n + {(a + 1)}^n$ is divided by $a^2$.
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 example, if $a = 7$ and $n = 3$, then $r = 42: 6^3 + 8^3 = 728 ≡ 42 \\ \text{mod}\\ 49$. And as `n` varies, so too will `r`, but for $a = 7$ it turns out that $r_{max} = 42$.
For 3 ≤ a ≤ 1000, find ∑ rmax.
For $3 ≤ a ≤ 1000$, find $\sum{r}_{max}$.
# --hints--
`euler120()` should return 333082500.
`squareRemainders()` should return `333082500`.
```js
assert.strictEqual(euler120(), 333082500);
assert.strictEqual(squareRemainders(), 333082500);
```
# --seed--
@ -27,12 +27,12 @@ assert.strictEqual(euler120(), 333082500);
## --seed-contents--
```js
function euler120() {
function squareRemainders() {
return true;
}
euler120();
squareRemainders();
```
# --solutions--

View File

@ -10,7 +10,7 @@ dashedName: problem-15-lattice-paths
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://cdn-media-1.freecodecamp.org/project-euler/1Atixoj.gif" style="background-color: white; padding: 10px;">
<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://cdn-media-1.freecodecamp.org/project-euler/1Atixoj.gif" style="background-color: white; padding: 10px;" />
How many such routes are there through a given `gridSize`?

View File

@ -1,8 +1,7 @@
---
id: 5900f4031000cf542c50ff15
title: >-
Problem 150: Searching a triangular array for a sub-triangle having
minimum-sum
Problem 150: Searching a triangular array for a sub-triangle having minimum-sum
challengeType: 5
forumTopicId: 301781
dashedName: problem-150-searching-a-triangular-array-for-a-sub-triangle-having-minimum-sum

View File

@ -1,8 +1,7 @@
---
id: 5900f40a1000cf542c50ff1d
title: >-
Problem 158: Exploring strings for which only one character comes
lexicographically after its neighbour to the left
Problem 158: Exploring strings for which only one character comes lexicographically after its neighbour to the left
challengeType: 5
forumTopicId: 301789
dashedName: >-

View File

@ -1,8 +1,7 @@
---
id: 5900f4111000cf542c50ff23
title: >-
Problem 164: Numbers for which no three consecutive digits have a sum greater
than a given value
Problem 164: Numbers for which no three consecutive digits have a sum greater than a given value
challengeType: 5
forumTopicId: 301798
dashedName: >-

View File

@ -1,8 +1,7 @@
---
id: 5900f4151000cf542c50ff28
title: >-
Problem 169: Exploring the number of different ways a number can be expressed
as a sum of powers of 2
Problem 169: Exploring the number of different ways a number can be expressed as a sum of powers of 2
challengeType: 5
forumTopicId: 301803
dashedName: >-

View File

@ -1,8 +1,7 @@
---
id: 5900f4161000cf542c50ff29
title: >-
Problem 170: Find the largest 0 to 9 pandigital that can be formed by
concatenating products
Problem 170: Find the largest 0 to 9 pandigital that can be formed by concatenating products
challengeType: 5
forumTopicId: 301805
dashedName: >-

View File

@ -1,8 +1,7 @@
---
id: 5900f4181000cf542c50ff2a
title: >-
Problem 171: Finding numbers for which the sum of the squares of the digits is
a square
Problem 171: Finding numbers for which the sum of the squares of the digits is a square
challengeType: 5
forumTopicId: 301806
dashedName: >-

View File

@ -1,8 +1,7 @@
---
id: 5900f41a1000cf542c50ff2c
title: >-
Problem 173: Using up to one million tiles how many different "hollow" square
laminae can be formed?
Problem 173: Using up to one million tiles how many different "hollow" square laminae can be formed?
challengeType: 5
forumTopicId: 301808
dashedName: >-

View File

@ -1,8 +1,7 @@
---
id: 5900f41a1000cf542c50ff2d
title: >-
Problem 174: Counting the number of "hollow" square laminae that can form one,
two, three, ... distinct arrangements
Problem 174: Counting the number of "hollow" square laminae that can form one, two, three, ... distinct arrangements
challengeType: 5
forumTopicId: 301809
dashedName: >-

View File

@ -1,8 +1,7 @@
---
id: 5900f41c1000cf542c50ff2e
title: >-
Problem 175: Fractions involving the number of different ways a number can be
expressed as a sum of powers of 2
Problem 175: Fractions involving the number of different ways a number can be expressed as a sum of powers of 2
challengeType: 5
forumTopicId: 301810
dashedName: >-

View File

@ -1,8 +1,7 @@
---
id: 5900f4231000cf542c50ff34
title: >-
Problem 181: Investigating in how many ways objects of two different colours
can be grouped
Problem 181: Investigating in how many ways objects of two different colours can be grouped
challengeType: 5
forumTopicId: 301817
dashedName: >-

View File

@ -10,26 +10,15 @@ dashedName: problem-182-rsa-encryption
The RSA encryption is based on the following procedure:
Generate two distinct primes `p` and `q`.
Compute `n=p*q` and `φ=(p-1)(q-1)`.
Find an integer `e`, `1 < e < φ`, such that `gcd(e,φ) = 1`
Generate two distinct primes `p` and `q`. Compute `n=p*q` 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=m<sup>e</sup> mod n is calculated.
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=m<sup>e</sup> 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=c<sup>d</sup> mod n.
There exist values of `e` and `m` such that m<sup>e</sup> mod n = m.
We call messages `m` for which m<sup>e</sup> mod n=m unconcealed messages.
There exist values of `e` and `m` such that m<sup>e</sup> mod n = m. We call messages `m` for which m<sup>e</sup> 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 messages
m `(0≤m≤n-1)` are unconcealed when calculating m<sup>e</sup> 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.
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 messages m `(0≤m≤n-1)` are unconcealed when calculating m<sup>e</sup> 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.
For any given `p` and `q`, find the sum of all values of `e`, `1 < e < φ(p,q)` and `gcd(e,φ)=1`, so that the number of unconcealed messages for this value of `e` is at a minimum.

View File

@ -10,7 +10,7 @@ dashedName: problem-199-iterative-circle-packing
Three circles of equal radius are placed inside a larger circle such that each pair of circles is tangent to one another and the inner circles do not overlap. There are four uncovered "gaps" which are to be filled iteratively with more tangent circles.
<img class="img-responsive center-block" alt="a diagram of non-overlapping concentric circles" src="https://cdn-media-1.freecodecamp.org/project-euler/199-circles-in-circles.gif" style="background-color: white; padding: 10px;">
<img class="img-responsive center-block" alt="a diagram of non-overlapping concentric circles" src="https://cdn-media-1.freecodecamp.org/project-euler/199-circles-in-circles.gif" style="background-color: white; padding: 10px;" />
At each iteration, a maximally sized circle is placed in each gap, which creates more gaps for the next iteration. After 3 iterations (pictured), there are 108 gaps and the fraction of the area which is not covered by circles is 0.06790342, rounded to eight decimal places.
@ -60,7 +60,7 @@ function iterativeCirclePacking(n) {
a1 += 3 * getArea(k0, k1, k1, n);
a1 += getArea(k1, k1, k1, n);
let final = ((a0 - a1) / a0).toFixed(8);
return parseFloat(final);
function getArea(k1, k2, k3, depth) {
if (depth == 0) return 0.0;

View File

@ -1,8 +1,7 @@
---
id: 5900f4351000cf542c50ff47
title: >-
Problem 200: Find the 200th prime-proof sqube containing the contiguous
sub-string "200"
Problem 200: Find the 200th prime-proof sqube containing the contiguous sub-string "200"
challengeType: 5
forumTopicId: 301840
dashedName: >-

View File

@ -1,8 +1,7 @@
---
id: 5900f4791000cf542c50ff8b
title: >-
Problem 268: Counting numbers with at least four distinct prime factors less
than 100
Problem 268: Counting numbers with at least four distinct prime factors less than 100
challengeType: 5
forumTopicId: 301917
dashedName: >-

View File

@ -1,8 +1,7 @@
---
id: 5900f4881000cf542c50ff9a
title: >-
Problem 283: Integer sided triangles for which the area * perimeter ratio is
integral
Problem 283: Integer sided triangles for which the area * perimeter ratio is integral
challengeType: 5
forumTopicId: 301934
dashedName: >-

View File

@ -16,7 +16,7 @@ The ant is always oriented in one of the cardinal directions (left, right, up or
\- if it is on a white square, it flips the color of the square to black, rotates 90 degrees clockwise and moves forward one square.
Starting with a grid that is entirely white, how many squares are black after 1018 moves of the ant?
Starting with a grid that is entirely white, how many squares are black after 10<sup>18</sup> moves of the ant?
# --hints--

View File

@ -14,7 +14,7 @@ There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73
How many circular primes are there below `n`, whereas 100 ≤ `n` ≤ 1000000?
**Note:**
**Note:**
Circular primes individual rotation can exceed `n`.

View File

@ -10,11 +10,7 @@ dashedName: problem-38-pandigital-multiples
Take the number 192 and multiply it by each of 1, 2, and 3:
$$\begin{align}
192 × 1 = 192\\\\
192 × 2 = 384\\\\
192 × 3 = 576\\\\
\end{align}$$
$$\begin{align} 192 × 1 = 192\\\\ 192 × 2 = 384\\\\ 192 × 3 = 576\\\\ \end{align}$$
By concatenating each product we get the 1 to 9 pandigital, 192384576. We will call 192384576 the concatenated product of 192 and (1, 2, 3).

View File

@ -20,7 +20,7 @@ The triplet (`a`, `b`, `c`) is called a *necklace triplet* if you can place `k`
<ul><li>C<sub><var>i</var></sub> has no common interior points with any C<sub><var>j</var></sub> for 1 ≤ <var>i</var>, <var>j</var><var>k</var> and <var>i</var><var>j</var>,</li><li>C<sub><var>i</var></sub> is tangent to both C<sub>in</sub> and C<sub>out</sub> for 1 ≤ <var>i</var><var>k</var>,</li><li>C<sub><var>i</var></sub> is tangent to C<sub><var>i</var>+1</sub> for 1 ≤ <var>i</var> &lt; <var>k</var>, and</li><li>C<sub><var>k</var></sub> is tangent to C<sub>1</sub>.</li></ul>
For example, (5, 5, 5) and (4, 3, 21) are necklace triplets, while it can be shown that (2, 2, 5) is not.
<img src="https://projecteuler.net/project/images/p428_necklace.png" alt="a visual representation of a necklace triplet">
<img src="https://projecteuler.net/project/images/p428_necklace.png" alt="a visual representation of a necklace triplet" />
Let T(`n`) be the number of necklace triplets (`a`, `b`, `c`) such that `a`, `b` and `c` are positive integers, and `b``n`. For example, T(1) = 9, T(20) = 732 and T(3000) = 438106.

View File

@ -56,7 +56,7 @@ assert.strictEqual(almostPi(200), 64658);
```js
function almostPi(n) {
return true;
}
```

View File

@ -12,20 +12,32 @@ By replacing the 1st digit of the 2-digit number \*3, it turns out that six of t
By replacing the 3rd and 4th digits of 56\*\*3 with the same digit, this 5-digit number is the first example having seven primes among the ten generated numbers, yielding the family: 56003, 56113, 56333, 56443, 56663, 56773, and 56993. Consequently 56003, being the first member of this family, is the smallest prime with this property.
Find the smallest prime which, by replacing part of the number (not necessarily adjacent digits) with the same digit, is part of an eight prime value family.
Find the smallest prime which, by replacing part of the number (not necessarily adjacent digits) with the same digit, is part of an `n` prime value family.
# --hints--
`primeDigitReplacements()` should return a number.
`primeDigitReplacements(6)` should return a number.
```js
assert(typeof primeDigitReplacements() === 'number');
assert(typeof primeDigitReplacements(6) === 'number');
```
`primeDigitReplacements()` should return 121313.
`primeDigitReplacements(6)` should return `13`.
```js
assert.strictEqual(primeDigitReplacements(), 121313);
assert.strictEqual(primeDigitReplacements(6), 13);
```
`primeDigitReplacements(7)` should return `56003`.
```js
assert.strictEqual(primeDigitReplacements(7), 56003);
```
`primeDigitReplacements(8)` should return `121313`.
```js
assert.strictEqual(primeDigitReplacements(8), 121313);
```
# --seed--
@ -33,16 +45,81 @@ assert.strictEqual(primeDigitReplacements(), 121313);
## --seed-contents--
```js
function primeDigitReplacements() {
function primeDigitReplacements(n) {
return true;
}
primeDigitReplacements();
primeDigitReplacements(6);
```
# --solutions--
```js
// solution required
function primeDigitReplacements(n) {
function isNFamily(number, primesMap, n) {
const prime = number.toString();
const lastDigit = prime[prime.length - 1];
return (
doesReplacingMakeFamily(prime, '0', primesMap, n) ||
(lastDigit !== '1' &&
doesReplacingMakeFamily(prime, '1', primesMap, n)) ||
doesReplacingMakeFamily(prime, '2', primesMap, n)
);
}
function doesReplacingMakeFamily(prime, digitToReplace, primesMap, family) {
let count = 0;
const replaceWith = '0123456789';
for (let i = 0; i < replaceWith.length; i++) {
const nextNumber = parseInt(
prime.replace(new RegExp(digitToReplace, 'g'), replaceWith[i]),
10
);
if (isPartOfFamily(nextNumber, prime, primesMap)) {
count++;
}
}
return count === family;
}
function isPartOfFamily(number, prime, primesMap) {
return (
isPrime(number, primesMap) && number.toString().length === prime.length
);
}
function getSievePrimes(max) {
const primesMap = new Array(max).fill(true);
primesMap[0] = false;
primesMap[1] = false;
for (let i = 2; i < max; i++) {
if (primesMap[i]) {
let j = i * i;
for (j; j < max; j += i) {
primesMap[j] = false;
}
}
}
return primesMap;
}
function isPrime(num, primesMap) {
return primesMap[num];
}
const primesMap = getSievePrimes(1000000);
for (let number = 1; number < 300000; number++) {
if (primesMap[number]) {
if (isNFamily(number, primesMap, n)) {
return number;
}
}
}
return -1;
}
```

View File

@ -29,11 +29,11 @@ If two players have the same ranked hands then the rank made up of the highest v
Consider the following five hands dealt to two players:
| Hand | Player 1 | Player 2 | Winner |
| ------------------ | --------------------------------------------------------- | ---------------------------------------------------------- | -------- |
| <strong>1</strong> | 5H 5C 6S 7S KD <br> Pair of Fives | 2C 3S 8S 8D TD <br> Pair of Eights | Player 2 |
| <strong>2</strong> | 5D 8C 9S JS AC <br> Highest card Ace | 2C 5C 7D 8S QH <br> Highest card Queen | Player 1 |
| <strong>3</strong> | 2D 9C AS AH AC <br> Three Aces | 3D 6D 7D TD QD <br> Flush with Diamonds | Player 2 |
| Hand | Player 1 | Player 2 | Winner |
| ------------------------- | --------------------------------------------------------------------- | ---------------------------------------------------------------------- | -------- |
| <strong>1</strong> | 5H 5C 6S 7S KD <br> Pair of Fives | 2C 3S 8S 8D TD <br> Pair of Eights | Player 2 |
| <strong>2</strong> | 5D 8C 9S JS AC <br> Highest card Ace | 2C 5C 7D 8S QH <br> Highest card Queen | Player 1 |
| <strong>3</strong> | 2D 9C AS AH AC <br> Three Aces | 3D 6D 7D TD QD <br> Flush with Diamonds | Player 2 |
| <strong>4</strong> | 4D 6S 9H QH QC <br> Pair of Queens <br> Highest card Nine | 3D 6D 7H QD QS <br> Pair of Queens <br> Highest card Seven | Player 1 |
| <strong>5</strong> | 2H 2D 4C 4D 4S <br> Full House <br> with Three Fours | 3C 3D 3S 9S 9D <br> Full House <br> with Three Threes | Player 1 |

View File

@ -10,14 +10,14 @@ dashedName: problem-61-cyclical-figurate-numbers
Triangle, square, pentagonal, hexagonal, heptagonal, and octagonal numbers are all figurate (polygonal) numbers and are generated by the following formulae:
| Type of Number | Formula | Sequence |
| -------------- | ---------------------------- | --------------------- |
| Type of Number | Formula | Sequence |
| -------------- | ----------------------------- | --------------------- |
| Triangle | $P_3(n) = \frac{n(n+1)}{2}$ | 1, 3, 6, 10, 15, ... |
| Square | $P_4(n) = n^2$ | 1, 4, 9, 16, 25, ... |
| Square | $P_4(n) = n^2$ | 1, 4, 9, 16, 25, ... |
| Pentagonal | $P_5(n) = \frac{n(3n1)}2$ | 1, 5, 12, 22, 35, ... |
| Hexagonal | $P_6(n) = n(2n1)$ | 1, 6, 15, 28, 45, ... |
| Hexagonal | $P_6(n) = n(2n1)$ | 1, 6, 15, 28, 45, ... |
| Heptagonal | $P_7(n) = \frac{n(5n3)}{2}$ | 1, 7, 18, 34, 55, ... |
| Octagonal | $P_8(n) = n(3n2)$ | 1, 8, 21, 40, 65, ... |
| Octagonal | $P_8(n) = n(3n2)$ | 1, 8, 21, 40, 65, ... |
The ordered set of three 4-digit numbers: 8128, 2882, 8281, has three interesting properties.

View File

@ -10,7 +10,7 @@ dashedName: problem-68-magic-5-gon-ring
Consider the following "magic" 3-gon ring, filled with the numbers 1 to 6, and each line adding to nine.
<img class="img-responsive center-block" alt="a completed example of a 3-gon ring" src="https://cdn-media-1.freecodecamp.org/project-euler/3-gon-ring.png" style="background-color: white; padding: 10px;">
<img class="img-responsive center-block" alt="a completed example of a 3-gon ring" src="https://cdn-media-1.freecodecamp.org/project-euler/3-gon-ring.png" style="background-color: white; padding: 10px;" />
Working **clockwise**, and starting from the group of three with the numerically lowest external node (4,3,2 in this example), each solution can be described uniquely. For example, the above solution can be described by the set: 4,3,2; 6,2,1; 5,1,3.
@ -18,7 +18,7 @@ It is possible to complete the ring with four different totals: 9, 10, 11, and 1
<div style='text-align: center;'>
| <div style='width: 100px;'>Total</div> | <div style='width: 250px;'>Solution Set</div> |
| !!crwdBlockTags_6_sgaTkcolBdwrc!! |!!crwdBlockTags_7_sgaTkcolBdwrc!! |
| -------------------------------------- | --------------------------------------------- |
| 9 | 4,2,3; 5,3,1; 6,1,2 |
| 9 | 4,3,2; 6,2,1; 5,1,3 |
@ -35,7 +35,7 @@ By concatenating each group it is possible to form 9-digit strings; the maximum
Using the numbers 1 to 10, and depending on arrangements, it is possible to form 16- and 17-digit strings. What is the maximum **16-digit** string for a "magic" 5-gon ring?
<img class="img-responsive center-block" alt="a blank diagram of a 5-gon ring" src="https://cdn-media-1.freecodecamp.org/project-euler/5-gon-ring.png" style="background-color: white; padding: 10px;">
<img class="img-responsive center-block" alt="a blank diagram of a 5-gon ring" src="https://cdn-media-1.freecodecamp.org/project-euler/5-gon-ring.png" style="background-color: white; padding: 10px;" />
# --hints--

View File

@ -14,19 +14,11 @@ $$1! + 4! + 5! = 1 + 24 + 120 = 145$$
Perhaps less well known is 169, in that it produces the longest chain of numbers that link back to 169; it turns out that there are only three such loops that exist:
$$\begin{align}
&169 → 363601 → 1454 → 169\\\\
&871 → 45361 → 871\\\\
&872 → 45362 → 872\\\\
\end{align}$$
$$\begin{align} &169 → 363601 → 1454 → 169\\\\ &871 → 45361 → 871\\\\ &872 → 45362 → 872\\\\ \end{align}$$
It is not difficult to prove that EVERY starting number will eventually get stuck in a loop. For example,
$$\begin{align}
&69 → 363600 → 1454 → 169 → 363601\\ (→ 1454)\\\\
&78 → 45360 → 871 → 45361\\ (→ 871)\\\\
&540 → 145\\ (→ 145)\\\\
\end{align}$$
$$\begin{align} &69 → 363600 → 1454 → 169 → 363601\\ (→ 1454)\\\\ &78 → 45360 → 871 → 45361\\ (→ 871)\\\\ &540 → 145\\ (→ 145)\\\\ \end{align}$$
Starting with 69 produces a chain of five non-repeating terms, but the longest non-repeating chain with a starting number below one million is sixty terms.

View File

@ -10,13 +10,7 @@ dashedName: problem-81-path-sum-two-ways
In the 5 by 5 matrix below, the minimal path sum from the top left to the bottom right, by **only moving to the right and down**, is indicated in bold red and is equal to `2427`.
$$\begin{pmatrix}
\color{red}{131} & 673 & 234 & 103 & 18\\\\
\color{red}{201} & \color{red}{96} & \color{red}{342} & 965 & 150\\\\
630 & 803 & \color{red}{746} & \color{red}{422} & 111\\\\
537 & 699 & 497 & \color{red}{121} & 956\\\\
805 & 732 & 524 & \color{red}{37} & \color{red}{331}
\end{pmatrix}$$
$$\begin{pmatrix} \color{red}{131} & 673 & 234 & 103 & 18\\\\ \color{red}{201} & \color{red}{96} & \color{red}{342} & 965 & 150\\\\ 630 & 803 & \color{red}{746} & \color{red}{422} & 111\\\\ 537 & 699 & 497 & \color{red}{121} & 956\\\\ 805 & 732 & 524 & \color{red}{37} & \color{red}{331} \end{pmatrix}$$
Find the minimal path sum from the top left to the bottom right by only moving right and down in `matrix`, a 2D array representing a matrix. The maximum matrix size used in the tests will be 80 by 80.

View File

@ -12,13 +12,7 @@ dashedName: problem-82-path-sum-three-ways
The minimal path sum in the 5 by 5 matrix below, by starting in any cell in the left column and finishing in any cell in the right column, and only moving up, down, and right, is indicated in red and bold; the sum is equal to `994`.
$$\begin{pmatrix}
131 & 673 & \color{red}{234} & \color{red}{103} & \color{red}{18}\\\\
\color{red}{201} & \color{red}{96} & \color{red}{342} & 965 & 150\\\\
630 & 803 & 746 & 422 & 111\\\\
537 & 699 & 497 & 121 & 956\\\\
805 & 732 & 524 & 37 & 331
\end{pmatrix}$$
$$\begin{pmatrix} 131 & 673 & \color{red}{234} & \color{red}{103} & \color{red}{18}\\\\ \color{red}{201} & \color{red}{96} & \color{red}{342} & 965 & 150\\\\ 630 & 803 & 746 & 422 & 111\\\\ 537 & 699 & 497 & 121 & 956\\\\ 805 & 732 & 524 & 37 & 331 \end{pmatrix}$$
Find the minimal path sum from the left column to the right column in `matrix`, a 2D array representing a matrix. The maximum matrix size used in tests will be 80 by 80.

View File

@ -12,13 +12,7 @@ dashedName: problem-83-path-sum-four-ways
In the 5 by 5 matrix below, the minimal path sum from the top left to the bottom right, by moving left, right, up, and down, is indicated in bold red and is equal to `2297`.
$$\begin{pmatrix}
\color{red}{131} & 673 & \color{red}{234} & \color{red}{103} & \color{red}{18}\\\\
\color{red}{201} & \color{red}{96} & \color{red}{342} & 965 & \color{red}{150}\\\\
630 & 803 & 746 & \color{red}{422} & \color{red}{111}\\\\
537 & 699 & 497 & \color{red}{121} & 956\\\\
805 & 732 & 524 & \color{red}{37} & \color{red}{331}
\end{pmatrix}$$
$$\begin{pmatrix} \color{red}{131} & 673 & \color{red}{234} & \color{red}{103} & \color{red}{18}\\\\ \color{red}{201} & \color{red}{96} & \color{red}{342} & 965 & \color{red}{150}\\\\ 630 & 803 & 746 & \color{red}{422} & \color{red}{111}\\\\ 537 & 699 & 497 & \color{red}{121} & 956\\\\ 805 & 732 & 524 & \color{red}{37} & \color{red}{331} \end{pmatrix}$$
Find the minimal path sum from the top left to the bottom right by moving left, right, up, and down in `matrix`, a 2D array representing a matrix. The maximum matrix size used in tests will be 80 by 80.

View File

@ -10,7 +10,7 @@ dashedName: problem-85-counting-rectangles
By counting carefully it can be seen that a rectangular grid measuring 3 by 2 contains eighteen rectangles:
<img class="img-responsive center-block" alt="a diagram of the different rectangles found within a 3 by 2 rectangular grid" src="https://cdn-media-1.freecodecamp.org/project-euler/counting-rectangles.png" style="background-color: white; padding: 10px;">
<img class="img-responsive center-block" alt="a diagram of the different rectangles found within a 3 by 2 rectangular grid" src="https://cdn-media-1.freecodecamp.org/project-euler/counting-rectangles.png" style="background-color: white; padding: 10px;" />
Although there may not exists a rectangular grid that contains exactly `n` rectangles, find the area of the grid with the nearest solution.

View File

@ -10,7 +10,7 @@ dashedName: problem-86-cuboid-route
A spider, S, sits in one corner of a cuboid room, measuring 6 by 5 by 3, and a fly, F, sits in the opposite corner. By travelling on the surfaces of the room the shortest "straight line" distance from S to F is 10 and the path is shown on the diagram.
<img class="img-responsive center-block" alt="a diagram of a spider and fly's path from one corner of a cuboid room to the opposite corner" src="https://cdn-media-1.freecodecamp.org/project-euler/cuboid-route.png" style="background-color: white; padding: 10px;">
<img class="img-responsive center-block" alt="a diagram of a spider and fly's path from one corner of a cuboid room to the opposite corner" src="https://cdn-media-1.freecodecamp.org/project-euler/cuboid-route.png" style="background-color: white; padding: 10px;" />
However, there are up to three "shortest" path candidates for any given cuboid and the shortest route doesn't always have integer length.

View File

@ -12,7 +12,7 @@ Each of the six faces on a cube has a different digit (0 to 9) written on it; th
For example, the square number 64 could be formed:
<img class="img-responsive center-block" alt="two cubes, one with the number 6 and the other with number 4" src="https://cdn-media-1.freecodecamp.org/project-euler/cube-digit-pairs.png" style="background-color: white; padding: 10px;">
<img class="img-responsive center-block" alt="two cubes, one with the number 6 and the other with number 4" src="https://cdn-media-1.freecodecamp.org/project-euler/cube-digit-pairs.png" style="background-color: white; padding: 10px;" />
In fact, by carefully choosing the digits on both cubes it is possible to display all of the square numbers below one-hundred: 01, 04, 09, 16, 25, 36, 49, 64, and 81.

View File

@ -10,11 +10,11 @@ dashedName: problem-91-right-triangles-with-integer-coordinates
The points ${P}(x_1, y_1)$ and ${Q}(x_2, y_2)$ are plotted at integer co-ordinates and are joined to the origin, ${O}(0, 0)$, to form ${\Delta}OPQ$.
<img class="img-responsive center-block" alt="a graph plotting points P (x_1, y_1) and Q(x_2, y_2) at integer coordinates that are joined to the origin O (0, 0)" src="https://cdn-media-1.freecodecamp.org/project-euler/right-triangles-integer-coordinates-1.png" style="background-color: white; padding: 10px;">
<img class="img-responsive center-block" alt="a graph plotting points P (x_1, y_1) and Q(x_2, y_2) at integer coordinates that are joined to the origin O (0, 0)" src="https://cdn-media-1.freecodecamp.org/project-euler/right-triangles-integer-coordinates-1.png" style="background-color: white; padding: 10px;" />
There are exactly fourteen triangles containing a right angle that can be formed when each co-ordinate lies between 0 and 2 inclusive; that is, $0 ≤ x_1, y_1, x_2, y_2 ≤ 2$.
<img class="img-responsive center-block" alt="a diagram showing the 14 triangles containing a right angle that can be formed when each coordinate is between 0 and 2" src="https://cdn-media-1.freecodecamp.org/project-euler/right-triangles-integer-coordinates-2.png" style="background-color: white; padding: 10px;">
<img class="img-responsive center-block" alt="a diagram showing the 14 triangles containing a right angle that can be formed when each coordinate is between 0 and 2" src="https://cdn-media-1.freecodecamp.org/project-euler/right-triangles-integer-coordinates-2.png" style="background-color: white; padding: 10px;" />
Given that $0 ≤ x_1, y_1, x_2, y_2 ≤ limit$, how many right triangles can be formed?

View File

@ -12,10 +12,7 @@ A number chain is created by continuously adding the square of the digits in a n
For example,
$$\begin{align}
& 44 → 32 → 13 → 10 → \boldsymbol{1} → \boldsymbol{1}\\\\
& 85 → \boldsymbol{89} → 145 → 42 → 20 → 4 → 16 → 37 → 58 → \boldsymbol{89}\\\\
\end{align}$$
$$\begin{align} & 44 → 32 → 13 → 10 → \boldsymbol{1} → \boldsymbol{1}\\\\ & 85 → \boldsymbol{89} → 145 → 42 → 20 → 4 → 16 → 37 → 58 → \boldsymbol{89}\\\\ \end{align}$$
Therefore any chain that arrives at 1 or 89 will become stuck in an endless loop. What is most amazing is that EVERY starting number will eventually arrive at 1 or 89.

View File

@ -14,9 +14,7 @@ Interestingly the sum of the proper divisors of 220 is 284 and the sum of the pr
Perhaps less well known are longer chains. For example, starting with 12496, we form a chain of five numbers:
$$
12496 → 14288 → 15472 → 14536 → 14264 \\,(→ 12496 → \cdots)
$$
$$ 12496 → 14288 → 15472 → 14536 → 14264 \\,(→ 12496 → \cdots) $$
Since this chain returns to its starting point, it is called an amicable chain.