fix(curriculum): clean-up Project Euler 361-380 (#43002)
* fix: clean-up Project Euler 361-380 * fix: improve wording Co-authored-by: Sem Bauke <46919888+Sembauke@users.noreply.github.com> * fix: remove unnecessary paragraph * fix: corrections from review Co-authored-by: Tom <20648924+moT01@users.noreply.github.com> Co-authored-by: Sem Bauke <46919888+Sembauke@users.noreply.github.com> Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>
This commit is contained in:
@ -8,30 +8,33 @@ dashedName: problem-361-subsequence-of-thue-morse-sequence
|
||||
|
||||
# --description--
|
||||
|
||||
The Thue-Morse sequence {Tn} is a binary sequence satisfying:
|
||||
The Thue-Morse sequence $\\{T_n\\}$ is a binary sequence satisfying:
|
||||
|
||||
T0 = 0
|
||||
- $T_0 = 0$
|
||||
- $T_{2n} = T_n$
|
||||
- $T_{2n + 1} = 1 - T_n$
|
||||
|
||||
T2n = Tn
|
||||
The first several terms of $\\{T_n\\}$ are given as follows: $01101001\color{red}{10010}1101001011001101001\ldots$.
|
||||
|
||||
T2n+1 = 1 - Tn
|
||||
We define $\\{A_n\\}$ as the sorted sequence of integers such that the binary expression of each element appears as a subsequence in $\\{T_n\\}$. For example, the decimal number 18 is expressed as 10010 in binary. 10010 appears in $\\{T_n\\}$ ($T_8$ to $T_{12}$), so 18 is an element of $\\{A_n\\}$. The decimal number 14 is expressed as 1110 in binary. 1110 never appears in $\\{T_n\\}$, so 14 is not an element of $\\{A_n\\}$.
|
||||
|
||||
The first several terms of {Tn} are given as follows: 01101001100101101001011001101001....
|
||||
The first several terms of $A_n$ are given as follows:
|
||||
|
||||
We define {An} as the sorted sequence of integers such that the binary expression of each element appears as a subsequence in {Tn}. For example, the decimal number 18 is expressed as 10010 in binary. 10010 appears in {Tn} (T8 to T12), so 18 is an element of {An}. The decimal number 14 is expressed as 1110 in binary. 1110 never appears in {Tn}, so 14 is not an element of {An}.
|
||||
$$\begin{array}{cr}
|
||||
n & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & \ldots \\\\
|
||||
A_n & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 9 & 10 & 11 & 12 & 13 & 18 & \ldots
|
||||
\end{array}$$
|
||||
|
||||
The first several terms of An are given as follows: n0123456789101112…An012345691011121318…
|
||||
We can also verify that $A_{100} = 3251$ and $A_{1000} = 80\\,852\\,364\\,498$.
|
||||
|
||||
We can also verify that A100 = 3251 and A1000 = 80852364498.
|
||||
|
||||
Find the last 9 digits of .
|
||||
Find the last 9 digits of $\displaystyle\sum_{k = 1}^{18} A_{{10}^k}$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler361()` should return 178476944.
|
||||
`subsequenceOfThueMorseSequence()` should return `178476944`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler361(), 178476944);
|
||||
assert.strictEqual(subsequenceOfThueMorseSequence(), 178476944);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -39,12 +42,12 @@ assert.strictEqual(euler361(), 178476944);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler361() {
|
||||
function subsequenceOfThueMorseSequence() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler361();
|
||||
subsequenceOfThueMorseSequence();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -12,24 +12,24 @@ Consider the number 54.
|
||||
|
||||
54 can be factored in 7 distinct ways into one or more factors larger than 1:
|
||||
|
||||
54, 2×27, 3×18, 6×9, 3×3×6, 2×3×9 and 2×3×3×3.
|
||||
$$54, 2 × 27, 3 × 18, 6 × 9, 3 × 3 × 6, 2 × 3 × 9 \text{ and } 2 × 3 × 3 × 3$$
|
||||
|
||||
If we require that the factors are all squarefree only two ways remain: 3×3×6 and 2×3×3×3.
|
||||
If we require that the factors are all squarefree only two ways remain: $3 × 3 × 6$ and $2 × 3 × 3 × 3$.
|
||||
|
||||
Let's call Fsf(n) the number of ways n can be factored into one or more squarefree factors larger than 1, so Fsf(54)=2.
|
||||
Let's call $Fsf(n)$ the number of ways $n$ can be factored into one or more squarefree factors larger than 1, so $Fsf(54) = 2$.
|
||||
|
||||
Let S(n) be ∑Fsf(k) for k=2 to n.
|
||||
Let $S(n)$ be $\sum Fsf(k)$ for $k = 2$ to $n$.
|
||||
|
||||
S(100)=193.
|
||||
$S(100) = 193$.
|
||||
|
||||
Find S(10 000 000 000).
|
||||
Find $S(10\\,000\\,000\\,000)$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler362()` should return 457895958010.
|
||||
`squarefreeFactors()` should return `457895958010`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler362(), 457895958010);
|
||||
assert.strictEqual(squarefreeFactors(), 457895958010);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -37,12 +37,12 @@ assert.strictEqual(euler362(), 457895958010);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler362() {
|
||||
function squarefreeFactors() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler362();
|
||||
squarefreeFactors();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -8,24 +8,32 @@ dashedName: problem-363-bzier-curves
|
||||
|
||||
# --description--
|
||||
|
||||
A cubic Bézier curve is defined by four points: P0, P1, P2 and P3.
|
||||
A cubic Bézier curve is defined by four points: $P_0$, $P_1$, $P_2$ and $P_3$.
|
||||
|
||||
The curve is constructed as follows: On the segments P0P1, P1P2 and P2P3 the points Q0,Q1 and Q2 are drawn such that P0Q0 / P0P1 = P1Q1 / P1P2 = P2Q2 / P2P3 = t (t in \[0,1]). On the segments Q0Q1 and Q1Q2 the points R0 and R1 are drawn such that Q0R0 / Q0Q1 = Q1R1 / Q1Q2 = t for the same value of t. On the segment R0R1 the point B is drawn such that R0B / R0R1 = t for the same value of t. The Bézier curve defined by the points P0, P1, P2, P3 is the locus of B as Q0 takes all possible positions on the segment P0P1. (Please note that for all points the value of t is the same.)
|
||||
The curve is constructed as follows:
|
||||
|
||||
At this (external) web address you will find an applet that allows you to drag the points P0, P1, P2 and P3 to see what the Bézier curve (green curve) defined by those points looks like. You can also drag the point Q0 along the segment P0P1.
|
||||
<img class="img-responsive center-block" alt="construction of Bézier curve" src="https://cdn.freecodecamp.org/curriculum/project-euler/bzier-curves.png" style="background-color: white; padding: 10px;">
|
||||
|
||||
From the construction it is clear that the Bézier curve will be tangent to the segments P0P1 in P0 and P2P3 in P3.
|
||||
On the segments $P_0P_1$, $P_1P_2$ and $P_2P_3$ the points $Q_0$,$Q_1$ and $Q_2$ are drawn such that $\frac{P_0Q_0}{P_0P_1} = \frac{P_1Q_1}{P_1P_2} = \frac{P_2Q_2}{P_2P_3} = t$, with $t$ in [0,1].
|
||||
|
||||
A cubic Bézier curve with P0=(1,0), P1=(1,v), P2=(v,1) and P3=(0,1) is used to approximate a quarter circle. The value v > 0 is chosen such that the area enclosed by the lines OP0, OP3 and the curve is equal to π/4 (the area of the quarter circle).
|
||||
On the segments $Q_0Q_1$ and $Q_1Q_2$ the points $R_0$ and $R_1$ are drawn such that $\frac{Q_0R_0}{Q_0Q_1} = \frac{Q_1R_1}{Q_1Q_2} = t$ for the same value of $t$.
|
||||
|
||||
By how many percent does the length of the curve differ from the length of the quarter circle? That is, if L is the length of the curve, calculate 100 × L − π/2π/2Give your answer rounded to 10 digits behind the decimal point.
|
||||
On the segment $R_0R_1$ the point $B$ is drawn such that $\frac{R_0B}{R_0R_1} = t$ for the same value of $t$.
|
||||
|
||||
The Bézier curve defined by the points $P_0$, $P_1$, $P_2$, $P_3$ is the locus of $B$ as $Q_0$ takes all possible positions on the segment $P_0P_1$. (Please note that for all points the value of $t$ is the same.)
|
||||
|
||||
From the construction it is clear that the Bézier curve will be tangent to the segments $P_0P_1$ in $P_0$ and $P_2P_3$ in $P_3$.
|
||||
|
||||
A cubic Bézier curve with $P_0 = (1, 0)$, $P_1 = (1, v)$, $P_2 = (v, 1)$ and $P_3 = (0, 1)$ is used to approximate a quarter circle. The value $v > 0$ is chosen such that the area enclosed by the lines $OP_0$, $OP_3$ and the curve is equal to $\frac{π}{4}$ (the area of the quarter circle).
|
||||
|
||||
By how many percent does the length of the curve differ from the length of the quarter circle? That is, if $L$ is the length of the curve, calculate $100 × \displaystyle\frac{L − \frac{π}{2}}{\frac{π}{2}}$. Give your answer rounded to 10 digits behind the decimal point.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler363()` should return 0.0000372091.
|
||||
`bezierCurves()` should return `0.0000372091`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler363(), 0.0000372091);
|
||||
assert.strictEqual(bezierCurves(), 0.0000372091);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -33,12 +41,12 @@ assert.strictEqual(euler363(), 0.0000372091);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler363() {
|
||||
function bezierCurves() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler363();
|
||||
bezierCurves();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -8,24 +8,26 @@ dashedName: problem-364-comfortable-distance
|
||||
|
||||
# --description--
|
||||
|
||||
There are N seats in a row. N people come after each other to fill the seats according to the following rules:
|
||||
There are $N$ seats in a row. $N$ people come after each other to fill the seats according to the following rules:
|
||||
|
||||
If there is any seat whose adjacent seat(s) are not occupied take such a seat.
|
||||
1. If there is any seat whose adjacent seat(s) are not occupied take such a seat.
|
||||
2. If there is no such seat and there is any seat for which only one adjacent seat is occupied take such a seat.
|
||||
3. Otherwise take one of the remaining available seats.
|
||||
|
||||
If there is no such seat and there is any seat for which only one adjacent seat is occupied take such a seat.
|
||||
Let $T(N)$ be the number of possibilities that $N$ seats are occupied by $N$ people with the given rules. The following figure shows $T(4) = 8$.
|
||||
|
||||
Otherwise take one of the remaining available seats.
|
||||
<img class="img-responsive center-block" alt="eight ways for N seats to be occupied by N people" src="https://cdn.freecodecamp.org/curriculum/project-euler/comfortable-distance.gif" style="background-color: white; padding: 10px;">
|
||||
|
||||
Let T(N) be the number of possibilities that N seats are occupied by N people with the given rules. The following figure shows T(4)=8.
|
||||
We can verify that $T(10) = 61\\,632$ and $T(1\\,000)\bmod 100\\,000\\,007 = 47\\,255\\,094$.
|
||||
|
||||
We can verify that T(10) = 61632 and T(1 000) mod 100 000 007 = 47255094. Find T(1 000 000) mod 100 000 007.
|
||||
Find $T(1\\,000\\,000)\bmod 100\\,000\\,007$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler364()` should return 44855254.
|
||||
`comfortableDistance()` should return `44855254`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler364(), 44855254);
|
||||
assert.strictEqual(comfortableDistance(), 44855254);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -33,12 +35,12 @@ assert.strictEqual(euler364(), 44855254);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler364() {
|
||||
function comfortableDistance() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler364();
|
||||
comfortableDistance();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -8,18 +8,18 @@ dashedName: problem-365-a-huge-binomial-coefficient
|
||||
|
||||
# --description--
|
||||
|
||||
The binomial coefficient C(1018,109) is a number with more than 9 billion (9×109) digits.
|
||||
The binomial coefficient $\displaystyle\binom{{10}^{18}}{{10}^9}$ is a number with more than 9 billion ($9 × {10}^9$) digits.
|
||||
|
||||
Let M(n,k,m) denote the binomial coefficient C(n,k) modulo m.
|
||||
Let $M(n, k, m)$ denote the binomial coefficient $\displaystyle\binom{n}{k}$ modulo $m$.
|
||||
|
||||
Calculate ∑M(1018,109,p*q*r) for 1000<p<q<r<5000 and p,q,r prime.
|
||||
Calculate $\sum M({10}^{18}, {10}^9, p \times q \times r)$ for $1000 < p < q < r < 5000$ and $p$, $q$, $r$ prime.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler365()` should return 162619462356610300.
|
||||
`hugeBinomialCoefficient()` should return `162619462356610300`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler365(), 162619462356610300);
|
||||
assert.strictEqual(hugeBinomialCoefficient(), 162619462356610300);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -27,12 +27,12 @@ assert.strictEqual(euler365(), 162619462356610300);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler365() {
|
||||
function hugeBinomialCoefficient() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler365();
|
||||
hugeBinomialCoefficient();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -10,7 +10,7 @@ dashedName: problem-366-stone-game-iii
|
||||
|
||||
Two players, Anton and Bernhard, are playing the following game.
|
||||
|
||||
There is one pile of n stones.
|
||||
There is one pile of $n$ stones.
|
||||
|
||||
The first player may remove any positive number of stones, but not the whole pile.
|
||||
|
||||
@ -18,20 +18,34 @@ Thereafter, each player may remove at most twice the number of stones his oppone
|
||||
|
||||
The player who removes the last stone wins.
|
||||
|
||||
E.g. n=5 If the first player takes anything more than one stone the next player will be able to take all remaining stones. If the first player takes one stone, leaving four, his opponent will take also one stone, leaving three stones. The first player cannot take all three because he may take at most 2x1=2 stones. So let's say he takes also one stone, leaving 2. The second player can take the two remaining stones and wins. So 5 is a losing position for the first player. For some winning positions there is more than one possible move for the first player. E.g. when n=17 the first player can remove one or four stones.
|
||||
E.g. $n = 5$
|
||||
|
||||
Let M(n) be the maximum number of stones the first player can take from a winning position at his first turn and M(n)=0 for any other position.
|
||||
If the first player takes anything more than one stone the next player will be able to take all remaining stones.
|
||||
|
||||
∑M(n) for n≤100 is 728.
|
||||
If the first player takes one stone, leaving four, his opponent will take also one stone, leaving three stones.
|
||||
|
||||
Find ∑M(n) for n≤1018. Give your answer modulo 108.
|
||||
The first player cannot take all three because he may take at most $2 \times 1 = 2$ stones. So let's say he also takes one stone, leaving 2.
|
||||
|
||||
The second player can take the two remaining stones and wins.
|
||||
|
||||
So 5 is a losing position for the first player.
|
||||
|
||||
For some winning positions there is more than one possible move for the first player.
|
||||
|
||||
E.g. when $n = 17$ the first player can remove one or four stones.
|
||||
|
||||
Let $M(n)$ be the maximum number of stones the first player can take from a winning position at his first turn and $M(n) = 0$ for any other position.
|
||||
|
||||
$\sum M(n)$ for $n ≤ 100$ is 728.
|
||||
|
||||
Find $\sum M(n)$ for $n ≤ {10}^{18}$. Give your answer modulo ${10}^8$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler366()` should return 88351299.
|
||||
`stoneGameThree()` should return `88351299`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler366(), 88351299);
|
||||
assert.strictEqual(stoneGameThree(), 88351299);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -39,12 +53,12 @@ assert.strictEqual(euler366(), 88351299);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler366() {
|
||||
function stoneGameThree() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler366();
|
||||
stoneGameThree();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -10,18 +10,30 @@ dashedName: problem-367-bozo-sort
|
||||
|
||||
Bozo sort, not to be confused with the slightly less efficient bogo sort, consists out of checking if the input sequence is sorted and if not swapping randomly two elements. This is repeated until eventually the sequence is sorted.
|
||||
|
||||
If we consider all permutations of the first 4 natural numbers as input the expectation value of the number of swaps, averaged over all 4! input sequences is 24.75. The already sorted sequence takes 0 steps.
|
||||
If we consider all permutations of the first 4 natural numbers as input the expectation value of the number of swaps, averaged over all $4!$ input sequences is $24.75$.
|
||||
|
||||
In this problem we consider the following variant on bozo sort. If the sequence is not in order we pick three elements at random and shuffle these three elements randomly. All 3!=6 permutations of those three elements are equally likely. The already sorted sequence will take 0 steps. If we consider all permutations of the first 4 natural numbers as input the expectation value of the number of shuffles, averaged over all 4! input sequences is 27.5. Consider as input sequences the permutations of the first 11 natural numbers. Averaged over all 11! input sequences, what is the expected number of shuffles this sorting algorithm will perform?
|
||||
The already sorted sequence takes 0 steps.
|
||||
|
||||
Give your answer rounded to the nearest integer.
|
||||
In this problem we consider the following variant on bozo sort.
|
||||
|
||||
If the sequence is not in order we pick three elements at random and shuffle these three elements randomly.
|
||||
|
||||
All $3! = 6$ permutations of those three elements are equally likely.
|
||||
|
||||
The already sorted sequence will take 0 steps.
|
||||
|
||||
If we consider all permutations of the first 4 natural numbers as input the expectation value of the number of shuffles, averaged over all $4!$ input sequences is $27.5$.
|
||||
|
||||
Consider as input sequences the permutations of the first 11 natural numbers.
|
||||
|
||||
Averaged over all $11!$ input sequences, what is the expected number of shuffles this sorting algorithm will perform? Give your answer rounded to the nearest integer.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler367()` should return 48271207.
|
||||
`bozoSort()` should return `48271207`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler367(), 48271207);
|
||||
assert.strictEqual(bozoSort(), 48271207);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -29,12 +41,12 @@ assert.strictEqual(euler367(), 48271207);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler367() {
|
||||
function bozoSort() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler367();
|
||||
bozoSort();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -8,11 +8,16 @@ dashedName: problem-368-a-kempner-like-series
|
||||
|
||||
# --description--
|
||||
|
||||
The harmonic series $1 + \\dfrac{1}{2} + \\dfrac{1}{3} + \\dfrac{1}{4} + ...$ is well known to be divergent.
|
||||
The harmonic series $1 + \dfrac{1}{2} + \dfrac{1}{3} + \dfrac{1}{4} + \ldots$ is well known to be divergent.
|
||||
|
||||
If we however omit from this series every term where the denominator has a 9 in it, the series remarkably enough converges to approximately 22.9206766193. This modified harmonic series is called the Kempner series.
|
||||
|
||||
Let us now consider another modified harmonic series by omitting from the harmonic series every term where the denominator has 3 or more equal consecutive digits. One can verify that out of the first 1200 terms of the harmonic series, only 20 terms will be omitted. These 20 omitted terms are: $$\\dfrac{1}{111}, \\dfrac{1}{222}, \\dfrac{1}{333}, \\dfrac{1}{444}, \\dfrac{1}{555}, \\dfrac{1}{666}, \\dfrac{1}{777}, \\dfrac{1}{888}, \\dfrac{1}{999}, \\dfrac{1}{1000}, \\dfrac{1}{1110}, \\\\ \\dfrac{1}{1111}, \\dfrac{1}{1112}, \\dfrac{1}{1113}, \\dfrac{1}{1114}, \\dfrac{1}{1115}, \\dfrac{1}{1116}, \\dfrac{1}{1117}, \\dfrac{1}{1118}, \\dfrac{1}{1119}$$
|
||||
Let us now consider another modified harmonic series by omitting from the harmonic series every term where the denominator has 3 or more equal consecutive digits. One can verify that out of the first 1200 terms of the harmonic series, only 20 terms will be omitted.
|
||||
|
||||
These 20 omitted terms are:
|
||||
|
||||
$$\dfrac{1}{111}, \dfrac{1}{222}, \dfrac{1}{333}, \dfrac{1}{444}, \dfrac{1}{555}, \dfrac{1}{666}, \dfrac{1}{777}, \dfrac{1}{888}, \dfrac{1}{999}, \dfrac{1}{1000}, \dfrac{1}{1110}, \\\\
|
||||
\dfrac{1}{1111}, \dfrac{1}{1112}, \dfrac{1}{1113}, \dfrac{1}{1114}, \dfrac{1}{1115}, \dfrac{1}{1116}, \dfrac{1}{1117}, \dfrac{1}{1118}, \dfrac{1}{1119}$$
|
||||
|
||||
This series converges as well.
|
||||
|
||||
@ -20,10 +25,10 @@ Find the value the series converges to. Give your answer rounded to 10 digits be
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler368()` should return 253.6135092068.
|
||||
`kempnerLikeSeries()` should return `253.6135092068`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler368(), 253.6135092068);
|
||||
assert.strictEqual(kempnerLikeSeries(), 253.6135092068);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -31,12 +36,12 @@ assert.strictEqual(euler368(), 253.6135092068);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler368() {
|
||||
function kempnerLikeSeries() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler368();
|
||||
kempnerLikeSeries();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -10,16 +10,16 @@ dashedName: problem-369-badugi
|
||||
|
||||
In a standard 52 card deck of playing cards, a set of 4 cards is a Badugi if it contains 4 cards with no pairs and no two cards of the same suit.
|
||||
|
||||
Let f(n) be the number of ways to choose n cards with a 4 card subset that is a Badugi. For example, there are 2598960 ways to choose five cards from a standard 52 card deck, of which 514800 contain a 4 card subset that is a Badugi, so f(5) = 514800.
|
||||
Let $f(n)$ be the number of ways to choose $n$ cards with a 4 card subset that is a Badugi. For example, there are $2\\,598\\,960$ ways to choose five cards from a standard 52 card deck, of which $514\\,800$ contain a 4 card subset that is a Badugi, so $f(5) = 514800$.
|
||||
|
||||
Find ∑f(n) for 4 ≤ n ≤ 13.
|
||||
Find $\sum f(n)$ for $4 ≤ n ≤ 13$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler369()` should return 862400558448.
|
||||
`badugi()` should return `862400558448`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler369(), 862400558448);
|
||||
assert.strictEqual(badugi(), 862400558448);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -27,12 +27,12 @@ assert.strictEqual(euler369(), 862400558448);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler369() {
|
||||
function badugi() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler369();
|
||||
badugi();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -8,20 +8,20 @@ dashedName: problem-370-geometric-triangles
|
||||
|
||||
# --description--
|
||||
|
||||
Let us define a geometric triangle as an integer sided triangle with sides a ≤ b ≤ c so that its sides form a geometric progression, i.e. b2 = a · c .
|
||||
Let us define a geometric triangle as an integer sided triangle with sides $a ≤ b ≤ c$ so that its sides form a geometric progression, i.e. $b^2 = a \times c$.
|
||||
|
||||
An example of such a geometric triangle is the triangle with sides a = 144, b = 156 and c = 169.
|
||||
An example of such a geometric triangle is the triangle with sides $a = 144$, $b = 156$ and $c = 169$.
|
||||
|
||||
There are 861805 geometric triangles with perimeter ≤ 106 .
|
||||
There are $861\\,805$ geometric triangles with $\text{perimeter} ≤ {10}^6$.
|
||||
|
||||
How many geometric triangles exist with perimeter ≤ 2.5·1013 ?
|
||||
How many geometric triangles exist with $\text{perimeter} ≤ 2.5 \times {10}^{13}$?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler370()` should return 41791929448408.
|
||||
`geometricTriangles()` should return `41791929448408`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler370(), 41791929448408);
|
||||
assert.strictEqual(geometricTriangles(), 41791929448408);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -29,12 +29,12 @@ assert.strictEqual(euler370(), 41791929448408);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler370() {
|
||||
function geometricTriangles() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler370();
|
||||
geometricTriangles();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -8,24 +8,24 @@ dashedName: problem-371-licence-plates
|
||||
|
||||
# --description--
|
||||
|
||||
Oregon licence plates consist of three letters followed by a three digit number (each digit can be from \[0..9]).
|
||||
Oregon licence plates consist of three letters followed by a three digit number (each digit can be from [0...9]).
|
||||
|
||||
While driving to work Seth plays the following game:
|
||||
|
||||
Whenever the numbers of two licence plates seen on his trip add to 1000 that's a win.
|
||||
|
||||
E.g. MIC-012 and HAN-988 is a win and RYU-500 and SET-500 too. (as long as he sees them in the same trip).
|
||||
E.g. `MIC-012` and `HAN-988` is a win and `RYU-500` and `SET-500` too. (as long as he sees them in the same trip).
|
||||
|
||||
Find the expected number of plates he needs to see for a win. Give your answer rounded to 8 decimal places behind the decimal point.
|
||||
|
||||
Note: We assume that each licence plate seen is equally likely to have any three digit number on it.
|
||||
**Note:** We assume that each licence plate seen is equally likely to have any three digit number on it.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler371()` should return 40.66368097.
|
||||
`licensePlates()` should return `40.66368097`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler371(), 40.66368097);
|
||||
assert.strictEqual(licensePlates(), 40.66368097);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -33,12 +33,12 @@ assert.strictEqual(euler371(), 40.66368097);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler371() {
|
||||
function licensePlates() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler371();
|
||||
licensePlates();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -8,16 +8,20 @@ dashedName: problem-372-pencils-of-rays
|
||||
|
||||
# --description--
|
||||
|
||||
Let R(M, N) be the number of lattice points (x, y) which satisfy M
|
||||
Let $R(M, N)$ be the number of lattice points ($x$, $y$) which satisfy $M \lt x \le N$, $M \lt y \le N$ and $\left\lfloor\frac{y^2}{x^2}\right\rfloor$ is odd.
|
||||
|
||||
Note: represents the floor function.
|
||||
We can verify that $R(0, 100) = 3\\,019$ and $R(100, 10\\,000) = 29\\,750\\,422$.
|
||||
|
||||
Find $R(2 \times {10}^6, {10}^9)$.
|
||||
|
||||
**Note:** $\lfloor x\rfloor$ represents the floor function.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler372()` should return 301450082318807040.
|
||||
`pencilsOfRays()` should return `301450082318807040`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler372(), 301450082318807040);
|
||||
assert.strictEqual(pencilsOfRays(), 301450082318807040);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -25,12 +29,12 @@ assert.strictEqual(euler372(), 301450082318807040);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler372() {
|
||||
function pencilsOfRays() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler372();
|
||||
pencilsOfRays();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -8,22 +8,20 @@ dashedName: problem-373-circumscribed-circles
|
||||
|
||||
# --description--
|
||||
|
||||
Every triangle has a circumscribed circle that goes through the three vertices.
|
||||
Every triangle has a circumscribed circle that goes through the three vertices. Consider all integer sided triangles for which the radius of the circumscribed circle is integral as well.
|
||||
|
||||
Consider all integer sided triangles for which the radius of the circumscribed circle is integral as well.
|
||||
Let $S(n)$ be the sum of the radii of the circumscribed circles of all such triangles for which the radius does not exceed $n$.
|
||||
|
||||
Let S(n) be the sum of the radii of the circumscribed circles of all such triangles for which the radius does not exceed n.
|
||||
$S(100) = 4\\,950$ and $S(1\\,200) = 1\\,653\\,605$.
|
||||
|
||||
S(100)=4950 and S(1200)=1653605.
|
||||
|
||||
Find S(107).
|
||||
Find $S({10}^7)$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler373()` should return 727227472448913.
|
||||
`circumscribedCircles()` should return `727227472448913`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler373(), 727227472448913);
|
||||
assert.strictEqual(circumscribedCircles(), 727227472448913);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -31,12 +29,12 @@ assert.strictEqual(euler373(), 727227472448913);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler373() {
|
||||
function circumscribedCircles() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler373();
|
||||
circumscribedCircles();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -8,28 +8,30 @@ dashedName: problem-374-maximum-integer-partition-product
|
||||
|
||||
# --description--
|
||||
|
||||
An integer partition of a number n is a way of writing n as a sum of positive integers.
|
||||
An integer partition of a number $n$ is a way of writing $n$ as a sum of positive integers.
|
||||
|
||||
Partitions that differ only in the order of their summands are considered the same. A partition of n into distinct parts is a partition of n in which every part occurs at most once.
|
||||
Partitions that differ only in the order of their summands are considered the same. A partition of $n$ into distinct parts is a partition of $n$ in which every part occurs at most once.
|
||||
|
||||
The partitions of 5 into distinct parts are: 5, 4+1 and 3+2.
|
||||
The partitions of 5 into distinct parts are:
|
||||
|
||||
Let f(n) be the maximum product of the parts of any such partition of n into distinct parts and let m(n) be the number of elements of any such partition of n with that product.
|
||||
5, 4 + 1 and 3 + 2.
|
||||
|
||||
So f(5)=6 and m(5)=2.
|
||||
Let $f(n)$ be the maximum product of the parts of any such partition of $n$ into distinct parts and let $m(n)$ be the number of elements of any such partition of $n$ with that product.
|
||||
|
||||
For n=10 the partition with the largest product is 10=2+3+5, which gives f(10)=30 and m(10)=3. And their product, f(10)·m(10) = 30·3 = 90
|
||||
So $f(5) = 6$ and $m(5) = 2$.
|
||||
|
||||
It can be verified that ∑f(n)·m(n) for 1 ≤ n ≤ 100 = 1683550844462.
|
||||
For $n = 10$ the partition with the largest product is $10 = 2 + 3 + 5$, which gives $f(10) = 30$ and $m(10) = 3$. And their product, $f(10) \times m(10) = 30 \times 3 = 90$
|
||||
|
||||
Find ∑f(n)·m(n) for 1 ≤ n ≤ 1014. Give your answer modulo 982451653, the 50 millionth prime.
|
||||
It can be verified that $\sum f(n) \times m(n)$ for $1 ≤ n ≤ 100 = 1\\,683\\,550\\,844\\,462$.
|
||||
|
||||
Find $\sum f(n) \times m(n)$ for $1 ≤ n ≤ {10}^{14}$. Give your answer modulo $982\\,451\\,653$, the 50 millionth prime.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler374()` should return 334420941.
|
||||
`maximumIntegerPartitionProduct()` should return `334420941`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler374(), 334420941);
|
||||
assert.strictEqual(maximumIntegerPartitionProduct(), 334420941);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -37,12 +39,12 @@ assert.strictEqual(euler374(), 334420941);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler374() {
|
||||
function maximumIntegerPartitionProduct() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler374();
|
||||
maximumIntegerPartitionProduct();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -8,30 +8,25 @@ dashedName: problem-375-minimum-of-subsequences
|
||||
|
||||
# --description--
|
||||
|
||||
Let Sn be an integer sequence produced with the following pseudo-random number generator:
|
||||
Let $S_n$ be an integer sequence produced with the following pseudo-random number generator:
|
||||
|
||||
S0
|
||||
$$\begin{align}
|
||||
S_0 & = 290\\,797 \\\\
|
||||
S_{n + 1} & = {S_n}^2\bmod 50\\,515\\,093
|
||||
\end{align}$$
|
||||
|
||||
=
|
||||
Let $A(i, j)$ be the minimum of the numbers $S_i, S_{i + 1}, \ldots, S_j$ for $i ≤ j$. Let $M(N) = \sum A(i, j)$ for $1 ≤ i ≤ j ≤ N$.
|
||||
|
||||
290797
|
||||
We can verify that $M(10) = 432\\,256\\,955$ and $M(10\\,000) = 3\\,264\\,567\\,774\\,119$.
|
||||
|
||||
Sn+1
|
||||
|
||||
=
|
||||
|
||||
Sn2 mod 50515093
|
||||
|
||||
Let A(i, j) be the minimum of the numbers Si, Si+1, ... , Sj for i ≤ j. Let M(N) = ΣA(i, j) for 1 ≤ i ≤ j ≤ N. We can verify that M(10) = 432256955 and M(10 000) = 3264567774119.
|
||||
|
||||
Find M(2 000 000 000).
|
||||
Find $M(2\\,000\\,000\\,000)$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler375()` should return 7435327983715286000.
|
||||
`minimumOfSubsequences()` should return `7435327983715286000`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler375(), 7435327983715286000);
|
||||
assert.strictEqual(minimumOfSubsequences(), 7435327983715286000);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -39,12 +34,12 @@ assert.strictEqual(euler375(), 7435327983715286000);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler375() {
|
||||
function minimumOfSubsequences() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler375();
|
||||
minimumOfSubsequences();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -10,28 +10,45 @@ dashedName: problem-376-nontransitive-sets-of-dice
|
||||
|
||||
Consider the following set of dice with nonstandard pips:
|
||||
|
||||
Die A: 1 4 4 4 4 4 Die B: 2 2 2 5 5 5 Die C: 3 3 3 3 3 6
|
||||
$$\begin{array}{}
|
||||
\text{Die A: } & 1 & 4 & 4 & 4 & 4 & 4 \\\\
|
||||
\text{Die B: } & 2 & 2 & 2 & 5 & 5 & 5 \\\\
|
||||
\text{Die C: } & 3 & 3 & 3 & 3 & 3 & 6 \\\\
|
||||
\end{array}$$
|
||||
|
||||
A game is played by two players picking a die in turn and rolling it. The player who rolls the highest value wins.
|
||||
|
||||
If the first player picks die A and the second player picks die B we get P(second player wins) = 7/12 > 1/2
|
||||
If the first player picks die $A$ and the second player picks die $B$ we get
|
||||
|
||||
If the first player picks die B and the second player picks die C we get P(second player wins) = 7/12 > 1/2
|
||||
$P(\text{second player wins}) = \frac{7}{12} > \frac{1}{2}$
|
||||
|
||||
If the first player picks die C and the second player picks die A we get P(second player wins) = 25/36 > 1/2
|
||||
If the first player picks die $B$ and the second player picks die $C$ we get
|
||||
|
||||
$P(\text{second player wins}) = \frac{7}{12} > \frac{1}{2}$
|
||||
|
||||
If the first player picks die $C$ and the second player picks die $A$ we get
|
||||
|
||||
$P(\text{second player wins}) = \frac{25}{36} > \frac{1}{2}$
|
||||
|
||||
So whatever die the first player picks, the second player can pick another die and have a larger than 50% chance of winning. A set of dice having this property is called a nontransitive set of dice.
|
||||
|
||||
We wish to investigate how many sets of nontransitive dice exist. We will assume the following conditions:There are three six-sided dice with each side having between 1 and N pips, inclusive. Dice with the same set of pips are equal, regardless of which side on the die the pips are located. The same pip value may appear on multiple dice; if both players roll the same value neither player wins. The sets of dice {A,B,C}, {B,C,A} and {C,A,B} are the same set.
|
||||
We wish to investigate how many sets of nontransitive dice exist. We will assume the following conditions:
|
||||
|
||||
For N = 7 we find there are 9780 such sets. How many are there for N = 30 ?
|
||||
- There are three six-sided dice with each side having between 1 and $N$ pips, inclusive.
|
||||
- Dice with the same set of pips are equal, regardless of which side on the die the pips are located.
|
||||
- The same pip value may appear on multiple dice; if both players roll the same value neither player wins.
|
||||
- The sets of dice $\\{A, B, C\\}$, $\\{B, C, A\\}$ and $\\{C, A, B\\}$ are the same set.
|
||||
|
||||
For $N = 7$ we find there are 9780 such sets.
|
||||
|
||||
How many are there for $N = 30$?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler376()` should return 973059630185670.
|
||||
`nontransitiveSetsOfDice()` should return `973059630185670`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler376(), 973059630185670);
|
||||
assert.strictEqual(nontransitiveSetsOfDice(), 973059630185670);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -39,12 +56,12 @@ assert.strictEqual(euler376(), 973059630185670);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler376() {
|
||||
function nontransitiveSetsOfDice() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler376();
|
||||
nontransitiveSetsOfDice();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -14,16 +14,16 @@ There are 16 positive integers that do not have a zero in their digits and that
|
||||
|
||||
Their sum is 17891.
|
||||
|
||||
Let f(n) be the sum of all positive integers that do not have a zero in their digits and have a digital sum equal to n.
|
||||
Let $f(n)$ be the sum of all positive integers that do not have a zero in their digits and have a digital sum equal to $n$.
|
||||
|
||||
Find $\\displaystyle \\sum\_{i=1}^{17} f(13^i)$. Give the last 9 digits as your answer.
|
||||
Find $\displaystyle\sum_{i=1}^{17} f(13^i)$. Give the last 9 digits as your answer.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler377()` should return 732385277.
|
||||
`experience13()` should return `732385277`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler377(), 732385277);
|
||||
assert.strictEqual(experience13(), 732385277);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -31,12 +31,12 @@ assert.strictEqual(euler377(), 732385277);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler377() {
|
||||
function experience13() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler377();
|
||||
experience13();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -8,24 +8,20 @@ dashedName: problem-378-triangle-triples
|
||||
|
||||
# --description--
|
||||
|
||||
Let T(n) be the nth triangle number, so T(n) =
|
||||
Let $T(n)$ be the $n^{\text{th}}$ triangle number, so $T(n) = \frac{n(n + 1)}{2}$.
|
||||
|
||||
n (n+1)2
|
||||
Let $dT(n)$ be the number of divisors of $T(n)$. E.g.: $T(7) = 28$ and $dT(7) = 6$.
|
||||
|
||||
.
|
||||
Let $Tr(n)$ be the number of triples ($i$, $j$, $k$) such that $1 ≤ i < j < k ≤ n$ and $dT(i) > dT(j) > dT(k)$. $Tr(20) = 14$, $Tr(100) = 5\\,772$ and $Tr(1000) = 11\\,174\\,776$.
|
||||
|
||||
Let dT(n) be the number of divisors of T(n). E.g.: T(7) = 28 and dT(7) = 6.
|
||||
|
||||
Let Tr(n) be the number of triples (i, j, k) such that 1 ≤ i < j < k ≤ n and dT(i) > dT(j) > dT(k). Tr(20) = 14, Tr(100) = 5772 and Tr(1000) = 11174776.
|
||||
|
||||
Find Tr(60 000 000). Give the last 18 digits of your answer.
|
||||
Find $Tr(60\\,000\\,000)$. Give the last 18 digits of your answer.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler378()` should return 147534623725724700.
|
||||
`triangleTriples()` should return `147534623725724700`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler378(), 147534623725724700);
|
||||
assert.strictEqual(triangleTriples(), 147534623725724700);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -33,12 +29,12 @@ assert.strictEqual(euler378(), 147534623725724700);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler378() {
|
||||
function triangleTriples() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler378();
|
||||
triangleTriples();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -8,20 +8,20 @@ dashedName: problem-379-least-common-multiple-count
|
||||
|
||||
# --description--
|
||||
|
||||
Let f(n) be the number of couples (x,y) with x and y positive integers, x ≤ y and the least common multiple of x and y equal to n.
|
||||
Let $f(n)$ be the number of couples ($x$, $y$) with $x$ and $y$ positive integers, $x ≤ y$ and the least common multiple of $x$ and $y$ equal to $n$.
|
||||
|
||||
Let g be the summatory function of f, i.e.: g(n) = ∑ f(i) for 1 ≤ i ≤ n.
|
||||
Let $g$ be the summatory function of $f$, i.e.: $g(n) = \sum f(i)$ for $1 ≤ i ≤ n$.
|
||||
|
||||
You are given that g(106) = 37429395.
|
||||
You are given that $g({10}^6) = 37\\,429\\,395$.
|
||||
|
||||
Find g(1012).
|
||||
Find $g({10}^{12})$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler379()` should return 132314136838185.
|
||||
`leastCommonMultipleCount()` should return `132314136838185`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler379(), 132314136838185);
|
||||
assert.strictEqual(leastCommonMultipleCount(), 132314136838185);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -29,12 +29,12 @@ assert.strictEqual(euler379(), 132314136838185);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler379() {
|
||||
function leastCommonMultipleCount() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler379();
|
||||
leastCommonMultipleCount();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -8,20 +8,30 @@ dashedName: problem-380-amazing-mazes
|
||||
|
||||
# --description--
|
||||
|
||||
An m×n maze is an m×n rectangular grid with walls placed between grid cells such that there is exactly one path from the top-left square to any other square. The following are examples of a 9×12 maze and a 15×20 maze:
|
||||
An $m×n$ maze is an $m×n$ rectangular grid with walls placed between grid cells such that there is exactly one path from the top-left square to any other square. The following are examples of a 9×12 maze and a 15×20 maze:
|
||||
|
||||
Let C(m,n) be the number of distinct m×n mazes. Mazes which can be formed by rotation and reflection from another maze are considered distinct.
|
||||
<img class="img-responsive center-block" alt="9x12 maze and 15x20 maze" src="https://cdn.freecodecamp.org/curriculum/project-euler/amazing-mazes.gif" style="background-color: white; padding: 10px;">
|
||||
|
||||
It can be verified that C(1,1) = 1, C(2,2) = 4, C(3,4) = 2415, and C(9,12) = 2.5720e46 (in scientific notation rounded to 5 significant digits). Find C(100,500) and write your answer in scientific notation rounded to 5 significant digits.
|
||||
Let $C(m, n)$ be the number of distinct $m×n$ mazes. Mazes which can be formed by rotation and reflection from another maze are considered distinct.
|
||||
|
||||
When giving your answer, use a lowercase e to separate mantissa and exponent. E.g. if the answer is 1234567891011 then the answer format would be 1.2346e12.
|
||||
It can be verified that $C(1, 1) = 1$, $C(2, 2) = 4$, $C(3, 4) = 2415$, and $C(9, 12) = 2.5720\mathrm{e}\\,46$ (in scientific notation rounded to 5 significant digits).
|
||||
|
||||
Find $C(100, 500)$ and write your answer as a string in scientific notation rounded to 5 significant digits.
|
||||
|
||||
When giving your answer, use a lowercase e to separate mantissa and exponent. E.g. if the answer is 1234567891011 then the answer format would be the string `1.2346e12`.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler380()` should return Infinity.
|
||||
`amazingMazes()` should return a string.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler380(), Infinity);
|
||||
assert(typeof amazingMazes() === 'string');
|
||||
```
|
||||
|
||||
`amazingMazes()` should return the string `6.3202e25093`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(amazingMazes(), '6.3202e25093');
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -29,12 +39,12 @@ assert.strictEqual(euler380(), Infinity);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler380() {
|
||||
function amazingMazes() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler380();
|
||||
amazingMazes();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
Reference in New Issue
Block a user