fix(curriculum): clean-up Project Euler 181-200 (#42819)

* fix: clean-up Project Euler 181-200

* fix: corrections from review

Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>

* fix: missing delimiter

Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>
This commit is contained in:
gikf
2021-07-15 15:52:14 +02:00
committed by GitHub
parent a9418a1fe9
commit 5a52c229f5
19 changed files with 204 additions and 144 deletions

View File

@ -11,20 +11,18 @@ dashedName: >-
# --description--
Having three black objects B and one white object W they can be grouped in 7 ways like this:
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)
$$(BBBW)\\;(B,BBW)\\;(B,B,BW)\\;(B,B,B,W)\\;(B,BB,W)\\;(BBB,W)\\;(BB,BW)$$
(B,BB,W)(BBB,W)(BB,BW)
In how many ways can sixty black objects B and forty white objects W be thus grouped?
In how many ways can sixty black objects $B$ and forty white objects $W$ be thus grouped?
# --hints--
`euler181()` should return 83735848679360670.
`colorsGrouping()` should return `83735848679360670`.
```js
assert.strictEqual(euler181(), 83735848679360670);
assert.strictEqual(colorsGrouping(), 83735848679360670);
```
# --seed--
@ -32,12 +30,12 @@ assert.strictEqual(euler181(), 83735848679360670);
## --seed-contents--
```js
function euler181() {
function colorsGrouping() {
return true;
}
euler181();
colorsGrouping();
```
# --solutions--

View File

@ -8,30 +8,30 @@ dashedName: problem-183-maximum-product-of-parts
# --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 $N$ be a positive integer and let $N$ be split into $k$ equal parts, $r = \frac{N}{k}$, so that $N = r + r + \cdots + r$.
Let P be the product of these parts, P = r × r × ... × r = rk.
Let $P$ be the product of these parts, $P = r × r × \cdots × r = r^k$.
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.
For example, if 11 is split into five equal parts, 11 = 2.2 + 2.2 + 2.2 + 2.2 + 2.2, then $P = {2.2}^5 = 51.53632$.
Let M(N) = Pmax for a given value of N.
Let $M(N) = P_{max}$ 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.
It turns out that the maximum for $N = 11$ is found by splitting eleven into four equal parts which leads to $P_{max} = {(\frac{11}{4})}^4$; that is, $M(11) = \frac{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.
However, for $N = 8$ the maximum is achieved by splitting it into three equal parts, so $M(8) = \frac{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.
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.
For example, $\sum D(N)$ for $5 ≤ N ≤ 100$ is 2438.
Find ΣD(N) for 5 ≤ N ≤ 10000.
Find $\sum D(N)$ for $5 ≤ N ≤ 10000$.
# --hints--
`euler183()` should return 48861552.
`maximumProductOfParts()` should return `48861552`.
```js
assert.strictEqual(euler183(), 48861552);
assert.strictEqual(maximumProductOfParts(), 48861552);
```
# --seed--
@ -39,12 +39,12 @@ assert.strictEqual(euler183(), 48861552);
## --seed-contents--
```js
function euler183() {
function maximumProductOfParts() {
return true;
}
euler183();
maximumProductOfParts();
```
# --solutions--

View File

@ -8,20 +8,22 @@ dashedName: problem-184-triangles-containing-the-origin
# --description--
Consider the set Ir of points (x,y) with integer coordinates in the interior of the circle with radius r, centered at the origin, i.e. x2 + y2 &lt; r2.
Consider the set $I_r$ of points $(x,y)$ with integer coordinates in the interior of the circle with radius $r$, centered at the origin, i.e. $x^2 + y^2 &lt; r^2$.
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 2, $I_2$ 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 $I_2$ 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.
<img class="img-responsive center-block" alt="circle with radius 2, centered at the origin, with nine marked points and two triangles - (-1,0), (0,1), (1,-1) and (-1,1), (0,-1), (1,1)" src="https://cdn.freecodecamp.org/curriculum/project-euler/triangles-containing-the-origin.gif" style="background-color: white; padding: 10px;">
How many triangles are there containing the origin in the interior and having all three vertices in I105?
For a radius of 3, there are 360 triangles containing the origin in the interior and having all vertices in $I_3$ and for $I_5$ the number is 10600.
How many triangles are there containing the origin in the interior and having all three vertices in $I_{105}$?
# --hints--
`euler184()` should return 1725323624056.
`trianglesConttainingOrigin()` should return `1725323624056`.
```js
assert.strictEqual(euler184(), 1725323624056);
assert.strictEqual(trianglesConttainingOrigin(), 1725323624056);
```
# --seed--
@ -29,12 +31,12 @@ assert.strictEqual(euler184(), 1725323624056);
## --seed-contents--
```js
function euler184() {
function trianglesContainingOrigin() {
return true;
}
euler184();
trianglesContainingOrigin();
```
# --solutions--

View File

@ -12,20 +12,54 @@ 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.
For instance, given the following guesses for a 5-digit secret sequence,
$$\begin{align}
& 90342 ;2\\;\text{correct}\\\\
& 70794 ;0\\;\text{correct}\\\\
& 39458 ;2\\;\text{correct}\\\\
& 34109 ;1\\;\text{correct}\\\\
& 51545 ;2\\;\text{correct}\\\\
& 12531 ;1\\;\text{correct}
\end{align}$$
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
$$\begin{align}
& 5616185650518293 ;2\\;\text{correct}\\\\
& 3847439647293047 ;1\\;\text{correct}\\\\
& 5855462940810587 ;3\\;\text{correct}\\\\
& 9742855507068353 ;3\\;\text{correct}\\\\
& 4296849643607543 ;3\\;\text{correct}\\\\
& 3174248439465858 ;1\\;\text{correct}\\\\
& 4513559094146117 ;2\\;\text{correct}\\\\
& 7890971548908067 ;3\\;\text{correct}\\\\
& 8157356344118483 ;1\\;\text{correct}\\\\
& 2615250744386899 ;2\\;\text{correct}\\\\
& 8690095851526254 ;3\\;\text{correct}\\\\
& 6375711915077050 ;1\\;\text{correct}\\\\
& 6913859173121360 ;1\\;\text{correct}\\\\
& 6442889055042768 ;2\\;\text{correct}\\\\
& 2321386104303845 ;0\\;\text{correct}\\\\
& 2326509471271448 ;2\\;\text{correct}\\\\
& 5251583379644322 ;2\\;\text{correct}\\\\
& 1748270476758276 ;3\\;\text{correct}\\\\
& 4895722652190306 ;1\\;\text{correct}\\\\
& 3041631117224635 ;3\\;\text{correct}\\\\
& 1841236454324589 ;3\\;\text{correct}\\\\
& 2659862637316867 ;2\\;\text{correct}
\end{align}$$
Find the unique 16-digit secret sequence.
# --hints--
`euler185()` should return 4640261571849533.
`numberMind()` should return `4640261571849533`.
```js
assert.strictEqual(euler185(), 4640261571849533);
assert.strictEqual(numberMind(), 4640261571849533);
```
# --seed--
@ -33,12 +67,12 @@ assert.strictEqual(euler185(), 4640261571849533);
## --seed-contents--
```js
function euler185() {
function numberMind() {
return true;
}
euler185();
numberMind();
```
# --solutions--

View File

@ -10,22 +10,31 @@ dashedName: problem-186-connectedness-of-a-network
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":
| RecNr | Caller | Called |
|-------|--------|--------|
| 1 | 200007 | 100053 |
| 2 | 600183 | 500439 |
| 3 | 600863 | 701497 |
| ... | ... | ... |
For 1 ≤ k ≤ 55, Sk = \[100003 - 200003k + 300007k3] (modulo 1000000) For 56 ≤ k, Sk = \[Sk-24 + Sk-55] (modulo 1000000)
The telephone number of the caller and the called number in record $n$ are $Caller(n) = S_{2n - 1}$ and $Called(n) = S_{2n}$ where ${S}_{1,2,3,\ldots}$ come from the "Lagged Fibonacci Generator":
If Caller(n) = Called(n) then the user is assumed to have misdialled and the call fails; otherwise the call is successful.
For $1 ≤ k ≤ 55$, $S_k = [100003 - 200003k + 300007{k}^3]\\;(\text{modulo}\\;1000000)$
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.
For $56 ≤ k$, $S_k = [S_{k - 24} + S_{k - 55}]\\;(\text{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?
# --hints--
`euler186()` should return 2325629.
`connectednessOfANetwork()` should return `2325629`.
```js
assert.strictEqual(euler186(), 2325629);
assert.strictEqual(connectednessOfANetwork(), 2325629);
```
# --seed--
@ -33,12 +42,12 @@ assert.strictEqual(euler186(), 2325629);
## --seed-contents--
```js
function euler186() {
function connectednessOfANetwork() {
return true;
}
euler186();
connectednessOfANetwork();
```
# --solutions--

View File

@ -8,15 +8,15 @@ dashedName: problem-187-semiprimes
# --description--
A composite is a number containing at least two prime factors. For example, 15 = 3 × 5; 9 = 3 × 3; 12 = 2 × 2 × 3.
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 &lt; 108, have precisely two, not necessarily distinct, prime factors?
How many composite integers, $n &lt; {10}^8$, have precisely two, not necessarily distinct, prime factors?
# --hints--
`euler187()` should return 17427258.
`semiPrimes()` should return `17427258`.
```js
assert.strictEqual(euler187(), 17427258);
@ -27,12 +27,12 @@ assert.strictEqual(euler187(), 17427258);
## --seed-contents--
```js
function euler187() {
function semiPrimes() {
return true;
}
euler187();
semiPrimes();
```
# --solutions--

View File

@ -8,20 +8,20 @@ dashedName: problem-188-the-hyperexponentiation-of-a-number
# --description--
The hyperexponentiation or tetration of a number a by a positive integer b, denoted by a↑↑b or ba, is recursively defined by:
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↑↑1 = a$,
a↑↑(k+1) = a(a↑↑k).
$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.
Thus we have e.g. $3↑↑2 = 3^3 = 27$, hence $3↑↑3 = 3^{27} = 7625597484987$ and $3↑↑4$ is roughly ${10}^{3.6383346400240996 \times {10}^{12}}$. Find the last 8 digits of $1777↑↑1855$.
# --hints--
`euler188()` should return 95962097.
`hyperexponentation()` should return `95962097`.
```js
assert.strictEqual(euler188(), 95962097);
assert.strictEqual(hyperexponentation(), 95962097);
```
# --seed--
@ -29,12 +29,12 @@ assert.strictEqual(euler188(), 95962097);
## --seed-contents--
```js
function euler188() {
function hyperexponentation() {
return true;
}
euler188();
hyperexponentation();
```
# --solutions--

View File

@ -10,20 +10,24 @@ dashedName: problem-189-tri-colouring-a-triangular-grid
Consider the following configuration of 64 triangles:
<img class="img-responsive center-block" alt="64 triangles arranged to create larger triangle with side length of 8 triangles" src="https://cdn.freecodecamp.org/curriculum/project-euler/tri-colouring-a-triangular-grid-1.gif" style="background-color: white; padding: 10px;">
We wish to colour the interior of each triangle with one of three colours: red, green or blue, so that no two neighbouring triangles have the same colour. Such a colouring shall be called valid. Here, two triangles are said to be neighbouring if they share an edge. Note: if they only share a vertex, then they are not neighbours.
For example, here is a valid colouring of the above grid:
<img class="img-responsive center-block" alt="colored grid of 64 triangles" src="https://cdn.freecodecamp.org/curriculum/project-euler/tri-colouring-a-triangular-grid-2.gif" style="background-color: white; padding: 10px;">
A colouring C' which is obtained from a colouring C by rotation or reflection is considered distinct from C unless the two are identical.
How many distinct valid colourings are there for the above configuration?
# --hints--
`euler189()` should return 10834893628237824.
`triangularGridColoring()` should return `10834893628237824`.
```js
assert.strictEqual(euler189(), 10834893628237824);
assert.strictEqual(triangularGridColoring(), 10834893628237824);
```
# --seed--
@ -31,12 +35,12 @@ assert.strictEqual(euler189(), 10834893628237824);
## --seed-contents--
```js
function euler189() {
function triangularGridColoring() {
return true;
}
euler189();
triangularGridColoring();
```
# --solutions--

View File

@ -8,18 +8,18 @@ dashedName: problem-190-maximising-a-weighted-product
# --description--
Let Sm = (x1, x2, ... , xm) be the m-tuple of positive real numbers with x1 + x2 + ... + xm = m for which Pm = x1 \* x22 \* ... \* xmm is maximised.
Let $S_m = (x_1, x_2, \ldots, x_m)$ be the $m$-tuple of positive real numbers with $x_1 + x_2 + \cdots + x_m = m$ for which $P_m = x_1 \times {x_2}^2 \times \cdots \times {x_m}^m$ is maximised.
For example, it can be verified that \[P10] = 4112 (\[ ] is the integer part function).
For example, it can be verified that $[P_{10}] = 4112$ ([ ] is the integer part function).
Find Σ\[Pm] for 2 ≤ m ≤ 15.
Find $\sum {[P_m]}$ for $2 ≤ m ≤ 15$.
# --hints--
`euler190()` should return 371048281.
`maximisingWeightedProduct()` should return `371048281`.
```js
assert.strictEqual(euler190(), 371048281);
assert.strictEqual(maximisingWeightedProduct(), 371048281);
```
# --seed--
@ -27,12 +27,12 @@ assert.strictEqual(euler190(), 371048281);
## --seed-contents--
```js
function euler190() {
function maximisingWeightedProduct() {
return true;
}
euler190();
maximisingWeightedProduct();
```
# --solutions--

View File

@ -14,16 +14,22 @@ During an n-day period a trinary string is formed for each child consisting of L
Although there are eighty-one trinary strings for a 4-day period that can be formed, exactly forty-three strings would lead to a prize:
OOOO OOOA OOOL OOAO OOAA OOAL OOLO OOLA OAOO OAOA OAOL OAAO OAAL OALO OALA OLOO OLOA OLAO OLAA AOOO AOOA AOOL AOAO AOAA AOAL AOLO AOLA AAOO AAOA AAOL AALO AALA ALOO ALOA ALAO ALAA LOOO LOOA LOAO LOAA LAOO LAOA LAAO
```
OOOO OOOA OOOL OOAO OOAA OOAL OOLO OOLA OAOO OAOA
OAOL OAAO OAAL OALO OALA OLOO OLOA OLAO OLAA AOOO
AOOA AOOL AOAO AOAA AOAL AOLO AOLA AAOO AAOA AAOL
AALO AALA ALOO ALOA ALAO ALAA LOOO LOOA LOAO LOAA
LAOO LAOA LAAO
```
How many "prize" strings exist over a 30-day period?
# --hints--
`euler191()` should return 1918080160.
`prizeStrings()` should return `1918080160`.
```js
assert.strictEqual(euler191(), 1918080160);
assert.strictEqual(prizeStrings(), 1918080160);
```
# --seed--
@ -31,12 +37,12 @@ assert.strictEqual(euler191(), 1918080160);
## --seed-contents--
```js
function euler191() {
function prizeStrings() {
return true;
}
euler191();
prizeStrings();
```
# --solutions--

View File

@ -8,22 +8,22 @@ dashedName: problem-192-best-approximations
# --description--
Let x be a real number.
Let $x$ be a real number.
A best approximation to x for the denominator bound d is a rational number r/s in reduced form, with s ≤ d, such that any rational number which is closer to x than r/s has a denominator larger than d:
A best approximation to $x$ for the denominator bound $d$ is a rational number $\frac{r}{s}$ in reduced form, with $s ≤ d$, such that any rational number which is closer to $x$ than $\frac{r}{s}$ has a denominator larger than $d$:
|p/q-x| &lt; |r/s-x| ⇒ q > d
$$|\frac{p}{q} - x| &lt; |\frac{r}{s} - x| ⇒ q > d$$
For example, the best approximation to √13 for the denominator bound 20 is 18/5 and the best approximation to √13 for the denominator bound 30 is 101/28.
For example, the best approximation to $\sqrt{13}$ for the denominator bound $20$ is $\frac{18}{5}$ and the best approximation to $\sqrt{13}$ for the denominator bound $30$ is $\frac{101}{28}$.
Find the sum of all denominators of the best approximations to √n for the denominator bound 1012, where n is not a perfect square and 1 &lt; n ≤ 100000.
Find the sum of all denominators of the best approximations to $\sqrt{n}$ for the denominator bound ${10}^{12}$, where $n$ is not a perfect square and $1 &lt; n ≤ 100000$.
# --hints--
`euler192()` should return 57060635927998344.
`bestApproximations()` should return `57060635927998344`.
```js
assert.strictEqual(euler192(), 57060635927998344);
assert.strictEqual(bestApproximations(), 57060635927998344);
```
# --seed--
@ -31,12 +31,12 @@ assert.strictEqual(euler192(), 57060635927998344);
## --seed-contents--
```js
function euler192() {
function bestApproximations() {
return true;
}
euler192();
bestApproximations();
```
# --solutions--

View File

@ -8,16 +8,16 @@ dashedName: problem-193-squarefree-numbers
# --description--
A positive integer n is called squarefree, if no square of a prime divides n, thus 1, 2, 3, 5, 6, 7, 10, 11 are squarefree, but not 4, 8, 9, 12.
A positive integer $n$ is called squarefree, if no square of a prime divides $n$, thus 1, 2, 3, 5, 6, 7, 10, 11 are squarefree, but not 4, 8, 9, 12.
How many squarefree numbers are there below 250?
How many squarefree numbers are there below $2^{50}$?
# --hints--
`euler193()` should return 684465067343069.
`squarefreeNumbers()` should return `684465067343069`.
```js
assert.strictEqual(euler193(), 684465067343069);
assert.strictEqual(squarefreeNumbers(), 684465067343069);
```
# --seed--
@ -25,12 +25,12 @@ assert.strictEqual(euler193(), 684465067343069);
## --seed-contents--
```js
function euler193() {
function squarefreeNumbers() {
return true;
}
euler193();
squarefreeNumbers();
```
# --solutions--

View File

@ -9,23 +9,21 @@ dashedName: problem-194-coloured-configurations
# --description--
Consider graphs built with the units A:
<img class="img-responsive" alt="graph unit A" src="https://cdn.freecodecamp.org/curriculum/project-euler/coloured-configurations-1.png" style="display: inline-block; background-color: white; padding: 10px;">
and B: <img class="img-responsive" alt="graph unit B" src="https://cdn.freecodecamp.org/curriculum/project-euler/coloured-configurations-2.png" style="display: inline-block; background-color: white; padding: 10px;">, where the units are glued along the vertical edges as in the graph <img class="img-responsive" alt="graph with four units glued along the vertical edges" src="https://cdn.freecodecamp.org/curriculum/project-euler/coloured-configurations-3.png" style="display: inline-block; background-color: white; padding: 10px;">.
and B: , where the units are glued along
A configuration of type $(a,b,c)$ is a graph thus built of $a$ units A and $b$ units B, where the graph's vertices are coloured using up to $c$ colours, so that no two adjacent vertices have the same colour. The compound graph above is an example of a configuration of type $(2,2,6)$, in fact of type $(2,2,c)$ for all $c ≥ 4$
the vertical edges as in the graph .
Let $N(a,b,c)$ be the number of configurations of type $(a,b,c)$. For example, $N(1,0,3) = 24$, $N(0,2,4) = 92928$ and $N(2,2,3) = 20736$.
A configuration of type (a,b,c) is a graph thus built of a units A and b units B, where the graph's vertices are coloured using up to c colours, so that no two adjacent vertices have the same colour. The compound graph above is an example of a configuration of type (2,2,6), in fact of type (2,2,c) for all c ≥ 4.
Let N(a,b,c) be the number of configurations of type (a,b,c). For example, N(1,0,3) = 24, N(0,2,4) = 92928 and N(2,2,3) = 20736.
Find the last 8 digits of N(25,75,1984).
Find the last 8 digits of $N(25,75,1984)$.
# --hints--
`euler194()` should return 61190912.
`coloredConfigurations()` should return `61190912`.
```js
assert.strictEqual(euler194(), 61190912);
assert.strictEqual(coloredConfigurations(), 61190912);
```
# --seed--
@ -33,12 +31,12 @@ assert.strictEqual(euler194(), 61190912);
## --seed-contents--
```js
function euler194() {
function coloredConfigurations() {
return true;
}
euler194();
coloredConfigurations();
```
# --solutions--

View File

@ -8,24 +8,22 @@ dashedName: problem-195-inscribed-circles-of-triangles-with-one-angle-of-60-degr
# --description--
Let's call an integer sided triangle with exactly one angle of 60 degrees a 60-degree triangle.
Let's call an integer sided triangle with exactly one angle of 60° a 60° triangle.
Let r be the radius of the inscribed circle of such a 60-degree triangle.
Let $r$ be the radius of the inscribed circle of such a 60° triangle.
There are 1234 60-degree triangles for which r ≤ 100.
There are 1234 60° triangles for which $r ≤ 100$.
Let T(n) be the number of 60-degree triangles for which r ≤ n, so
Let $T(n)$ be the number of 60° triangles for which $r ≤ n$, so $T(100) = 1234$, $T(1000) = 22767$, and $T(10000) = 359912$.
T(100) = 1234, T(1000) = 22767, and T(10000) = 359912.
Find T(1053779).
Find $T(1053779)$.
# --hints--
`euler195()` should return 75085391.
`inscribedCirclesOfTriangles()` should return `75085391`.
```js
assert.strictEqual(euler195(), 75085391);
assert.strictEqual(inscribedCirclesOfTriangles(), 75085391);
```
# --seed--
@ -33,12 +31,12 @@ assert.strictEqual(euler195(), 75085391);
## --seed-contents--
```js
function euler195() {
function inscribedCirclesOfTriangles() {
return true;
}
euler195();
inscribedCirclesOfTriangles();
```
# --solutions--

View File

@ -10,7 +10,20 @@ dashedName: problem-196-prime-triplets
Build a triangle from all positive integers in the following way:
1 2 3 4 5 6 7 8 9 1011 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 2829 30 31 32 33 34 35 3637 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 . . .
$$\begin{array}{rrr}
& 1 \\\\
& \color{red}{2} & \color{red}{3} \\\\
& 4 & \color{red}{5} & 6 \\\\
& \color{red}{7} & 8 & 9 & 10 \\\\
& \color{red}{11} & 12 & \color{red}{13} & 14 & 15 \\\\
& 16 & \color{red}{17} & 18 & \color{red}{19} & 20 & 21 \\\\
& 22 & \color{red}{23} & 24 & 25 & 26 & 27 & 28 \\\\
& \color{red}{29} & 30 & \color{red}{31} & 32 & 33 & 34 & 35 & 36 \\\\
& \color{red}{37} & 38 & 39 & 40 & \color{red}{41} & 42 & \color{red}{43} & 44 & 45 \\\\
& 46 & \color{red}{47} & 48 & 49 & 50 & 51 & 52 & \color{red}{53} & 54 & 55 \\\\
& 56 & 57 & 58 & \color{red}{59} & 60 & \color{red}{61} & 62 & 63 & 64 & 65 & 66 \\\\
& \cdots
\end{array}$$
Each positive integer has up to eight neighbours in the triangle.
@ -20,18 +33,18 @@ For example, in the second row, the prime numbers 2 and 3 are elements of some p
If row 8 is considered, it contains two primes which are elements of some prime triplet, i.e. 29 and 31. If row 9 is considered, it contains only one prime which is an element of some prime triplet: 37.
Define S(n) as the sum of the primes in row n which are elements of any prime triplet. Then S(8)=60 and S(9)=37.
Define $S(n)$ as the sum of the primes in row $n$ which are elements of any prime triplet. Then $S(8) = 60$ and $S(9) = 37$.
You are given that S(10000)=950007619.
You are given that $S(10000) = 950007619$.
Find S(5678027) + S(7208785).
Find $S(5678027) + S(7208785)$.
# --hints--
`euler196()` should return 322303240771079940.
`primeTriplets()` should return `322303240771079940`.
```js
assert.strictEqual(euler196(), 322303240771079940);
assert.strictEqual(primeTriplets(), 322303240771079940);
```
# --seed--
@ -39,12 +52,12 @@ assert.strictEqual(euler196(), 322303240771079940);
## --seed-contents--
```js
function euler196() {
function primeTriplets() {
return true;
}
euler196();
primeTriplets();
```
# --solutions--

View File

@ -8,18 +8,16 @@ dashedName: problem-197-investigating-the-behaviour-of-a-recursively-defined-seq
# --description--
Given is the function f(x) = ⌊230.403243784-x2× 10-9 ( ⌊ ⌋ is the floor-function),
Given is the function $f(x) = ⌊{2}^{30.403243784 - x^2}× {10}^{-9}$ ( ⌊ ⌋ is the floor-function), the sequence $u_n$ is defined by $u_0 = -1$ and $u_{n + 1} = f(u_n)$.
the sequence un is defined by u0 = -1 and un+1 = f(un).
Find un + un+1 for n = 1012. Give your answer with 9 digits after the decimal point.
Find $u_n + u_{n + 1}$ for $n = {10}^{12}$. Give your answer with 9 digits after the decimal point.
# --hints--
`euler197()` should return 1.710637717.
`recursivelyDefinedSequence()` should return `1.710637717`.
```js
assert.strictEqual(euler197(), 1.710637717);
assert.strictEqual(recursivelyDefinedSequence(), 1.710637717);
```
# --seed--
@ -27,12 +25,12 @@ assert.strictEqual(euler197(), 1.710637717);
## --seed-contents--
```js
function euler197() {
function recursivelyDefinedSequence() {
return true;
}
euler197();
recursivelyDefinedSequence();
```
# --solutions--

View File

@ -8,18 +8,18 @@ dashedName: problem-198-ambiguous-numbers
# --description--
A best approximation to a real number x for the denominator bound d is a rational number r/s (in reduced form) with s ≤ d, so that any rational number p/q which is closer to x than r/s has q > d.
A best approximation to a real number $x$ for the denominator bound $d$ is a rational number $\frac{r}{s}$ (in reduced form) with $s ≤ d$, so that any rational number $\frac{p}{q}$ which is closer to $x$ than $\frac{r}{s}$ has $q > d$.
Usually the best approximation to a real number is uniquely determined for all denominator bounds. However, there are some exceptions, e.g. 9/40 has the two best approximations 1/4 and 1/5 for the denominator bound 6. We shall call a real number x ambiguous, if there is at least one denominator bound for which x possesses two best approximations. Clearly, an ambiguous number is necessarily rational.
Usually the best approximation to a real number is uniquely determined for all denominator bounds. However, there are some exceptions, e.g. $\frac{9}{40}$ has the two best approximations $\frac{1}{4}$ and $\frac{1}{5}$ for the denominator bound $6$. We shall call a real number $x$ ambiguous, if there is at least one denominator bound for which $x$ possesses two best approximations. Clearly, an ambiguous number is necessarily rational.
How many ambiguous numbers x = p/q, 0 &lt; x &lt; 1/100, are there whose denominator q does not exceed 108?
How many ambiguous numbers $x = \frac{p}{q}$, $0 &lt; x &lt; \frac{1}{100}$, are there whose denominator $q$ does not exceed ${10}^8$?
# --hints--
`euler198()` should return 52374425.
`ambiguousNumbers()` should return `52374425`.
```js
assert.strictEqual(euler198(), 52374425);
assert.strictEqual(ambiguousNumbers(), 52374425);
```
# --seed--
@ -27,12 +27,12 @@ assert.strictEqual(euler198(), 52374425);
## --seed-contents--
```js
function euler198() {
function ambiguousNumbers() {
return true;
}
euler198();
ambiguousNumbers();
```
# --solutions--

View File

@ -24,13 +24,13 @@ What fraction of the area is not covered by circles after `n` iterations? Give y
assert(typeof iterativeCirclePacking(10) === 'number');
```
`iterativeCirclePacking(10)` should return 0.00396087.
`iterativeCirclePacking(10)` should return `0.00396087`.
```js
assert.strictEqual(iterativeCirclePacking(10), 0.00396087);
```
`iterativeCirclePacking(3)` should return 0.06790342.
`iterativeCirclePacking(3)` should return `0.06790342`.
```js
assert.strictEqual(iterativeCirclePacking(3), 0.06790342);
@ -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

@ -11,22 +11,22 @@ dashedName: >-
# --description--
We shall define a sqube to be a number of the form, p2q3, where p and q are distinct primes.
We shall define a sqube to be a number of the form, ${p^2}{q^3}$, where $p$ and $q$ are distinct primes.
For example, 200 = 5223 or 120072949 = 232613.
For example, $200 = {5^2}{2^3}$ or $120072949 = {{23}^2}{{61}^3}$.
The first five squbes are 72, 108, 200, 392, and 500.
Interestingly, 200 is also the first number for which you cannot change any single digit to make a prime; we shall call such numbers, prime-proof. The next prime-proof sqube which contains the contiguous sub-string "200" is 1992008.
Interestingly, 200 is also the first number for which you cannot change any single digit to make a prime; we shall call such numbers, prime-proof. The next prime-proof sqube which contains the contiguous sub-string `200` is 1992008.
Find the 200th prime-proof sqube containing the contiguous sub-string "200".
Find the 200th prime-proof sqube containing the contiguous sub-string `200`.
# --hints--
`euler200()` should return 229161792008.
`primeProofSqubeWithSubString()` should return `229161792008`.
```js
assert.strictEqual(euler200(), 229161792008);
assert.strictEqual(primeProofSqubeWithSubString(), 229161792008);
```
# --seed--
@ -34,12 +34,12 @@ assert.strictEqual(euler200(), 229161792008);
## --seed-contents--
```js
function euler200() {
function primeProofSqubeWithSubString() {
return true;
}
euler200();
primeProofSqubeWithSubString();
```
# --solutions--