id
int32 | title
string | problem
string | question_latex
string | question_html
string | numerical_answer
string | pub_date
string | solved_by
string | diff_rate
string | difficulty
string |
---|---|---|---|---|---|---|---|---|---|
630 | Crossed Lines | Given a set, $L$, of unique lines, let $M(L)$ be the number of lines in the set and let $S(L)$ be the sum over every line of the number of times that line is crossed by another line in the set. For example, two sets of three lines are shown below:
In both cases $M(L)$ is $3$ and $S(L)$ is $6$: each of the three lines is crossed by two other lines. Note that even if the lines cross at a single point, all of the separate crossings of lines are counted.
Consider points $(T_{2k-1}, T_{2k})$, for integer $k \ge 1$, generated in the following way:
$S_0 = 290797$
$S_{n+1} = S_n^2 \bmod 50515093$
$T_n = (S_n \bmod 2000) - 1000$
For example, the first three points are: $(527, 144)$, $(-488, 732)$, $(-454, -947)$. Given the first $n$ points generated in this manner, let $L_n$ be the set of unique lines that can be formed by joining each point with every other point, the lines being extended indefinitely in both directions. We can then define $M(L_n)$ and $S(L_n)$ as described above.
For example, $M(L_3) = 3$ and $S(L_3) = 6$. Also $M(L_{100}) = 4948$ and $S(L_{100}) = 24477690$.
Find $S(L_{2500})$. | Given a set, $L$, of unique lines, let $M(L)$ be the number of lines in the set and let $S(L)$ be the sum over every line of the number of times that line is crossed by another line in the set. For example, two sets of three lines are shown below:
In both cases $M(L)$ is $3$ and $S(L)$ is $6$: each of the three lines is crossed by two other lines. Note that even if the lines cross at a single point, all of the separate crossings of lines are counted.
Consider points $(T_{2k-1}, T_{2k})$, for integer $k \ge 1$, generated in the following way:
$S_0 = 290797$
$S_{n+1} = S_n^2 \bmod 50515093$
$T_n = (S_n \bmod 2000) - 1000$
For example, the first three points are: $(527, 144)$, $(-488, 732)$, $(-454, -947)$. Given the first $n$ points generated in this manner, let $L_n$ be the set of unique lines that can be formed by joining each point with every other point, the lines being extended indefinitely in both directions. We can then define $M(L_n)$ and $S(L_n)$ as described above.
For example, $M(L_3) = 3$ and $S(L_3) = 6$. Also $M(L_{100}) = 4948$ and $S(L_{100}) = 24477690$.
Find $S(L_{2500})$. | <p>
Given a set, $L$, of unique lines, let $M(L)$ be the number of lines in the set and let $S(L)$ be the sum over every line of the number of times that line is crossed by another line in the set. For example, two sets of three lines are shown below:
</p>
<div align="center"><img alt="crossed lines" src="resources/images/0630_threelines.png?1678992054"/></div>
<p>
In both cases $M(L)$ is $3$ and $S(L)$ is $6$: each of the three lines is crossed by two other lines. Note that even if the lines cross at a single point, all of the separate crossings of lines are counted.
</p>
<p>
Consider points $(T_{2k-1}, T_{2k})$, for integer $k \ge 1$, generated in the following way:
</p>
<p>
$S_0 = 290797$<br/>
$S_{n+1} = S_n^2 \bmod 50515093$<br/>
$T_n = (S_n \bmod 2000) - 1000$
</p>
<p>
For example, the first three points are: $(527, 144)$, $(-488, 732)$, $(-454, -947)$. Given the first $n$ points generated in this manner, let $L_n$ be the set of <b>unique</b> lines that can be formed by joining each point with every other point, the lines being extended indefinitely in both directions. We can then define $M(L_n)$ and $S(L_n)$ as described above.
</p>
<p>
For example, $M(L_3) = 3$ and $S(L_3) = 6$. Also $M(L_{100}) = 4948$ and $S(L_{100}) = 24477690$.
</p><p>
Find $S(L_{2500})$.
</p> | 9669182880384 | Sunday, 1st July 2018, 07:00 am | 1128 | 20% | easy |
403 | Lattice Points Enclosed by Parabola and Line | For integers $a$ and $b$, we define $D(a, b)$ as the domain enclosed by the parabola $y = x^2$ and the line $y = a\cdot x + b$:$D(a, b) = \{(x, y) \mid x^2 \leq y \leq a\cdot x + b \}$.
$L(a, b)$ is defined as the number of lattice points contained in $D(a, b)$.
For example, $L(1, 2) = 8$ and $L(2, -1) = 1$.
We also define $S(N)$ as the sum of $L(a, b)$ for all the pairs $(a, b)$ such that the area of $D(a, b)$ is a rational number and $|a|,|b| \leq N$.
We can verify that $S(5) = 344$ and $S(100) = 26709528$.
Find $S(10^{12})$. Give your answer mod $10^8$. | For integers $a$ and $b$, we define $D(a, b)$ as the domain enclosed by the parabola $y = x^2$ and the line $y = a\cdot x + b$:$D(a, b) = \{(x, y) \mid x^2 \leq y \leq a\cdot x + b \}$.
$L(a, b)$ is defined as the number of lattice points contained in $D(a, b)$.
For example, $L(1, 2) = 8$ and $L(2, -1) = 1$.
We also define $S(N)$ as the sum of $L(a, b)$ for all the pairs $(a, b)$ such that the area of $D(a, b)$ is a rational number and $|a|,|b| \leq N$.
We can verify that $S(5) = 344$ and $S(100) = 26709528$.
Find $S(10^{12})$. Give your answer mod $10^8$. | <p>
For integers $a$ and $b$, we define $D(a, b)$ as the domain enclosed by the parabola $y = x^2$ and the line $y = a\cdot x + b$:<br/>$D(a, b) = \{(x, y) \mid x^2 \leq y \leq a\cdot x + b \}$.
</p>
<p>
$L(a, b)$ is defined as the number of lattice points contained in $D(a, b)$.<br/>
For example, $L(1, 2) = 8$ and $L(2, -1) = 1$.
</p>
<p>
We also define $S(N)$ as the sum of $L(a, b)$ for all the pairs $(a, b)$ such that the area of $D(a, b)$ is a rational number and $|a|,|b| \leq N$.<br/>
We can verify that $S(5) = 344$ and $S(100) = 26709528$.
</p>
<p>
Find $S(10^{12})$. Give your answer mod $10^8$.
</p> | 18224771 | Saturday, 24th November 2012, 10:00 pm | 398 | 55% | medium |
15 | Lattice Paths | Starting in the top left corner of a $2 \times 2$ grid, and only being able to move to the right and down, there are exactly $6$ routes to the bottom right corner.
How many such routes are there through a $20 \times 20$ grid? | Starting in the top left corner of a $2 \times 2$ grid, and only being able to move to the right and down, there are exactly $6$ routes to the bottom right corner.
How many such routes are there through a $20 \times 20$ grid? | <p>Starting in the top left corner of a $2 \times 2$ grid, and only being able to move to the right and down, there are exactly $6$ routes to the bottom right corner.</p>
<div class="center">
<img alt="" class="dark_img" src="resources/images/0015.png?1678992052"/></div>
<p>How many such routes are there through a $20 \times 20$ grid?</p> | 137846528820 | Friday, 19th April 2002, 06:00 pm | 202032 | 5% | easy |
559 | Permuted Matrices | An ascent of a column $j$ in a matrix occurs if the value of column $j$ is smaller than the value of column $j + 1$ in all rows.
Let $P(k, r, n)$ be the number of $r \times n$ matrices with the following properties:
The rows are permutations of $\{1, 2, 3, \dots, n\}$.
Numbering the first column as $1$, a column ascent occurs at column $j \lt n$ if and only if $j$ is not a multiple of $k$.
For example, $P(1, 2, 3) = 19$, $P(2, 4, 6) = 65508751$ and $P(7, 5, 30) \bmod 1000000123 = 161858102$.
Let $Q(n) = \displaystyle \sum_{k=1}^n P(k, n, n)$.
For example, $Q(5) = 21879393751$ and $Q(50) \bmod 1000000123 = 819573537$.
Find $Q(50000) \bmod 1000000123$. | An ascent of a column $j$ in a matrix occurs if the value of column $j$ is smaller than the value of column $j + 1$ in all rows.
Let $P(k, r, n)$ be the number of $r \times n$ matrices with the following properties:
The rows are permutations of $\{1, 2, 3, \dots, n\}$.
Numbering the first column as $1$, a column ascent occurs at column $j \lt n$ if and only if $j$ is not a multiple of $k$.
For example, $P(1, 2, 3) = 19$, $P(2, 4, 6) = 65508751$ and $P(7, 5, 30) \bmod 1000000123 = 161858102$.
Let $Q(n) = \displaystyle \sum_{k=1}^n P(k, n, n)$.
For example, $Q(5) = 21879393751$ and $Q(50) \bmod 1000000123 = 819573537$.
Find $Q(50000) \bmod 1000000123$. | <p>An <dfn>ascent</dfn> of a column $j$ in a matrix occurs if the value of column $j$ is smaller than the value of column $j + 1$ in all rows.
</p><p>
Let $P(k, r, n)$ be the number of $r \times n$ matrices with the following properties:</p>
<ul><li>The rows are permutations of $\{1, 2, 3, \dots, n\}$.</li>
<li> Numbering the first column as $1$, a column ascent occurs at column $j \lt n$ <b>if and only if</b> $j$ is not a multiple of $k$.</li>
</ul><p>For example, $P(1, 2, 3) = 19$, $P(2, 4, 6) = 65508751$ and $P(7, 5, 30) \bmod 1000000123 = 161858102$.</p>
Let $Q(n) = \displaystyle \sum_{k=1}^n P(k, n, n)$.<br/>
For example, $Q(5) = 21879393751$ and $Q(50) \bmod 1000000123 = 819573537$.
<p>Find $Q(50000) \bmod 1000000123$.</p> | 684724920 | Saturday, 7th May 2016, 04:00 pm | 211 | 100% | hard |
427 | $n$-sequences | A sequence of integers $S = \{s_i\}$ is called an $n$-sequence if it has $n$ elements and each element $s_i$ satisfies $1 \leq s_i \leq n$. Thus there are $n^n$ distinct $n$-sequences in total.
For example, the sequence $S = \{1, 5, 5, 10, 7, 7, 7, 2, 3, 7\}$ is a $10$-sequence.
For any sequence $S$, let $L(S)$ be the length of the longest contiguous subsequence of $S$ with the same value.
For example, for the given sequence $S$ above, $L(S) = 3$, because of the three consecutive $7$'s.
Let $f(n) = \sum L(S)$ for all $n$-sequences S.
For example, $f(3) = 45$, $f(7) = 1403689$ and $f(11) = 481496895121$.
Find $f(7\,500\,000) \bmod 1\,000\,000\,009$. | A sequence of integers $S = \{s_i\}$ is called an $n$-sequence if it has $n$ elements and each element $s_i$ satisfies $1 \leq s_i \leq n$. Thus there are $n^n$ distinct $n$-sequences in total.
For example, the sequence $S = \{1, 5, 5, 10, 7, 7, 7, 2, 3, 7\}$ is a $10$-sequence.
For any sequence $S$, let $L(S)$ be the length of the longest contiguous subsequence of $S$ with the same value.
For example, for the given sequence $S$ above, $L(S) = 3$, because of the three consecutive $7$'s.
Let $f(n) = \sum L(S)$ for all $n$-sequences S.
For example, $f(3) = 45$, $f(7) = 1403689$ and $f(11) = 481496895121$.
Find $f(7\,500\,000) \bmod 1\,000\,000\,009$. | <p>A sequence of integers $S = \{s_i\}$ is called an $n$-sequence if it has $n$ elements and each element $s_i$ satisfies $1 \leq s_i \leq n$. Thus there are $n^n$ distinct $n$-sequences in total.
For example, the sequence $S = \{1, 5, 5, 10, 7, 7, 7, 2, 3, 7\}$ is a $10$-sequence.</p>
<p>For any sequence $S$, let $L(S)$ be the length of the longest contiguous subsequence of $S$ with the same value.
For example, for the given sequence $S$ above, $L(S) = 3$, because of the three consecutive $7$'s.</p>
<p>Let $f(n) = \sum L(S)$ for all $n$-sequences S.</p>
<p>For example, $f(3) = 45$, $f(7) = 1403689$ and $f(11) = 481496895121$.</p>
<p>Find $f(7\,500\,000) \bmod 1\,000\,000\,009$.</p> | 97138867 | Saturday, 11th May 2013, 10:00 pm | 352 | 95% | hard |
341 | Golomb's Self-describing Sequence | The Golomb's self-describing sequence $(G(n))$ is the only nondecreasing sequence of natural numbers such that $n$ appears exactly $G(n)$ times in the sequence. The values of $G(n)$ for the first few $n$ are
\[
\begin{matrix}
n & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & \ldots \\
G(n) & 1 & 2 & 2 & 3 & 3 & 4 & 4 & 4 & 5 & 5 & 5 & 6 & 6 & 6 & 6 & \ldots
\end{matrix}
\]
You are given that $G(10^3) = 86$, $G(10^6) = 6137$.
You are also given that $\sum G(n^3) = 153506976$ for $1 \le n \lt 10^3$.
Find $\sum G(n^3)$ for $1 \le n \lt 10^6$. | The Golomb's self-describing sequence $(G(n))$ is the only nondecreasing sequence of natural numbers such that $n$ appears exactly $G(n)$ times in the sequence. The values of $G(n)$ for the first few $n$ are
\[
\begin{matrix}
n & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & \ldots \\
G(n) & 1 & 2 & 2 & 3 & 3 & 4 & 4 & 4 & 5 & 5 & 5 & 6 & 6 & 6 & 6 & \ldots
\end{matrix}
\]
You are given that $G(10^3) = 86$, $G(10^6) = 6137$.
You are also given that $\sum G(n^3) = 153506976$ for $1 \le n \lt 10^3$.
Find $\sum G(n^3)$ for $1 \le n \lt 10^6$. | <p>The <b>Golomb's self-describing sequence</b> $(G(n))$ is the only nondecreasing sequence of natural numbers such that $n$ appears exactly $G(n)$ times in the sequence. The values of $G(n)$ for the first few $n$ are</p>
<p></p><div align="center">
\[
\begin{matrix}
n & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & \ldots \\
G(n) & 1 & 2 & 2 & 3 & 3 & 4 & 4 & 4 & 5 & 5 & 5 & 6 & 6 & 6 & 6 & \ldots
\end{matrix}
\]
</div>
<p>You are given that $G(10^3) = 86$, $G(10^6) = 6137$.<br>
You are also given that $\sum G(n^3) = 153506976$ for $1 \le n \lt 10^3$.</br></p>
<p>Find $\sum G(n^3)$ for $1 \le n \lt 10^6$.</p> | 56098610614277014 | Sunday, 5th June 2011, 10:00 am | 1041 | 45% | medium |
177 | Integer Angled Quadrilaterals | Let $ABCD$ be a convex quadrilateral, with diagonals $AC$ and $BD$. At each vertex the diagonal makes an angle with each of the two sides, creating eight corner angles.
For example, at vertex $A$, the two angles are $CAD$, $CAB$.
We call such a quadrilateral for which all eight corner angles have integer values when measured in degrees an "integer angled quadrilateral". An example of an integer angled quadrilateral is a square, where all eight corner angles are $45^\circ$. Another example is given by $DAC = 20^\circ$, $BAC = 60^\circ$, $ABD = 50^\circ$, $CBD = 30^\circ$, $BCA = 40^\circ$, $DCA = 30^\circ$, $CDB = 80^\circ$, $ADB = 50^\circ$.
What is the total number of non-similar integer angled quadrilaterals?
Note: In your calculations you may assume that a calculated angle is integral if it is within a tolerance of $10^{-9}$ of an integer value. | Let $ABCD$ be a convex quadrilateral, with diagonals $AC$ and $BD$. At each vertex the diagonal makes an angle with each of the two sides, creating eight corner angles.
For example, at vertex $A$, the two angles are $CAD$, $CAB$.
We call such a quadrilateral for which all eight corner angles have integer values when measured in degrees an "integer angled quadrilateral". An example of an integer angled quadrilateral is a square, where all eight corner angles are $45^\circ$. Another example is given by $DAC = 20^\circ$, $BAC = 60^\circ$, $ABD = 50^\circ$, $CBD = 30^\circ$, $BCA = 40^\circ$, $DCA = 30^\circ$, $CDB = 80^\circ$, $ADB = 50^\circ$.
What is the total number of non-similar integer angled quadrilaterals?
Note: In your calculations you may assume that a calculated angle is integral if it is within a tolerance of $10^{-9}$ of an integer value. | <p>Let $ABCD$ be a convex quadrilateral, with diagonals $AC$ and $BD$. At each vertex the diagonal makes an angle with each of the two sides, creating eight corner angles.</p>
<p style="text-align:center;"><img alt="" class="dark_img" src="resources/images/0177_quad.gif?1678992055"/></p>
<p>For example, at vertex $A$, the two angles are $CAD$, $CAB$.</p>
<p>We call such a quadrilateral for which all eight corner angles have integer values when measured in degrees an "integer angled quadrilateral". An example of an integer angled quadrilateral is a square, where all eight corner angles are $45^\circ$. Another example is given by $DAC = 20^\circ$, $BAC = 60^\circ$, $ABD = 50^\circ$, $CBD = 30^\circ$, $BCA = 40^\circ$, $DCA = 30^\circ$, $CDB = 80^\circ$, $ADB = 50^\circ$.</p>
<p>What is the total number of non-similar integer angled quadrilaterals?</p>
<p>Note: In your calculations you may assume that a calculated angle is integral if it is within a tolerance of $10^{-9}$ of an integer value.</p> | 129325 | Friday, 11th January 2008, 09:00 pm | 1463 | 80% | hard |
174 | Hollow Square Laminae II | We shall define a square lamina to be a square outline with a square "hole" so that the shape possesses vertical and horizontal symmetry.
Given eight tiles it is possible to form a lamina in only one way: $3 \times 3$ square with a $1 \times 1$ hole in the middle. However, using thirty-two tiles it is possible to form two distinct laminae.
If t represents the number of tiles used, we shall say that $t = 8$ is type $L(1)$ and $t = 32$ is type $L(2)$.
Let $N(n)$ be the number of $t \le 1000000$ such that $t$ is type $L(n)$; for example, $N(15) = 832$.
What is $\sum\limits_{n = 1}^{10} N(n)$? | We shall define a square lamina to be a square outline with a square "hole" so that the shape possesses vertical and horizontal symmetry.
Given eight tiles it is possible to form a lamina in only one way: $3 \times 3$ square with a $1 \times 1$ hole in the middle. However, using thirty-two tiles it is possible to form two distinct laminae.
If t represents the number of tiles used, we shall say that $t = 8$ is type $L(1)$ and $t = 32$ is type $L(2)$.
Let $N(n)$ be the number of $t \le 1000000$ such that $t$ is type $L(n)$; for example, $N(15) = 832$.
What is $\sum\limits_{n = 1}^{10} N(n)$? | <p>We shall define a square lamina to be a square outline with a square "hole" so that the shape possesses vertical and horizontal symmetry.</p>
<p>Given eight tiles it is possible to form a lamina in only one way: $3 \times 3$ square with a $1 \times 1$ hole in the middle. However, using thirty-two tiles it is possible to form two distinct laminae.</p>
<div class="center">
<img alt="" src="resources/images/0173_square_laminas.gif?1678992055"/></div>
<p>If <var>t</var> represents the number of tiles used, we shall say that $t = 8$ is type $L(1)$ and $t = 32$ is type $L(2)$.</p>
<p>Let $N(n)$ be the number of $t \le 1000000$ such that $t$ is type $L(n)$; for example, $N(15) = 832$.</p>
<p>What is $\sum\limits_{n = 1}^{10} N(n)$?</p> | 209566 | Saturday, 22nd December 2007, 01:00 pm | 6507 | 40% | medium |
489 | Common Factors Between Two Sequences | Let $G(a, b)$ be the smallest non-negative integer $n$ for which $\operatorname{\mathbf{gcd}}$Greatest common divisor$(n^3 + b, (n + a)^3 + b)$ is maximized.
For example, $G(1, 1) = 5$ because $\gcd(n^3 + 1, (n + 1)^3 + 1)$ reaches its maximum value of $7$ for $n = 5$, and is smaller for $0 \le n \lt 5$.
Let $H(m, n) = \sum G(a, b)$ for $1 \le a \le m$, $1 \le b \le n$.
You are given $H(5, 5) = 128878$ and $H(10, 10) = 32936544$.
Find $H(18, 1900)$. | Let $G(a, b)$ be the smallest non-negative integer $n$ for which $\operatorname{\mathbf{gcd}}$Greatest common divisor$(n^3 + b, (n + a)^3 + b)$ is maximized.
For example, $G(1, 1) = 5$ because $\gcd(n^3 + 1, (n + 1)^3 + 1)$ reaches its maximum value of $7$ for $n = 5$, and is smaller for $0 \le n \lt 5$.
Let $H(m, n) = \sum G(a, b)$ for $1 \le a \le m$, $1 \le b \le n$.
You are given $H(5, 5) = 128878$ and $H(10, 10) = 32936544$.
Find $H(18, 1900)$. | <p>Let $G(a, b)$ be the smallest non-negative integer $n$ for which <strong class="tooltip">$\operatorname{\mathbf{gcd}}$<span class="tooltiptext">Greatest common divisor</span></strong>$(n^3 + b, (n + a)^3 + b)$ is maximized.<br/>
For example, $G(1, 1) = 5$ because $\gcd(n^3 + 1, (n + 1)^3 + 1)$ reaches its maximum value of $7$ for $n = 5$, and is smaller for $0 \le n \lt 5$.<br/>
Let $H(m, n) = \sum G(a, b)$ for $1 \le a \le m$, $1 \le b \le n$.<br/>
You are given $H(5, 5) = 128878$ and $H(10, 10) = 32936544$.
</p><p>Find $H(18, 1900)$.</p> | 1791954757162 | Sunday, 16th November 2014, 04:00 am | 281 | 100% | hard |
532 | Nanobots on Geodesics | Bob is a manufacturer of nanobots and wants to impress his customers by giving them a ball coloured by his new nanobots as a present.
His nanobots can be programmed to select and locate exactly one other bot precisely and, after activation, move towards this bot along the shortest possible path and draw a coloured line onto the surface while moving. Placed on a plane, the bots will start to move towards their selected bots in a straight line. In contrast, being placed on a ball, they will start to move along a geodesic as the shortest possible path. However, in both cases, whenever their target moves they will adjust their direction instantaneously to the new shortest possible path. All bots will move at the same speed after their simultaneous activation until each bot reaches its goal.
Now Bob places $n$ bots on the ball (with radius $1$) equidistantly on a small circle with radius $0.999$ and programs each of them to move toward the next nanobot sitting counterclockwise on that small circle. After activation, the bots move in a sort of spiral until they finally meet at one point on the ball.
Using three bots, Bob finds that every bot will draw a line of length $2.84$, resulting in a total length of $8.52$ for all three bots, each time rounded to two decimal places. The coloured ball looks like this:
In order to show off a little with his presents, Bob decides to use just enough bots to make sure that the line each bot draws is longer than $1000$. What is the total length of all lines drawn with this number of bots, rounded to two decimal places? | Bob is a manufacturer of nanobots and wants to impress his customers by giving them a ball coloured by his new nanobots as a present.
His nanobots can be programmed to select and locate exactly one other bot precisely and, after activation, move towards this bot along the shortest possible path and draw a coloured line onto the surface while moving. Placed on a plane, the bots will start to move towards their selected bots in a straight line. In contrast, being placed on a ball, they will start to move along a geodesic as the shortest possible path. However, in both cases, whenever their target moves they will adjust their direction instantaneously to the new shortest possible path. All bots will move at the same speed after their simultaneous activation until each bot reaches its goal.
Now Bob places $n$ bots on the ball (with radius $1$) equidistantly on a small circle with radius $0.999$ and programs each of them to move toward the next nanobot sitting counterclockwise on that small circle. After activation, the bots move in a sort of spiral until they finally meet at one point on the ball.
Using three bots, Bob finds that every bot will draw a line of length $2.84$, resulting in a total length of $8.52$ for all three bots, each time rounded to two decimal places. The coloured ball looks like this:
In order to show off a little with his presents, Bob decides to use just enough bots to make sure that the line each bot draws is longer than $1000$. What is the total length of all lines drawn with this number of bots, rounded to two decimal places? | <p>Bob is a manufacturer of nanobots and wants to impress his customers by giving them a ball coloured by his new nanobots as a present.</p>
<p>His nanobots can be programmed to select and locate exactly one other bot precisely and, after activation, move towards this bot along the shortest possible path and draw a coloured line onto the surface while moving. Placed on a plane, the bots will start to move towards their selected bots in a straight line. In contrast, being placed on a ball, they will start to move along a geodesic as the shortest possible path. However, in both cases, whenever their target moves they will adjust their direction instantaneously to the new shortest possible path. All bots will move at the same speed after their simultaneous activation until each bot reaches its goal.</p>
<p>Now Bob places $n$ bots on the ball (with radius $1$) equidistantly on a small circle with radius $0.999$ and programs each of them to move toward the next nanobot sitting counterclockwise on that small circle. After activation, the bots move in a sort of spiral until they finally meet at one point on the ball.</p>
<p>Using three bots, Bob finds that every bot will draw a line of length $2.84$, resulting in a total length of $8.52$ for all three bots, each time rounded to two decimal places. The coloured ball looks like this:</p>
<div align="center"><img alt="0532-nanobots.jpg" src="resources/images/0532-nanobots.jpg?1678992054"/></div>
<p>In order to show off a little with his presents, Bob decides to use just enough bots to make sure that the line each bot draws is longer than $1000$. What is the total length of all lines drawn with this number of bots, rounded to two decimal places?</p> | 827306.56 | Sunday, 1st November 2015, 07:00 am | 336 | 55% | medium |
418 | Factorisation Triples | Let $n$ be a positive integer. An integer triple $(a, b, c)$ is called a factorisation triple of $n$ if:$1 \leq a \leq b \leq c$$a \cdot b \cdot c = n$.
Define $f(n)$ to be $a + b + c$ for the factorisation triple $(a, b, c)$ of $n$ which minimises $c / a$. One can show that this triple is unique.
For example, $f(165) = 19$, $f(100100) = 142$ and $f(20!) = 4034872$.
Find $f(43!)$. | Let $n$ be a positive integer. An integer triple $(a, b, c)$ is called a factorisation triple of $n$ if:$1 \leq a \leq b \leq c$$a \cdot b \cdot c = n$.
Define $f(n)$ to be $a + b + c$ for the factorisation triple $(a, b, c)$ of $n$ which minimises $c / a$. One can show that this triple is unique.
For example, $f(165) = 19$, $f(100100) = 142$ and $f(20!) = 4034872$.
Find $f(43!)$. | <p>
Let $n$ be a positive integer. An integer triple $(a, b, c)$ is called a <dfn>factorisation triple</dfn> of $n$ if:</p><ul><li>$1 \leq a \leq b \leq c$</li><li>$a \cdot b \cdot c = n$.
</li></ul><p>
Define $f(n)$ to be $a + b + c$ for the factorisation triple $(a, b, c)$ of $n$ which minimises $c / a$. One can show that this triple is unique.
</p>
<p>
For example, $f(165) = 19$, $f(100100) = 142$ and $f(20!) = 4034872$.
</p>
<p>
Find $f(43!)$.
</p> | 1177163565297340320 | Saturday, 9th March 2013, 07:00 pm | 758 | 40% | medium |
620 | Planetary Gears | A circle $C$ of circumference $c$ centimetres has a smaller circle $S$ of circumference $s$ centimetres lying off-centre within it. Four other distinct circles, which we call "planets", with circumferences $p$, $p$, $q$, $q$ centimetres respectively ($p<q$), are inscribed within $C$ but outside $S$, with each planet touching both $C$ and $S$ tangentially. The planets are permitted to overlap one another, but the boundaries of $S$ and $C$ must be at least 1cm apart at their closest point.
Now suppose that these circles are actually gears with perfectly meshing teeth at a pitch of 1cm. $C$ is an internal gear with teeth on the inside. We require that $c$, $s$, $p$, $q$ are all integers (as they are the numbers of teeth), and we further stipulate that any gear must have at least 5 teeth.
Note that "perfectly meshing" means that as the gears rotate, the ratio between their angular velocities remains constant, and the teeth of one gear perfectly align with the groves of the other gear and vice versa. Only for certain gear sizes and positions will it be possible for $S$ and $C$ each to mesh perfectly with all the planets. Arrangements where not all gears mesh perfectly are not valid.
Define $g(c,s,p,q)$ to be the number of such gear arrangements for given values of $c$, $s$, $p$, $q$: it turns out that this is finite as only certain discrete arrangements are possible satisfying the above conditions. For example, $g(16,5,5,6)=9$.
Here is one such arrangement:
Let $G(n) = \sum_{s+p+q\le n} g(s+p+q,s,p,q)$ where the sum only includes cases with $p<q$, $p\ge 5$, and $s\ge 5$, all integers. You are given that $G(16)=9$ and $G(20)=205$.
Find $G(500)$. | A circle $C$ of circumference $c$ centimetres has a smaller circle $S$ of circumference $s$ centimetres lying off-centre within it. Four other distinct circles, which we call "planets", with circumferences $p$, $p$, $q$, $q$ centimetres respectively ($p<q$), are inscribed within $C$ but outside $S$, with each planet touching both $C$ and $S$ tangentially. The planets are permitted to overlap one another, but the boundaries of $S$ and $C$ must be at least 1cm apart at their closest point.
Now suppose that these circles are actually gears with perfectly meshing teeth at a pitch of 1cm. $C$ is an internal gear with teeth on the inside. We require that $c$, $s$, $p$, $q$ are all integers (as they are the numbers of teeth), and we further stipulate that any gear must have at least 5 teeth.
Note that "perfectly meshing" means that as the gears rotate, the ratio between their angular velocities remains constant, and the teeth of one gear perfectly align with the groves of the other gear and vice versa. Only for certain gear sizes and positions will it be possible for $S$ and $C$ each to mesh perfectly with all the planets. Arrangements where not all gears mesh perfectly are not valid.
Define $g(c,s,p,q)$ to be the number of such gear arrangements for given values of $c$, $s$, $p$, $q$: it turns out that this is finite as only certain discrete arrangements are possible satisfying the above conditions. For example, $g(16,5,5,6)=9$.
Here is one such arrangement:
Let $G(n) = \sum_{s+p+q\le n} g(s+p+q,s,p,q)$ where the sum only includes cases with $p<q$, $p\ge 5$, and $s\ge 5$, all integers. You are given that $G(16)=9$ and $G(20)=205$.
Find $G(500)$. | <p>A circle $C$ of circumference $c$ centimetres has a smaller circle $S$ of circumference $s$ centimetres lying off-centre within it. Four other distinct circles, which we call "planets", with circumferences $p$, $p$, $q$, $q$ centimetres respectively ($p<q$), are inscribed within $C$ but outside $S$, with each planet touching both $C$ and $S$ tangentially. The planets are permitted to overlap one another, but the boundaries of $S$ and $C$ must be at least 1cm apart at their closest point.</p>
<p>Now suppose that these circles are actually gears with perfectly meshing teeth at a pitch of 1cm. $C$ is an internal gear with teeth on the inside. We require that $c$, $s$, $p$, $q$ are all integers (as they are the numbers of teeth), and we further stipulate that any gear must have at least 5 teeth.</p>
<p>Note that "perfectly meshing" means that as the gears rotate, the ratio between their angular velocities remains constant, and the teeth of one gear perfectly align with the groves of the other gear and vice versa. Only for certain gear sizes and positions will it be possible for $S$ and $C$ each to mesh perfectly with all the planets. Arrangements where not all gears mesh perfectly are not valid.</p>
<p>Define $g(c,s,p,q)$ to be the number of such gear arrangements for given values of $c$, $s$, $p$, $q$: it turns out that this is finite as only certain discrete arrangements are possible satisfying the above conditions. For example, $g(16,5,5,6)=9$.</p>
<p>Here is one such arrangement:</p>
<div align="center"><img alt="Example arrangement" src="project/images/p620_planetary_gears.png"/></div>
<p>Let $G(n) = \sum_{s+p+q\le n} g(s+p+q,s,p,q)$ where the sum only includes cases with $p<q$, $p\ge 5$, and $s\ge 5$, all integers. You are given that $G(16)=9$ and $G(20)=205$.</p>
<p>Find $G(500)$.</p> | 1470337306 | Sunday, 11th February 2018, 01:00 am | 185 | 80% | hard |
160 | Factorial Trailing Digits | For any $N$, let $f(N)$ be the last five digits before the trailing zeroes in $N!$.
For example,
$9! = 362880$ so $f(9)=36288$
$10! = 3628800$ so $f(10)=36288$
$20! = 2432902008176640000$ so $f(20)=17664$
Find $f(1\,000\,000\,000\,000)$. | For any $N$, let $f(N)$ be the last five digits before the trailing zeroes in $N!$.
For example,
$9! = 362880$ so $f(9)=36288$
$10! = 3628800$ so $f(10)=36288$
$20! = 2432902008176640000$ so $f(20)=17664$
Find $f(1\,000\,000\,000\,000)$. | <p>For any $N$, let $f(N)$ be the last five digits before the trailing zeroes in $N!$.<br/>
For example,</p>
<ul style="list-style-type:none;">
<li>$9! = 362880$ so $f(9)=36288$</li>
<li>$10! = 3628800$ so $f(10)=36288$</li>
<li>$20! = 2432902008176640000$ so $f(20)=17664$</li></ul>
<p>Find $f(1\,000\,000\,000\,000)$.</p> | 16576 | Friday, 7th September 2007, 02:00 pm | 3948 | 60% | hard |
423 | Consecutive Die Throws | Let $n$ be a positive integer.
A 6-sided die is thrown $n$ times. Let $c$ be the number of pairs of consecutive throws that give the same value.
For example, if $n = 7$ and the values of the die throws are (1,1,5,6,6,6,3), then the following pairs of consecutive throws give the same value:
(1,1,5,6,6,6,3)
(1,1,5,6,6,6,3)
(1,1,5,6,6,6,3)
Therefore, $c = 3$ for (1,1,5,6,6,6,3).
Define $C(n)$ as the number of outcomes of throwing a 6-sided die $n$ times such that $c$ does not exceed $\pi(n)$.1
For example, $C(3) = 216$, $C(4) = 1290$, $C(11) = 361912500$ and $C(24) = 4727547363281250000$.
Define $S(L)$ as $\sum C(n)$ for $1 \leq n \leq L$.
For example, $S(50) \bmod 1\,000\,000\,007 = 832833871$.
Find $S(50\,000\,000) \bmod 1\,000\,000\,007$.
1 $\pi$ denotes the prime-counting function, i.e. $\pi(n)$ is the number of primes $\leq n$. | Let $n$ be a positive integer.
A 6-sided die is thrown $n$ times. Let $c$ be the number of pairs of consecutive throws that give the same value.
For example, if $n = 7$ and the values of the die throws are (1,1,5,6,6,6,3), then the following pairs of consecutive throws give the same value:
(1,1,5,6,6,6,3)
(1,1,5,6,6,6,3)
(1,1,5,6,6,6,3)
Therefore, $c = 3$ for (1,1,5,6,6,6,3).
Define $C(n)$ as the number of outcomes of throwing a 6-sided die $n$ times such that $c$ does not exceed $\pi(n)$.1
For example, $C(3) = 216$, $C(4) = 1290$, $C(11) = 361912500$ and $C(24) = 4727547363281250000$.
Define $S(L)$ as $\sum C(n)$ for $1 \leq n \leq L$.
For example, $S(50) \bmod 1\,000\,000\,007 = 832833871$.
Find $S(50\,000\,000) \bmod 1\,000\,000\,007$.
1 $\pi$ denotes the prime-counting function, i.e. $\pi(n)$ is the number of primes $\leq n$. | <p>Let $n$ be a positive integer.<br/>
A 6-sided die is thrown $n$ times. Let $c$ be the number of pairs of consecutive throws that give the same value.</p>
<p>For example, if $n = 7$ and the values of the die throws are (1,1,5,6,6,6,3), then the following pairs of consecutive throws give the same value:<br/>
(<u>1,1</u>,5,6,6,6,3)<br/>
(1,1,5,<u>6,6</u>,6,3)<br/>
(1,1,5,6,<u>6,6</u>,3)<br/>
Therefore, $c = 3$ for (1,1,5,6,6,6,3).</p>
<p>Define $C(n)$ as the number of outcomes of throwing a 6-sided die $n$ times such that $c$ does not exceed $\pi(n)$.<sup>1</sup><br/>
For example, $C(3) = 216$, $C(4) = 1290$, $C(11) = 361912500$ and $C(24) = 4727547363281250000$.</p>
<p>Define $S(L)$ as $\sum C(n)$ for $1 \leq n \leq L$.<br/>
For example, $S(50) \bmod 1\,000\,000\,007 = 832833871$.</p>
<p>Find $S(50\,000\,000) \bmod 1\,000\,000\,007$.</p>
<p> <span style="font-size:smaller;"><sup>1</sup> $\pi$ denotes the <b>prime-counting function</b>, i.e. $\pi(n)$ is the number of primes $\leq n$.</span></p> | 653972374 | Sunday, 14th April 2013, 10:00 am | 540 | 45% | medium |
9 | Special Pythagorean Triplet | A Pythagorean triplet is a set of three natural numbers, $a \lt b \lt c$, for which,
$$a^2 + b^2 = c^2.$$
For example, $3^2 + 4^2 = 9 + 16 = 25 = 5^2$.
There exists exactly one Pythagorean triplet for which $a + b + c = 1000$.Find the product $abc$. | A Pythagorean triplet is a set of three natural numbers, $a \lt b \lt c$, for which,
$$a^2 + b^2 = c^2.$$
For example, $3^2 + 4^2 = 9 + 16 = 25 = 5^2$.
There exists exactly one Pythagorean triplet for which $a + b + c = 1000$.Find the product $abc$. | <p>A Pythagorean triplet is a set of three natural numbers, $a \lt b \lt c$, for which,
$$a^2 + b^2 = c^2.$$</p>
<p>For example, $3^2 + 4^2 = 9 + 16 = 25 = 5^2$.</p>
<p>There exists exactly one Pythagorean triplet for which $a + b + c = 1000$.<br/>Find the product $abc$.</p> | 31875000 | Friday, 25th January 2002, 06:00 pm | 382130 | 5% | easy |
464 | Möbius Function and Intervals | The Möbius function, denoted $\mu(n)$, is defined as:
$\mu(n) = (-1)^{\omega(n)}$ if $n$ is squarefree (where $\omega(n)$ is the number of distinct prime factors of $n$)
$\mu(n) = 0$ if $n$ is not squarefree.
Let $P(a, b)$ be the number of integers $n$ in the interval $[a, b]$ such that $\mu(n) = 1$.
Let $N(a, b)$ be the number of integers $n$ in the interval $[a, b]$ such that $\mu(n) = -1$.
For example, $P(2,10) = 2$ and $N(2,10) = 4$.
Let $C(n)$ be the number of integer pairs $(a, b)$ such that:
$1\le a \le b \le n$,
$99 \cdot N(a, b) \le 100 \cdot P(a, b)$, and
$99 \cdot P(a, b) \le 100 \cdot N(a, b)$.
For example, $C(10) = 13$, $C(500) = 16676$ and $C(10\,000) = 20155319$.
Find $C(20\,000\,000)$. | The Möbius function, denoted $\mu(n)$, is defined as:
$\mu(n) = (-1)^{\omega(n)}$ if $n$ is squarefree (where $\omega(n)$ is the number of distinct prime factors of $n$)
$\mu(n) = 0$ if $n$ is not squarefree.
Let $P(a, b)$ be the number of integers $n$ in the interval $[a, b]$ such that $\mu(n) = 1$.
Let $N(a, b)$ be the number of integers $n$ in the interval $[a, b]$ such that $\mu(n) = -1$.
For example, $P(2,10) = 2$ and $N(2,10) = 4$.
Let $C(n)$ be the number of integer pairs $(a, b)$ such that:
$1\le a \le b \le n$,
$99 \cdot N(a, b) \le 100 \cdot P(a, b)$, and
$99 \cdot P(a, b) \le 100 \cdot N(a, b)$.
For example, $C(10) = 13$, $C(500) = 16676$ and $C(10\,000) = 20155319$.
Find $C(20\,000\,000)$. | <p>
The <strong>Möbius function</strong>, denoted $\mu(n)$, is defined as:
</p><ul><li>$\mu(n) = (-1)^{\omega(n)}$ if $n$ is squarefree (where $\omega(n)$ is the number of distinct prime factors of $n$)</li>
<li>$\mu(n) = 0$ if $n$ is not squarefree.</li>
</ul><p>
Let $P(a, b)$ be the number of integers $n$ in the interval $[a, b]$ such that $\mu(n) = 1$.<br/>
Let $N(a, b)$ be the number of integers $n$ in the interval $[a, b]$ such that $\mu(n) = -1$.<br/>
For example, $P(2,10) = 2$ and $N(2,10) = 4$.
</p>
<p>
Let $C(n)$ be the number of integer pairs $(a, b)$ such that:
</p><ul><li> $1\le a \le b \le n$,</li>
<li> $99 \cdot N(a, b) \le 100 \cdot P(a, b)$, and</li>
<li> $99 \cdot P(a, b) \le 100 \cdot N(a, b)$.</li>
</ul><p>
For example, $C(10) = 13$, $C(500) = 16676$ and $C(10\,000) = 20155319$.
</p>
<p>
Find $C(20\,000\,000)$.
</p> | 198775297232878 | Sunday, 23rd March 2014, 01:00 am | 361 | 60% | hard |
299 | Three Similar Triangles | Four points with integer coordinates are selected:$A(a, 0)$, $B(b, 0)$, $C(0, c)$ and $D(0, d)$, with $0 \lt a \lt b$ and $0 \lt c \lt d$.
Point $P$, also with integer coordinates, is chosen on the line $AC$ so that the three triangles $ABP$, $CDP$ and $BDP$ are all similarHave equal angles.
It is easy to prove that the three triangles can be similar, only if $a = c$.
So, given that $a = c$, we are looking for triplets $(a, b, d)$ such that at least one point $P$ (with integer coordinates) exists on $AC$, making the three triangles $ABP$, $CDP$ and $BDP$ all similar.
For example, if $(a, b, d)=(2,3,4)$, it can be easily verified that point $P(1,1)$ satisfies the above condition.
Note that the triplets $(2,3,4)$ and $(2,4,3)$ are considered as distinct, although point $P(1,1)$ is common for both.
If $b + d \lt 100$, there are $92$ distinct triplets $(a, b, d)$ such that point $P$ exists.
If $b + d \lt 100\,000$, there are $320471$ distinct triplets $(a, b, d)$ such that point $P$ exists.
If $b + d \lt 100\,000\,000$, how many distinct triplets $(a, b, d)$ are there such that point $P$ exists? | Four points with integer coordinates are selected:$A(a, 0)$, $B(b, 0)$, $C(0, c)$ and $D(0, d)$, with $0 \lt a \lt b$ and $0 \lt c \lt d$.
Point $P$, also with integer coordinates, is chosen on the line $AC$ so that the three triangles $ABP$, $CDP$ and $BDP$ are all similarHave equal angles.
It is easy to prove that the three triangles can be similar, only if $a = c$.
So, given that $a = c$, we are looking for triplets $(a, b, d)$ such that at least one point $P$ (with integer coordinates) exists on $AC$, making the three triangles $ABP$, $CDP$ and $BDP$ all similar.
For example, if $(a, b, d)=(2,3,4)$, it can be easily verified that point $P(1,1)$ satisfies the above condition.
Note that the triplets $(2,3,4)$ and $(2,4,3)$ are considered as distinct, although point $P(1,1)$ is common for both.
If $b + d \lt 100$, there are $92$ distinct triplets $(a, b, d)$ such that point $P$ exists.
If $b + d \lt 100\,000$, there are $320471$ distinct triplets $(a, b, d)$ such that point $P$ exists.
If $b + d \lt 100\,000\,000$, how many distinct triplets $(a, b, d)$ are there such that point $P$ exists? | <p>Four points with integer coordinates are selected:<br/>$A(a, 0)$, $B(b, 0)$, $C(0, c)$ and $D(0, d)$, with $0 \lt a \lt b$ and $0 \lt c \lt d$.<br/>
Point $P$, also with integer coordinates, is chosen on the line $AC$ so that the three triangles $ABP$, $CDP$ and $BDP$ are all <dfn class="tooltip">similar<span class="tooltiptext">Have equal angles</span></dfn>.</p>
<div align="center"><img alt="0299_ThreeSimTri.gif" class="dark_img" src="resources/images/0299_ThreeSimTri.gif?1678992056"/></div>
<p>It is easy to prove that the three triangles can be similar, only if $a = c$.</p>
<p>So, given that $a = c$, we are looking for triplets $(a, b, d)$ such that at least one point $P$ (with integer coordinates) exists on $AC$, making the three triangles $ABP$, $CDP$ and $BDP$ all similar.</p>
<p>For example, if $(a, b, d)=(2,3,4)$, it can be easily verified that point $P(1,1)$ satisfies the above condition.
Note that the triplets $(2,3,4)$ and $(2,4,3)$ are considered as distinct, although point $P(1,1)$ is common for both.</p>
<p>If $b + d \lt 100$, there are $92$ distinct triplets $(a, b, d)$ such that point $P$ exists.<br/>
If $b + d \lt 100\,000$, there are $320471$ distinct triplets $(a, b, d)$ such that point $P$ exists.</p>
<p>If $b + d \lt 100\,000\,000$, how many distinct triplets $(a, b, d)$ are there such that point $P$ exists?</p> | 549936643 | Saturday, 3rd July 2010, 01:00 am | 697 | 60% | hard |
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.
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.
What fraction of the area is not covered by circles after $10$ iterations?
Give your answer rounded to eight decimal places using the format x.xxxxxxxx . | 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.
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.
What fraction of the area is not covered by circles after $10$ iterations?
Give your answer rounded to eight decimal places using the format x.xxxxxxxx . | <p>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.</p>
<div class="center">
<img alt="" class="dark_img" src="resources/images/0199_circles_in_circles.gif?1678992055"/></div>
<p>
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.
</p>
<p>
What fraction of the area is not covered by circles after $10$ iterations?<br/>
Give your answer rounded to eight decimal places using the format x.xxxxxxxx .
</p> | 0.00396087 | Saturday, 21st June 2008, 06:00 am | 2198 | 70% | hard |
61 | Cyclical Figurate Numbers | Triangle, square, pentagonal, hexagonal, heptagonal, and octagonal numbers are all figurate (polygonal) numbers and are generated by the following formulae:
Triangle
$P_{3,n}=n(n+1)/2$
$1, 3, 6, 10, 15, \dots$
Square
$P_{4,n}=n^2$
$1, 4, 9, 16, 25, \dots$
Pentagonal
$P_{5,n}=n(3n-1)/2$
$1, 5, 12, 22, 35, \dots$
Hexagonal
$P_{6,n}=n(2n-1)$
$1, 6, 15, 28, 45, \dots$
Heptagonal
$P_{7,n}=n(5n-3)/2$
$1, 7, 18, 34, 55, \dots$
Octagonal
$P_{8,n}=n(3n-2)$
$1, 8, 21, 40, 65, \dots$
The ordered set of three $4$-digit numbers: $8128$, $2882$, $8281$, has three interesting properties.
The set is cyclic, in that the last two digits of each number is the first two digits of the next number (including the last number with the first).
Each polygonal type: triangle ($P_{3,127}=8128$), square ($P_{4,91}=8281$), and pentagonal ($P_{5,44}=2882$), is represented by a different number in the set.
This is the only set of $4$-digit numbers with this property.
Find the sum of the only ordered set of six cyclic $4$-digit numbers for which each polygonal type: triangle, square, pentagonal, hexagonal, heptagonal, and octagonal, is represented by a different number in the set. | Triangle, square, pentagonal, hexagonal, heptagonal, and octagonal numbers are all figurate (polygonal) numbers and are generated by the following formulae:
Triangle
$P_{3,n}=n(n+1)/2$
$1, 3, 6, 10, 15, \dots$
Square
$P_{4,n}=n^2$
$1, 4, 9, 16, 25, \dots$
Pentagonal
$P_{5,n}=n(3n-1)/2$
$1, 5, 12, 22, 35, \dots$
Hexagonal
$P_{6,n}=n(2n-1)$
$1, 6, 15, 28, 45, \dots$
Heptagonal
$P_{7,n}=n(5n-3)/2$
$1, 7, 18, 34, 55, \dots$
Octagonal
$P_{8,n}=n(3n-2)$
$1, 8, 21, 40, 65, \dots$
The ordered set of three $4$-digit numbers: $8128$, $2882$, $8281$, has three interesting properties.
The set is cyclic, in that the last two digits of each number is the first two digits of the next number (including the last number with the first).
Each polygonal type: triangle ($P_{3,127}=8128$), square ($P_{4,91}=8281$), and pentagonal ($P_{5,44}=2882$), is represented by a different number in the set.
This is the only set of $4$-digit numbers with this property.
Find the sum of the only ordered set of six cyclic $4$-digit numbers for which each polygonal type: triangle, square, pentagonal, hexagonal, heptagonal, and octagonal, is represented by a different number in the set. | <p>Triangle, square, pentagonal, hexagonal, heptagonal, and octagonal numbers are all figurate (polygonal) numbers and are generated by the following formulae:</p>
<table><tr><td>Triangle</td>
<td> </td>
<td>$P_{3,n}=n(n+1)/2$</td>
<td> </td>
<td>$1, 3, 6, 10, 15, \dots$</td>
</tr><tr><td>Square</td>
<td> </td>
<td>$P_{4,n}=n^2$</td>
<td> </td>
<td>$1, 4, 9, 16, 25, \dots$</td>
</tr><tr><td>Pentagonal</td>
<td> </td>
<td>$P_{5,n}=n(3n-1)/2$</td>
<td> </td>
<td>$1, 5, 12, 22, 35, \dots$</td>
</tr><tr><td>Hexagonal</td>
<td> </td>
<td>$P_{6,n}=n(2n-1)$</td>
<td> </td>
<td>$1, 6, 15, 28, 45, \dots$</td>
</tr><tr><td>Heptagonal</td>
<td> </td>
<td>$P_{7,n}=n(5n-3)/2$</td>
<td> </td>
<td>$1, 7, 18, 34, 55, \dots$</td>
</tr><tr><td>Octagonal</td>
<td> </td>
<td>$P_{8,n}=n(3n-2)$</td>
<td> </td>
<td>$1, 8, 21, 40, 65, \dots$</td>
</tr></table><p>The ordered set of three $4$-digit numbers: $8128$, $2882$, $8281$, has three interesting properties.</p>
<ol><li>The set is cyclic, in that the last two digits of each number is the first two digits of the next number (including the last number with the first).</li>
<li>Each polygonal type: triangle ($P_{3,127}=8128$), square ($P_{4,91}=8281$), and pentagonal ($P_{5,44}=2882$), is represented by a different number in the set.</li>
<li>This is the only set of $4$-digit numbers with this property.</li>
</ol><p>Find the sum of the only ordered set of six cyclic $4$-digit numbers for which each polygonal type: triangle, square, pentagonal, hexagonal, heptagonal, and octagonal, is represented by a different number in the set.</p> | 28684 | Friday, 16th January 2004, 06:00 pm | 28541 | 20% | easy |
290 | Digital Signature | How many integers $0 \le n \lt 10^{18}$ have the property that the sum of the digits of $n$ equals the sum of digits of $137n$? | How many integers $0 \le n \lt 10^{18}$ have the property that the sum of the digits of $n$ equals the sum of digits of $137n$? | <p>
How many integers $0 \le n \lt 10^{18}$ have the property that the sum of the digits of $n$ equals the sum of digits of $137n$?
</p> | 20444710234716473 | Friday, 30th April 2010, 05:00 pm | 1098 | 50% | medium |
381 | $(\text{prime}-k)$ Factorial | For a prime $p$ let $S(p) = (\sum (p-k)!) \bmod (p)$ for $1 \le k \le 5$.
For example, if $p=7$,
$(7-1)! + (7-2)! + (7-3)! + (7-4)! + (7-5)! = 6! + 5! + 4! + 3! + 2! = 720+120+24+6+2 = 872$.
As $872 \bmod (7) = 4$, $S(7) = 4$.
It can be verified that $\sum S(p) = 480$ for $5 \le p \lt 100$.
Find $\sum S(p)$ for $5 \le p \lt 10^8$. | For a prime $p$ let $S(p) = (\sum (p-k)!) \bmod (p)$ for $1 \le k \le 5$.
For example, if $p=7$,
$(7-1)! + (7-2)! + (7-3)! + (7-4)! + (7-5)! = 6! + 5! + 4! + 3! + 2! = 720+120+24+6+2 = 872$.
As $872 \bmod (7) = 4$, $S(7) = 4$.
It can be verified that $\sum S(p) = 480$ for $5 \le p \lt 100$.
Find $\sum S(p)$ for $5 \le p \lt 10^8$. | <p>
For a prime $p$ let $S(p) = (\sum (p-k)!) \bmod (p)$ for $1 \le k \le 5$.
</p>
<p>
For example, if $p=7$,<br/>
$(7-1)! + (7-2)! + (7-3)! + (7-4)! + (7-5)! = 6! + 5! + 4! + 3! + 2! = 720+120+24+6+2 = 872$.<br/>
As $872 \bmod (7) = 4$, $S(7) = 4$.
</p>
<p>
It can be verified that $\sum S(p) = 480$ for $5 \le p \lt 100$.
</p>
<p>
Find $\sum S(p)$ for $5 \le p \lt 10^8$.
</p> | 139602943319822 | Saturday, 21st April 2012, 05:00 pm | 4767 | 15% | easy |
331 | Cross Flips | $N \times N$ disks are placed on a square game board. Each disk has a black side and white side.
At each turn, you may choose a disk and flip all the disks in the same row and the same column as this disk: thus $2 \times N - 1$ disks are flipped. The game ends when all disks show their white side. The following example shows a game on a $5 \times 5$ board.
It can be proven that $3$ is the minimal number of turns to finish this game.
The bottom left disk on the $N \times N$ board has coordinates $(0,0)$;
the bottom right disk has coordinates $(N-1,0)$ and the top left disk has coordinates $(0,N-1)$.
Let $C_N$ be the following configuration of a board with $N \times N$ disks:
A disk at $(x, y)$ satisfying $N - 1 \le \sqrt{x^2 + y^2} \lt N$, shows its black side; otherwise, it shows its white side. $C_5$ is shown above.
Let $T(N)$ be the minimal number of turns to finish a game starting from configuration $C_N$ or $0$ if configuration $C_N$ is unsolvable.
We have shown that $T(5)=3$. You are also given that $T(10)=29$ and $T(1\,000)=395253$.
Find $\sum \limits_{i = 3}^{31} T(2^i - i)$. | $N \times N$ disks are placed on a square game board. Each disk has a black side and white side.
At each turn, you may choose a disk and flip all the disks in the same row and the same column as this disk: thus $2 \times N - 1$ disks are flipped. The game ends when all disks show their white side. The following example shows a game on a $5 \times 5$ board.
It can be proven that $3$ is the minimal number of turns to finish this game.
The bottom left disk on the $N \times N$ board has coordinates $(0,0)$;
the bottom right disk has coordinates $(N-1,0)$ and the top left disk has coordinates $(0,N-1)$.
Let $C_N$ be the following configuration of a board with $N \times N$ disks:
A disk at $(x, y)$ satisfying $N - 1 \le \sqrt{x^2 + y^2} \lt N$, shows its black side; otherwise, it shows its white side. $C_5$ is shown above.
Let $T(N)$ be the minimal number of turns to finish a game starting from configuration $C_N$ or $0$ if configuration $C_N$ is unsolvable.
We have shown that $T(5)=3$. You are also given that $T(10)=29$ and $T(1\,000)=395253$.
Find $\sum \limits_{i = 3}^{31} T(2^i - i)$. | <p>$N \times N$ disks are placed on a square game board. Each disk has a black side and white side.</p>
<p>At each turn, you may choose a disk and flip all the disks in the same row and the same column as this disk: thus $2 \times N - 1$ disks are flipped. The game ends when all disks show their white side. The following example shows a game on a $5 \times 5$ board.</p>
<div align="center"><img alt="0331_crossflips3.gif" src="resources/images/0331_crossflips3.gif?1678992056"/></div>
<p>It can be proven that $3$ is the minimal number of turns to finish this game.</p>
<p>The bottom left disk on the $N \times N$ board has coordinates $(0,0)$;<br/>
the bottom right disk has coordinates $(N-1,0)$ and the top left disk has coordinates $(0,N-1)$. </p>
<p>Let $C_N$ be the following configuration of a board with $N \times N$ disks:<br/>
A disk at $(x, y)$ satisfying $N - 1 \le \sqrt{x^2 + y^2} \lt N$, shows its black side; otherwise, it shows its white side. $C_5$ is shown above.</p>
<p>Let $T(N)$ be the minimal number of turns to finish a game starting from configuration $C_N$ or $0$ if configuration $C_N$ is unsolvable.<br/>
We have shown that $T(5)=3$. You are also given that $T(10)=29$ and $T(1\,000)=395253$.</p>
<p>Find $\sum \limits_{i = 3}^{31} T(2^i - i)$.</p> | 467178235146843549 | Sunday, 3rd April 2011, 08:00 am | 471 | 100% | hard |
581 | $47$-smooth Triangular Numbers | A number is $p$-smooth if it has no prime factors larger than $p$.
Let $T$ be the sequence of triangular numbers, i.e. $T(n)=n(n+1)/2$.
Find the sum of all indices $n$ such that $T(n)$ is $47$-smooth. | A number is $p$-smooth if it has no prime factors larger than $p$.
Let $T$ be the sequence of triangular numbers, i.e. $T(n)=n(n+1)/2$.
Find the sum of all indices $n$ such that $T(n)$ is $47$-smooth. | <p>
A number is $p$-smooth if it has no prime factors larger than $p$.<br/>
Let $T$ be the sequence of triangular numbers, i.e. $T(n)=n(n+1)/2$.<br/>
Find the sum of all indices $n$ such that $T(n)$ is $47$-smooth.
</p> | 2227616372734 | Sunday, 11th December 2016, 07:00 am | 974 | 30% | easy |
710 | One Million Members | On Sunday 5 April 2020 the Project Euler membership first exceeded one million members. We would like to present this problem to celebrate that milestone. Thank you to everyone for being a part of Project Euler.
The number 6 can be written as a palindromic sum in exactly eight different ways:
$$(1, 1, 1, 1, 1, 1), (1, 1, 2, 1, 1), (1, 2, 2, 1), (1, 4, 1), (2, 1, 1, 2), (2, 2, 2), (3, 3), (6)$$
We shall define a twopal to be a palindromic tuple having at least one element with a value of 2. It should also be noted that elements are not restricted to single digits. For example, $(3, 2, 13, 6, 13, 2, 3)$ is a valid twopal.
If we let $t(n)$ be the number of twopals whose elements sum to $n$, then it can be seen that $t(6) = 4$:
$$(1, 1, 2, 1, 1), (1, 2, 2, 1), (2, 1, 1, 2), (2, 2, 2)$$
Similarly, $t(20) = 824$.
In searching for the answer to the ultimate question of life, the universe, and everything, it can be verified that $t(42) = 1999923$, which happens to be the first value of $t(n)$ that exceeds one million.
However, your challenge to the "ultimatest" question of life, the universe, and everything is to find the least value of $n \gt 42$ such that $t(n)$ is divisible by one million. | On Sunday 5 April 2020 the Project Euler membership first exceeded one million members. We would like to present this problem to celebrate that milestone. Thank you to everyone for being a part of Project Euler.
The number 6 can be written as a palindromic sum in exactly eight different ways:
$$(1, 1, 1, 1, 1, 1), (1, 1, 2, 1, 1), (1, 2, 2, 1), (1, 4, 1), (2, 1, 1, 2), (2, 2, 2), (3, 3), (6)$$
We shall define a twopal to be a palindromic tuple having at least one element with a value of 2. It should also be noted that elements are not restricted to single digits. For example, $(3, 2, 13, 6, 13, 2, 3)$ is a valid twopal.
If we let $t(n)$ be the number of twopals whose elements sum to $n$, then it can be seen that $t(6) = 4$:
$$(1, 1, 2, 1, 1), (1, 2, 2, 1), (2, 1, 1, 2), (2, 2, 2)$$
Similarly, $t(20) = 824$.
In searching for the answer to the ultimate question of life, the universe, and everything, it can be verified that $t(42) = 1999923$, which happens to be the first value of $t(n)$ that exceeds one million.
However, your challenge to the "ultimatest" question of life, the universe, and everything is to find the least value of $n \gt 42$ such that $t(n)$ is divisible by one million. | <h4>On Sunday 5 April 2020 the Project Euler membership first exceeded one million members. We would like to present this problem to celebrate that milestone. Thank you to everyone for being a part of Project Euler.</h4>
<p>The number 6 can be written as a palindromic sum in exactly eight different ways:</p>
$$(1, 1, 1, 1, 1, 1), (1, 1, 2, 1, 1), (1, 2, 2, 1), (1, 4, 1), (2, 1, 1, 2), (2, 2, 2), (3, 3), (6)$$
<p>We shall define a <dfn>twopal</dfn> to be a palindromic tuple having at least one element with a value of 2. It should also be noted that elements are not restricted to single digits. For example, $(3, 2, 13, 6, 13, 2, 3)$ is a valid twopal.</p>
<p>If we let $t(n)$ be the number of twopals whose elements sum to $n$, then it can be seen that $t(6) = 4$:</p>
$$(1, 1, 2, 1, 1), (1, 2, 2, 1), (2, 1, 1, 2), (2, 2, 2)$$
<p>Similarly, $t(20) = 824$.</p>
<p>In searching for the answer to the ultimate question of life, the universe, and everything, it can be verified that $t(42) = 1999923$, which happens to be the first value of $t(n)$ that exceeds one million.</p>
<p>However, your challenge to the "ultimatest" question of life, the universe, and everything is to find the least value of $n \gt 42$ such that $t(n)$ is divisible by one million.</p> | 1275000 | Saturday, 11th April 2020, 08:00 pm | 1426 | 10% | easy |
510 | Tangent Circles | Circles $A$ and $B$ are tangent to each other and to line $L$ at three distinct points.
Circle $C$ is inside the space between $A$, $B$ and $L$, and tangent to all three.
Let $r_A$, $r_B$ and $r_C$ be the radii of $A$, $B$ and $C$ respectively.
Let $S(n) = \sum r_A + r_B + r_C$, for $0 \lt r_A \le r_B \le n$ where $r_A$, $r_B$ and $r_C$ are integers.
The only solution for $0 \lt r_A \le r_B \le 5$ is $r_A = 4$, $r_B = 4$ and $r_C = 1$, so $S(5) = 4 + 4 + 1 = 9$.
You are also given $S(100) = 3072$.
Find $S(10^9)$. | Circles $A$ and $B$ are tangent to each other and to line $L$ at three distinct points.
Circle $C$ is inside the space between $A$, $B$ and $L$, and tangent to all three.
Let $r_A$, $r_B$ and $r_C$ be the radii of $A$, $B$ and $C$ respectively.
Let $S(n) = \sum r_A + r_B + r_C$, for $0 \lt r_A \le r_B \le n$ where $r_A$, $r_B$ and $r_C$ are integers.
The only solution for $0 \lt r_A \le r_B \le 5$ is $r_A = 4$, $r_B = 4$ and $r_C = 1$, so $S(5) = 4 + 4 + 1 = 9$.
You are also given $S(100) = 3072$.
Find $S(10^9)$. | <p>Circles $A$ and $B$ are tangent to each other and to line $L$ at three distinct points.<br/>
Circle $C$ is inside the space between $A$, $B$ and $L$, and tangent to all three.<br/>
Let $r_A$, $r_B$ and $r_C$ be the radii of $A$, $B$ and $C$ respectively.<br/></p><div align="center"><img alt="0510_tangent_circles.png" src="resources/images/0510_tangent_circles.png?1678992053"/></div>
<p>Let $S(n) = \sum r_A + r_B + r_C$, for $0 \lt r_A \le r_B \le n$ where $r_A$, $r_B$ and $r_C$ are integers.
The only solution for $0 \lt r_A \le r_B \le 5$ is $r_A = 4$, $r_B = 4$ and $r_C = 1$, so $S(5) = 4 + 4 + 1 = 9$.
You are also given $S(100) = 3072$.</p>
<p>Find $S(10^9)$.</p> | 315306518862563689 | Saturday, 4th April 2015, 04:00 pm | 1128 | 30% | easy |
238 | Infinite String Tour | Create a sequence of numbers using the "Blum Blum Shub" pseudo-random number generator:
\begin{align}
s_0 &= 14025256\\
s_{n + 1} &= s_n^2 \bmod 20300713
\end{align}
Concatenate these numbers $s_0s_1s_2\cdots$ to create a string $w$ of infinite length.
Then, $w = {\color{blue}14025256741014958470038053646\cdots}$
For a positive integer $k$, if no substring of $w$ exists with a sum of digits equal to $k$, $p(k)$ is defined to be zero. If at least one substring of $w$ exists with a sum of digits equal to $k$, we define $p(k) = z$, where $z$ is the starting position of the earliest such substring.
For instance:
The substrings $\color{blue}1, 14, 1402, \dots$
with respective sums of digits equal to $1, 5, 7, \dots$
start at position $\mathbf 1$, hence $p(1) = p(5) = p(7) = \cdots = \mathbf 1$.
The substrings $\color{blue}4, 402, 4025, \dots$
with respective sums of digits equal to $4, 6, 11, \dots$
start at position $\mathbf 2$, hence $p(4) = p(6) = p(11) = \cdots = \mathbf 2$.
The substrings $\color{blue}02, 0252, \dots$
with respective sums of digits equal to $2, 9, \dots$
start at position $\mathbf 3$, hence $p(2) = p(9) = \cdots = \mathbf 3$.
Note that substring $\color{blue}025$ starting at position $\mathbf 3$, has a sum of digits equal to $7$, but there was an earlier substring (starting at position $\mathbf 1$) with a sum of digits equal to $7$, so $p(7) = 1$, not $3$.
We can verify that, for $0 \lt k \le 10^3$, $\sum p(k) = 4742$.
Find $\sum p(k)$, for $0 \lt k \le 2 \times 10^{15}$. | Create a sequence of numbers using the "Blum Blum Shub" pseudo-random number generator:
\begin{align}
s_0 &= 14025256\\
s_{n + 1} &= s_n^2 \bmod 20300713
\end{align}
Concatenate these numbers $s_0s_1s_2\cdots$ to create a string $w$ of infinite length.
Then, $w = {\color{blue}14025256741014958470038053646\cdots}$
For a positive integer $k$, if no substring of $w$ exists with a sum of digits equal to $k$, $p(k)$ is defined to be zero. If at least one substring of $w$ exists with a sum of digits equal to $k$, we define $p(k) = z$, where $z$ is the starting position of the earliest such substring.
For instance:
The substrings $\color{blue}1, 14, 1402, \dots$
with respective sums of digits equal to $1, 5, 7, \dots$
start at position $\mathbf 1$, hence $p(1) = p(5) = p(7) = \cdots = \mathbf 1$.
The substrings $\color{blue}4, 402, 4025, \dots$
with respective sums of digits equal to $4, 6, 11, \dots$
start at position $\mathbf 2$, hence $p(4) = p(6) = p(11) = \cdots = \mathbf 2$.
The substrings $\color{blue}02, 0252, \dots$
with respective sums of digits equal to $2, 9, \dots$
start at position $\mathbf 3$, hence $p(2) = p(9) = \cdots = \mathbf 3$.
Note that substring $\color{blue}025$ starting at position $\mathbf 3$, has a sum of digits equal to $7$, but there was an earlier substring (starting at position $\mathbf 1$) with a sum of digits equal to $7$, so $p(7) = 1$, not $3$.
We can verify that, for $0 \lt k \le 10^3$, $\sum p(k) = 4742$.
Find $\sum p(k)$, for $0 \lt k \le 2 \times 10^{15}$. | <p>Create a sequence of numbers using the "Blum Blum Shub" pseudo-random number generator:</p>
\begin{align}
s_0 &= 14025256\\
s_{n + 1} &= s_n^2 \bmod 20300713
\end{align}
<p>Concatenate these numbers $s_0s_1s_2\cdots$ to create a string $w$ of infinite length.<br/>
Then, $w = {\color{blue}14025256741014958470038053646\cdots}$</p>
<p>For a positive integer $k$, if no substring of $w$ exists with a sum of digits equal to $k$, $p(k)$ is defined to be zero. If at least one substring of $w$ exists with a sum of digits equal to $k$, we define $p(k) = z$, where $z$ is the starting position of the earliest such substring.</p>
<p>For instance:</p>
<p>The substrings $\color{blue}1, 14, 1402, \dots$<br/>
with respective sums of digits equal to $1, 5, 7, \dots$<br/>
start at position $\mathbf 1$, hence $p(1) = p(5) = p(7) = \cdots = \mathbf 1$.</p>
<p>The substrings $\color{blue}4, 402, 4025, \dots$<br/>
with respective sums of digits equal to $4, 6, 11, \dots$<br/>
start at position $\mathbf 2$, hence $p(4) = p(6) = p(11) = \cdots = \mathbf 2$.</p>
<p>The substrings $\color{blue}02, 0252, \dots$<br/>
with respective sums of digits equal to $2, 9, \dots$<br/>
start at position $\mathbf 3$, hence $p(2) = p(9) = \cdots = \mathbf 3$.</p>
<p>Note that substring $\color{blue}025$ starting at position $\mathbf 3$, has a sum of digits equal to $7$, but there was an earlier substring (starting at position $\mathbf 1$) with a sum of digits equal to $7$, so $p(7) = 1$, <i>not</i> $3$.</p>
<p>We can verify that, for $0 \lt k \le 10^3$, $\sum p(k) = 4742$.</p>
<p>Find $\sum p(k)$, for $0 \lt k \le 2 \times 10^{15}$.</p> | 9922545104535661 | Sunday, 29th March 2009, 03:00 pm | 1085 | 75% | hard |
705 | Total Inversion Count of Divided Sequences | The inversion count of a sequence of digits is the smallest number of adjacent pairs that must be swapped to sort the sequence.
For example, $34214$ has inversion count of $5$:
$34214 \to 32414 \to 23414 \to 23144 \to 21344 \to12344$.
If each digit of a sequence is replaced by one of its divisors a divided sequence is obtained.
For example, the sequence $332$ has $8$ divided sequences: $\{332,331,312,311,132,131,112,111\}$.
Define $G(N)$ to be the concatenation of all primes less than $N$, ignoring any zero digit.
For example, $G(20) = 235711131719$.
Define $F(N)$ to be the sum of the inversion count for all possible divided sequences from the master sequence $G(N)$.
You are given $F(20) = 3312$ and $F(50) = 338079744$.
Find $F(10^8)$. Give your answer modulo $1\,000\,000\,007$. | The inversion count of a sequence of digits is the smallest number of adjacent pairs that must be swapped to sort the sequence.
For example, $34214$ has inversion count of $5$:
$34214 \to 32414 \to 23414 \to 23144 \to 21344 \to12344$.
If each digit of a sequence is replaced by one of its divisors a divided sequence is obtained.
For example, the sequence $332$ has $8$ divided sequences: $\{332,331,312,311,132,131,112,111\}$.
Define $G(N)$ to be the concatenation of all primes less than $N$, ignoring any zero digit.
For example, $G(20) = 235711131719$.
Define $F(N)$ to be the sum of the inversion count for all possible divided sequences from the master sequence $G(N)$.
You are given $F(20) = 3312$ and $F(50) = 338079744$.
Find $F(10^8)$. Give your answer modulo $1\,000\,000\,007$. | <p>
The <dfn>inversion count</dfn> of a sequence of digits is the smallest number of adjacent pairs that must be swapped to sort the sequence.<br/>
For example, $34214$ has inversion count of $5$:
$34214 \to 32414 \to 23414 \to 23144 \to 21344 \to12344$.
</p>
<p>
If each digit of a sequence is replaced by one of its divisors a <dfn>divided sequence</dfn> is obtained. <br/>
For example, the sequence $332$ has $8$ divided sequences: $\{332,331,312,311,132,131,112,111\}$.
</p>
<p>
Define $G(N)$ to be the concatenation of all primes less than $N$, ignoring any zero digit. <br/>
For example, $G(20) = 235711131719$.
</p>
<p>
Define $F(N)$ to be the sum of the inversion count for all possible divided sequences from the master sequence $G(N)$. <br/>
You are given $F(20) = 3312$ and $F(50) = 338079744$.
</p>
<p>
Find $F(10^8)$. Give your answer modulo $1\,000\,000\,007$.
</p> | 480440153 | Sunday, 8th March 2020, 04:00 am | 490 | 25% | easy |
819 | Iterative Sampling | Given an $n$-tuple of numbers another $n$-tuple is created where each element of the new $n$-tuple is chosen randomly from the numbers in the previous $n$-tuple. For example, given $(2,2,3)$ the probability that $2$ occurs in the first position in the next 3-tuple is $2/3$. The probability of getting all $2$'s would be $8/27$ while the probability of getting the same 3-tuple (in any order) would be $4/9$.
Let $E(n)$ be the expected number of steps starting with $(1,2,\ldots,n)$ and ending with all numbers being the same.
You are given $E(3) = 27/7$ and $E(5) = 468125/60701 \approx 7.711982$ rounded to 6 digits after the decimal place.
Find $E(10^3)$. Give the answer rounded to 6 digits after the decimal place. | Given an $n$-tuple of numbers another $n$-tuple is created where each element of the new $n$-tuple is chosen randomly from the numbers in the previous $n$-tuple. For example, given $(2,2,3)$ the probability that $2$ occurs in the first position in the next 3-tuple is $2/3$. The probability of getting all $2$'s would be $8/27$ while the probability of getting the same 3-tuple (in any order) would be $4/9$.
Let $E(n)$ be the expected number of steps starting with $(1,2,\ldots,n)$ and ending with all numbers being the same.
You are given $E(3) = 27/7$ and $E(5) = 468125/60701 \approx 7.711982$ rounded to 6 digits after the decimal place.
Find $E(10^3)$. Give the answer rounded to 6 digits after the decimal place. | <p>Given an $n$-tuple of numbers another $n$-tuple is created where each element of the new $n$-tuple is chosen randomly from the numbers in the previous $n$-tuple. For example, given $(2,2,3)$ the probability that $2$ occurs in the first position in the next 3-tuple is $2/3$. The probability of getting all $2$'s would be $8/27$ while the probability of getting the same 3-tuple (in any order) would be $4/9$.</p>
<p>Let $E(n)$ be the expected number of steps starting with $(1,2,\ldots,n)$ and ending with all numbers being the same.</p>
<p>You are given $E(3) = 27/7$ and $E(5) = 468125/60701 \approx 7.711982$ rounded to 6 digits after the decimal place.</p>
<p>Find $E(10^3)$. Give the answer rounded to 6 digits after the decimal place.</p> | 1995.975556 | Saturday, 3rd December 2022, 01:00 pm | 232 | 45% | medium |
681 | Maximal Area | Given positive integers $a \le b \le c \le d$, it may be possible to form quadrilaterals with edge lengths $a,b,c,d$ (in any order). When this is the case, let $M(a,b,c,d)$ denote the maximal area of such a quadrilateral. For example, $M(2,2,3,3)=6$, attained e.g. by a $2\times 3$ rectangle.
Let $SP(n)$ be the sum of $a+b+c+d$ over all choices $a \le b \le c \le d$ for which $M(a,b,c,d)$ is a positive integer not exceeding $n$.
$SP(10)=186$ and $SP(100)=23238$.
Find $SP(1\,000\,000)$. | Given positive integers $a \le b \le c \le d$, it may be possible to form quadrilaterals with edge lengths $a,b,c,d$ (in any order). When this is the case, let $M(a,b,c,d)$ denote the maximal area of such a quadrilateral. For example, $M(2,2,3,3)=6$, attained e.g. by a $2\times 3$ rectangle.
Let $SP(n)$ be the sum of $a+b+c+d$ over all choices $a \le b \le c \le d$ for which $M(a,b,c,d)$ is a positive integer not exceeding $n$.
$SP(10)=186$ and $SP(100)=23238$.
Find $SP(1\,000\,000)$. | <p>
Given positive integers $a \le b \le c \le d$, it may be possible to form quadrilaterals with edge lengths $a,b,c,d$ (in any order). When this is the case, let $M(a,b,c,d)$ denote the maximal area of such a quadrilateral.<br> For example, $M(2,2,3,3)=6$, attained e.g. by a $2\times 3$ rectangle.
</br></p>
<p>
Let $SP(n)$ be the sum of $a+b+c+d$ over all choices $a \le b \le c \le d$ for which $M(a,b,c,d)$ is a positive integer not exceeding $n$.<br/>
$SP(10)=186$ and $SP(100)=23238$.
</p>
<p>
Find $SP(1\,000\,000)$.
</p> | 2611227421428 | Sunday, 29th September 2019, 07:00 am | 250 | 50% | medium |
741 | Binary Grid Colouring | Let $f(n)$ be the number of ways an $n\times n$ square grid can be coloured, each cell either black or white, such that each row and each column contains exactly two black cells.
For example, $f(4)=90$, $f(7) = 3110940$ and $f(8) = 187530840$.
Let $g(n)$ be the number of colourings in $f(n)$ that are unique up to rotations and reflections.
You are given $g(4)=20$, $g(7) = 390816$ and $g(8) = 23462347$ giving $g(7)+g(8) = 23853163$.
Find $g(7^7) + g(8^8)$. Give your answer modulo $1\,000\,000\,007$. | Let $f(n)$ be the number of ways an $n\times n$ square grid can be coloured, each cell either black or white, such that each row and each column contains exactly two black cells.
For example, $f(4)=90$, $f(7) = 3110940$ and $f(8) = 187530840$.
Let $g(n)$ be the number of colourings in $f(n)$ that are unique up to rotations and reflections.
You are given $g(4)=20$, $g(7) = 390816$ and $g(8) = 23462347$ giving $g(7)+g(8) = 23853163$.
Find $g(7^7) + g(8^8)$. Give your answer modulo $1\,000\,000\,007$. | <p>
Let $f(n)$ be the number of ways an $n\times n$ square grid can be coloured, each cell either black or white, such that each row and each column contains exactly two black cells.<br/>
For example, $f(4)=90$, $f(7) = 3110940$ and $f(8) = 187530840$.
</p>
<p>
Let $g(n)$ be the number of colourings in $f(n)$ that are unique up to rotations and reflections.<br/>
You are given $g(4)=20$, $g(7) = 390816$ and $g(8) = 23462347$ giving $g(7)+g(8) = 23853163$.
</p>
<p>
Find $g(7^7) + g(8^8)$. Give your answer modulo $1\,000\,000\,007$.
</p> | 512895223 | Saturday, 2nd January 2021, 04:00 pm | 170 | 80% | hard |
21 | Amicable Numbers | Let $d(n)$ be defined as the sum of proper divisors of $n$ (numbers less than $n$ which divide evenly into $n$).
If $d(a) = b$ and $d(b) = a$, where $a \ne b$, then $a$ and $b$ are an amicable pair and each of $a$ and $b$ are called amicable numbers.
For example, the proper divisors of $220$ are $1, 2, 4, 5, 10, 11, 20, 22, 44, 55$ and $110$; therefore $d(220) = 284$. The proper divisors of $284$ are $1, 2, 4, 71$ and $142$; so $d(284) = 220$.
Evaluate the sum of all the amicable numbers under $10000$. | Let $d(n)$ be defined as the sum of proper divisors of $n$ (numbers less than $n$ which divide evenly into $n$).
If $d(a) = b$ and $d(b) = a$, where $a \ne b$, then $a$ and $b$ are an amicable pair and each of $a$ and $b$ are called amicable numbers.
For example, the proper divisors of $220$ are $1, 2, 4, 5, 10, 11, 20, 22, 44, 55$ and $110$; therefore $d(220) = 284$. The proper divisors of $284$ are $1, 2, 4, 71$ and $142$; so $d(284) = 220$.
Evaluate the sum of all the amicable numbers under $10000$. | <p>Let $d(n)$ be defined as the sum of proper divisors of $n$ (numbers less than $n$ which divide evenly into $n$).<br/>
If $d(a) = b$ and $d(b) = a$, where $a \ne b$, then $a$ and $b$ are an amicable pair and each of $a$ and $b$ are called amicable numbers.</p>
<p>For example, the proper divisors of $220$ are $1, 2, 4, 5, 10, 11, 20, 22, 44, 55$ and $110$; therefore $d(220) = 284$. The proper divisors of $284$ are $1, 2, 4, 71$ and $142$; so $d(284) = 220$.</p>
<p>Evaluate the sum of all the amicable numbers under $10000$.</p> | 31626 | Friday, 5th July 2002, 06:00 pm | 158401 | 5% | easy |
834 | Add and Divide | A sequence is created by starting with a positive integer $n$ and incrementing by $(n+m)$ at the $m^{th}$ step.
If $n=10$, the resulting sequence will be $21,33,46,60,75,91,108,126,\ldots$.
Let $S(n)$ be the set of indices $m$, for which the $m^{th}$ term in the sequence is divisible by $(n+m)$.
For example, $S(10)=\{5,8,20,35,80\}$.
Define $T(n)$ to be the sum of the indices in $S(n)$. For example, $T(10) = 148$ and $T(10^2)=21828$.
Let $\displaystyle U(N)=\sum_{n=3}^{N}T(n)$. You are given, $U(10^2)=612572$.
Find $U(1234567)$. | A sequence is created by starting with a positive integer $n$ and incrementing by $(n+m)$ at the $m^{th}$ step.
If $n=10$, the resulting sequence will be $21,33,46,60,75,91,108,126,\ldots$.
Let $S(n)$ be the set of indices $m$, for which the $m^{th}$ term in the sequence is divisible by $(n+m)$.
For example, $S(10)=\{5,8,20,35,80\}$.
Define $T(n)$ to be the sum of the indices in $S(n)$. For example, $T(10) = 148$ and $T(10^2)=21828$.
Let $\displaystyle U(N)=\sum_{n=3}^{N}T(n)$. You are given, $U(10^2)=612572$.
Find $U(1234567)$. | <p>
A sequence is created by starting with a positive integer $n$ and incrementing by $(n+m)$ at the $m^{th}$ step.
If $n=10$, the resulting sequence will be $21,33,46,60,75,91,108,126,\ldots$.</p>
<p>
Let $S(n)$ be the set of indices $m$, for which the $m^{th}$ term in the sequence is divisible by $(n+m)$.<br/>
For example, $S(10)=\{5,8,20,35,80\}$.</p>
<p>
Define $T(n)$ to be the sum of the indices in $S(n)$. For example, $T(10) = 148$ and $T(10^2)=21828$.</p>
<p>
Let $\displaystyle U(N)=\sum_{n=3}^{N}T(n)$. You are given, $U(10^2)=612572$.</p>
<p>
Find $U(1234567)$.</p> | 1254404167198752370 | Sunday, 19th March 2023, 10:00 am | 439 | 25% | easy |
272 | Modular Cubes, Part 2 | For a positive number $n$, define $C(n)$ as the number of the integers $x$, for which $1 \lt x \lt n$ and$x^3 \equiv 1 \bmod n$.
When $n=91$, there are $8$ possible values for $x$, namely: $9, 16, 22, 29, 53, 74, 79, 81$.
Thus, $C(91)=8$.
Find the sum of the positive numbers $n \le 10^{11}$ for which $C(n)=242$. | For a positive number $n$, define $C(n)$ as the number of the integers $x$, for which $1 \lt x \lt n$ and$x^3 \equiv 1 \bmod n$.
When $n=91$, there are $8$ possible values for $x$, namely: $9, 16, 22, 29, 53, 74, 79, 81$.
Thus, $C(91)=8$.
Find the sum of the positive numbers $n \le 10^{11}$ for which $C(n)=242$. | <p>
For a positive number $n$, define $C(n)$ as the number of the integers $x$, for which $1 \lt x \lt n$ and<br/>$x^3 \equiv 1 \bmod n$.
</p>
<p>
When $n=91$, there are $8$ possible values for $x$, namely: $9, 16, 22, 29, 53, 74, 79, 81$.<br/>
Thus, $C(91)=8$.</p>
<p>
Find the sum of the positive numbers $n \le 10^{11}$ for which $C(n)=242$.</p> | 8495585919506151122 | Saturday, 2nd January 2010, 05:00 am | 1102 | 80% | hard |
463 | A Weird Recurrence Relation | The function $f$ is defined for all positive integers as follows:
$f(1)=1$
$f(3)=3$
$f(2n)=f(n)$
$f(4n + 1)=2f(2n + 1) - f(n)$
$f(4n + 3)=3f(2n + 1) - 2f(n)$
The function $S(n)$ is defined as $\sum_{i=1}^{n}f(i)$.
$S(8)=22$ and $S(100)=3604$.
Find $S(3^{37})$. Give the last $9$ digits of your answer. | The function $f$ is defined for all positive integers as follows:
$f(1)=1$
$f(3)=3$
$f(2n)=f(n)$
$f(4n + 1)=2f(2n + 1) - f(n)$
$f(4n + 3)=3f(2n + 1) - 2f(n)$
The function $S(n)$ is defined as $\sum_{i=1}^{n}f(i)$.
$S(8)=22$ and $S(100)=3604$.
Find $S(3^{37})$. Give the last $9$ digits of your answer. | <p>
The function $f$ is defined for all positive integers as follows:
</p><ul><li>$f(1)=1$
</li><li>$f(3)=3$
</li><li>$f(2n)=f(n)$
</li><li>$f(4n + 1)=2f(2n + 1) - f(n)$
</li><li>$f(4n + 3)=3f(2n + 1) - 2f(n)$
</li>
</ul><p>The function $S(n)$ is defined as $\sum_{i=1}^{n}f(i)$.</p>
<p>$S(8)=22$ and $S(100)=3604$.</p>
<p>Find $S(3^{37})$. Give the last $9$ digits of your answer.</p> | 808981553 | Saturday, 15th March 2014, 10:00 pm | 1239 | 35% | medium |
446 | Retractions B | For every integer $n>1$, the family of functions $f_{n,a,b}$ is defined
by
$f_{n,a,b}(x)\equiv a x + b \mod n\,\,\, $ for $a,b,x$ integer and $0< a <n, 0 \le b < n,0 \le x < n$.
We will call $f_{n,a,b}$ a retraction if $\,\,\, f_{n,a,b}(f_{n,a,b}(x)) \equiv f_{n,a,b}(x) \mod n \,\,\,$ for every $0 \le x < n$.
Let $R(n)$ be the number of retractions for $n$.
$\displaystyle F(N)=\sum_{n=1}^NR(n^4+4)$.
$F(1024)=77532377300600$.
Find $F(10^7)$.
Give your answer modulo $1\,000\,000\,007$. | For every integer $n>1$, the family of functions $f_{n,a,b}$ is defined
by
$f_{n,a,b}(x)\equiv a x + b \mod n\,\,\, $ for $a,b,x$ integer and $0< a <n, 0 \le b < n,0 \le x < n$.
We will call $f_{n,a,b}$ a retraction if $\,\,\, f_{n,a,b}(f_{n,a,b}(x)) \equiv f_{n,a,b}(x) \mod n \,\,\,$ for every $0 \le x < n$.
Let $R(n)$ be the number of retractions for $n$.
$\displaystyle F(N)=\sum_{n=1}^NR(n^4+4)$.
$F(1024)=77532377300600$.
Find $F(10^7)$.
Give your answer modulo $1\,000\,000\,007$. | <p>
For every integer $n>1$, the family of functions $f_{n,a,b}$ is defined
by <br>
$f_{n,a,b}(x)\equiv a x + b \mod n\,\,\, $ for $a,b,x$ integer and $0< a <n, 0 \le b < n,0 \le x < n$. </br></p>
<p>
We will call $f_{n,a,b}$ a <i>retraction</i> if $\,\,\, f_{n,a,b}(f_{n,a,b}(x)) \equiv f_{n,a,b}(x) \mod n \,\,\,$ for every $0 \le x < n$.<br/>
Let $R(n)$ be the number of retractions for $n$.
</p>
<p>
$\displaystyle F(N)=\sum_{n=1}^NR(n^4+4)$. <br/>
$F(1024)=77532377300600$.<br/></p>
<p>
Find $F(10^7)$.<br/>
Give your answer modulo $1\,000\,000\,007$.
</p> | 907803852 | Saturday, 16th November 2013, 10:00 pm | 423 | 60% | hard |
711 | Binary Blackboard | Oscar and Eric play the following game. First, they agree on a positive integer $n$, and they begin by writing its binary representation on a blackboard. They then take turns, with Oscar going first, to write a number on the blackboard in binary representation, such that the sum of all written numbers does not exceed $2n$.
The game ends when there are no valid moves left. Oscar wins if the number of $1$s on the blackboard is odd, and Eric wins if it is even.
Let $S(N)$ be the sum of all $n \le 2^N$ for which Eric can guarantee winning, assuming optimal play.
For example, the first few values of $n$ for which Eric can guarantee winning are $1,3,4,7,15,16$. Hence $S(4)=46$.
You are also given that $S(12) = 54532$ and $S(1234) \equiv 690421393 \pmod{1\,000\,000\,007}$.
Find $S(12\,345\,678)$. Give your answer modulo $1\,000\,000\,007$. | Oscar and Eric play the following game. First, they agree on a positive integer $n$, and they begin by writing its binary representation on a blackboard. They then take turns, with Oscar going first, to write a number on the blackboard in binary representation, such that the sum of all written numbers does not exceed $2n$.
The game ends when there are no valid moves left. Oscar wins if the number of $1$s on the blackboard is odd, and Eric wins if it is even.
Let $S(N)$ be the sum of all $n \le 2^N$ for which Eric can guarantee winning, assuming optimal play.
For example, the first few values of $n$ for which Eric can guarantee winning are $1,3,4,7,15,16$. Hence $S(4)=46$.
You are also given that $S(12) = 54532$ and $S(1234) \equiv 690421393 \pmod{1\,000\,000\,007}$.
Find $S(12\,345\,678)$. Give your answer modulo $1\,000\,000\,007$. | <p>Oscar and Eric play the following game. First, they agree on a positive integer $n$, and they begin by writing its binary representation on a blackboard. They then take turns, with Oscar going first, to write a number on the blackboard in binary representation, such that the sum of all written numbers does not exceed $2n$.</p>
<p>The game ends when there are no valid moves left. Oscar wins if the number of $1$s on the blackboard is odd, and Eric wins if it is even.</p>
<p>Let $S(N)$ be the sum of all $n \le 2^N$ for which Eric can guarantee winning, assuming optimal play.</p>
<p>For example, the first few values of $n$ for which Eric can guarantee winning are $1,3,4,7,15,16$. Hence $S(4)=46$.<br>
You are also given that $S(12) = 54532$ and $S(1234) \equiv 690421393 \pmod{1\,000\,000\,007}$.</br></p>
<p>Find $S(12\,345\,678)$. Give your answer modulo $1\,000\,000\,007$.</p> | 541510990 | Saturday, 11th April 2020, 08:00 pm | 363 | 35% | medium |
916 | Restricted Permutations | Let $P(n)$ be the number of permutations of $\{1,2,3,\ldots,2n\}$ such that:
1. There is no ascending subsequence with more than $n+1$ elements, and
2. There is no descending subsequence with more than two elements.
Note that subsequences need not be contiguous. For example, the permutation $(4,1,3,2)$ is not counted because it has a descending subsequence of three elements: $(4,3,2)$. You are given $P(2)=13$ and $P(10) \equiv 45265702 \pmod{10^9 + 7}$.
Find $P(10^8)$ and give your answer modulo $10^9 + 7$. | Let $P(n)$ be the number of permutations of $\{1,2,3,\ldots,2n\}$ such that:
1. There is no ascending subsequence with more than $n+1$ elements, and
2. There is no descending subsequence with more than two elements.
Note that subsequences need not be contiguous. For example, the permutation $(4,1,3,2)$ is not counted because it has a descending subsequence of three elements: $(4,3,2)$. You are given $P(2)=13$ and $P(10) \equiv 45265702 \pmod{10^9 + 7}$.
Find $P(10^8)$ and give your answer modulo $10^9 + 7$. | <p>Let $P(n)$ be the number of permutations of $\{1,2,3,\ldots,2n\}$ such that:
<br/>
1. There is no ascending subsequence with more than $n+1$ elements, and
<br/>
2. There is no descending subsequence with more than two elements.
</p>
<p>Note that subsequences need not be contiguous. For example, the permutation $(4,1,3,2)$ is not counted because it has a descending subsequence of three elements: $(4,3,2)$. You are given $P(2)=13$ and $P(10) \equiv 45265702 \pmod{10^9 + 7}$.</p>
<p>Find $P(10^8)$ and give your answer modulo $10^9 + 7$.</p> | 877789135 | Saturday, 9th November 2024, 10:00 pm | 143 | 55% | medium |
184 | Triangles Containing the Origin | Consider the set $I_r$ of points $(x,y)$ with integer co-ordinates 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$, $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 $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}$? | Consider the set $I_r$ of points $(x,y)$ with integer co-ordinates 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$, $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 $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}$? | <p>Consider the set $I_r$ of points $(x,y)$ with integer co-ordinates in the interior of the circle with radius $r$, centered at the origin, i.e. $x^2 + y^2 \lt r^2$.</p>
<p>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.</p>
<p class="center"><img alt="" class="dark_img" src="resources/images/0184.gif?1678992055"/></p>
<p>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$.</p>
<p>How many triangles are there containing the origin in the interior and having all three vertices in $I_{105}$?</p> | 1725323624056 | Friday, 29th February 2008, 09:00 pm | 1870 | 75% | hard |
141 | Square Progressive Numbers | A positive integer, $n$, is divided by $d$ and the quotient and remainder are $q$ and $r$ respectively. In addition $d$, $q$, and $r$ are consecutive positive integer terms in a geometric sequence, but not necessarily in that order.
For example, $58$ divided by $6$ has quotient $9$ and remainder $4$. It can also be seen that $4, 6, 9$ are consecutive terms in a geometric sequence (common ratio $3/2$).
We will call such numbers, $n$, progressive.
Some progressive numbers, such as $9$ and $10404 = 102^2$, happen to also be perfect squares. The sum of all progressive perfect squares below one hundred thousand is $124657$.
Find the sum of all progressive perfect squares below one trillion ($10^{12}$). | A positive integer, $n$, is divided by $d$ and the quotient and remainder are $q$ and $r$ respectively. In addition $d$, $q$, and $r$ are consecutive positive integer terms in a geometric sequence, but not necessarily in that order.
For example, $58$ divided by $6$ has quotient $9$ and remainder $4$. It can also be seen that $4, 6, 9$ are consecutive terms in a geometric sequence (common ratio $3/2$).
We will call such numbers, $n$, progressive.
Some progressive numbers, such as $9$ and $10404 = 102^2$, happen to also be perfect squares. The sum of all progressive perfect squares below one hundred thousand is $124657$.
Find the sum of all progressive perfect squares below one trillion ($10^{12}$). | <p>A positive integer, $n$, is divided by $d$ and the quotient and remainder are $q$ and $r$ respectively. In addition $d$, $q$, and $r$ are consecutive positive integer terms in a geometric sequence, but not necessarily in that order.</p>
<p>For example, $58$ divided by $6$ has quotient $9$ and remainder $4$. It can also be seen that $4, 6, 9$ are consecutive terms in a geometric sequence (common ratio $3/2$).<br/>
We will call such numbers, $n$, progressive.</p>
<p>Some progressive numbers, such as $9$ and $10404 = 102^2$, happen to also be perfect squares.<br/> The sum of all progressive perfect squares below one hundred thousand is $124657$.</p>
<p>Find the sum of all progressive perfect squares below one trillion ($10^{12}$).</p> | 878454337159 | Saturday, 17th February 2007, 05:00 am | 4486 | 60% | hard |
203 | Squarefree Binomial Coefficients | The binomial coefficients $\displaystyle \binom n k$ can be arranged in triangular form, Pascal's triangle, like this:
111121133114641151010511615201561172135352171
.........
It can be seen that the first eight rows of Pascal's triangle contain twelve distinct numbers: 1, 2, 3, 4, 5, 6, 7, 10, 15, 20, 21 and 35.
A positive integer n is called squarefree if no square of a prime divides n.
Of the twelve distinct numbers in the first eight rows of Pascal's triangle, all except 4 and 20 are squarefree.
The sum of the distinct squarefree numbers in the first eight rows is 105.
Find the sum of the distinct squarefree numbers in the first 51 rows of Pascal's triangle. | The binomial coefficients $\displaystyle \binom n k$ can be arranged in triangular form, Pascal's triangle, like this:
111121133114641151010511615201561172135352171
.........
It can be seen that the first eight rows of Pascal's triangle contain twelve distinct numbers: 1, 2, 3, 4, 5, 6, 7, 10, 15, 20, 21 and 35.
A positive integer n is called squarefree if no square of a prime divides n.
Of the twelve distinct numbers in the first eight rows of Pascal's triangle, all except 4 and 20 are squarefree.
The sum of the distinct squarefree numbers in the first eight rows is 105.
Find the sum of the distinct squarefree numbers in the first 51 rows of Pascal's triangle. | <p>The binomial coefficients $\displaystyle \binom n k$ can be arranged in triangular form, Pascal's triangle, like this:</p>
<div class="center">
<table align="center"><tr><td colspan="7"></td><td>1</td><td colspan="7"></td></tr><tr><td colspan="6"></td><td>1</td><td></td><td>1</td><td colspan="6"></td></tr><tr><td colspan="5"></td><td>1</td><td></td><td>2</td><td></td><td>1</td><td colspan="5"></td></tr><tr><td colspan="4"></td><td>1</td><td></td><td>3</td><td></td><td>3</td><td></td><td>1</td><td colspan="4"></td></tr><tr><td colspan="3"></td><td>1</td><td></td><td>4</td><td></td><td>6</td><td></td><td>4</td><td></td><td>1</td><td colspan="3"></td></tr><tr><td colspan="2"></td><td>1</td><td></td><td>5</td><td></td><td>10</td><td></td><td>10</td><td></td><td>5</td><td></td><td>1</td><td colspan="2"></td></tr><tr><td colspan="1"></td><td>1</td><td></td><td>6</td><td></td><td>15</td><td></td><td>20</td><td></td><td>15</td><td></td><td>6</td><td></td><td>1</td><td colspan="1"></td></tr><tr><td>1</td><td></td><td>7</td><td></td><td>21</td><td></td><td>35</td><td></td><td>35</td><td></td><td>21</td><td></td><td>7</td><td></td><td>1</td></tr></table>
.........
</div>
<p>It can be seen that the first eight rows of Pascal's triangle contain twelve distinct numbers: 1, 2, 3, 4, 5, 6, 7, 10, 15, 20, 21 and 35.</p>
<p>A positive integer <var>n</var> is called squarefree if no square of a prime divides <var>n</var>.
Of the twelve distinct numbers in the first eight rows of Pascal's triangle, all except 4 and 20 are squarefree.
The sum of the distinct squarefree numbers in the first eight rows is 105.</p>
<p>Find the sum of the distinct squarefree numbers in the first 51 rows of Pascal's triangle.</p> | 34029210557338 | Saturday, 6th September 2008, 02:00 pm | 9928 | 25% | easy |
590 | Sets with a Given Least Common Multiple | Let $H(n)$ denote the number of sets of positive integers such that the least common multiple of the integers in the set equals $n$.
E.g.:
The integers in the following ten sets all have a least common multiple of $6$:
$\{2,3\}$, $\{1,2,3\}$, $\{6\}$, $\{1,6\}$, $\{2,6\}$, $\{1,2,6\}$, $\{3,6\}$, $\{1,3,6\}$, $\{2,3,6\}$ and $\{1,2,3,6\}$.
Thus $H(6)=10$.
Let $L(n)$ denote the least common multiple of the numbers $1$ through $n$.
E.g. $L(6)$ is the least common multiple of the numbers $1,2,3,4,5,6$ and $L(6)$ equals $60$.
Let $HL(n)$ denote $H(L(n))$.
You are given $HL(4)=H(12)=44$.
Find $HL(50000)$. Give your answer modulo $10^9$. | Let $H(n)$ denote the number of sets of positive integers such that the least common multiple of the integers in the set equals $n$.
E.g.:
The integers in the following ten sets all have a least common multiple of $6$:
$\{2,3\}$, $\{1,2,3\}$, $\{6\}$, $\{1,6\}$, $\{2,6\}$, $\{1,2,6\}$, $\{3,6\}$, $\{1,3,6\}$, $\{2,3,6\}$ and $\{1,2,3,6\}$.
Thus $H(6)=10$.
Let $L(n)$ denote the least common multiple of the numbers $1$ through $n$.
E.g. $L(6)$ is the least common multiple of the numbers $1,2,3,4,5,6$ and $L(6)$ equals $60$.
Let $HL(n)$ denote $H(L(n))$.
You are given $HL(4)=H(12)=44$.
Find $HL(50000)$. Give your answer modulo $10^9$. | <p>
Let $H(n)$ denote the number of sets of positive integers such that the <strong>least common multiple</strong> of the integers in the set equals $n$.<br/>
E.g.:<br/>
The integers in the following ten sets all have a least common multiple of $6$:<br/>
$\{2,3\}$, $\{1,2,3\}$, $\{6\}$, $\{1,6\}$, $\{2,6\}$, $\{1,2,6\}$, $\{3,6\}$, $\{1,3,6\}$, $\{2,3,6\}$ and $\{1,2,3,6\}$.<br/>
Thus $H(6)=10$.
</p>
<p>
Let $L(n)$ denote the least common multiple of the numbers $1$ through $n$.<br/>
E.g. $L(6)$ is the least common multiple of the numbers $1,2,3,4,5,6$ and $L(6)$ equals $60$.
</p>
<p>
Let $HL(n)$ denote $H(L(n))$.<br/>
You are given $HL(4)=H(12)=44$.
</p>
<p>
Find $HL(50000)$. Give your answer modulo $10^9$.
</p> | 834171904 | Sunday, 12th February 2017, 10:00 am | 290 | 60% | hard |
858 | LCM | Define $G(N) = \sum_S \operatorname{lcm}(S)$ where $S$ ranges through all subsets of $\{1, \dots, N\}$ and $\operatorname{lcm}$ denotes the lowest common multiple. Note that the $\operatorname{lcm}$ of the empty set is $1$.
You are given $G(5) = 528$ and $G(20) = 8463108648960$.
Find $G(800)$. Give your answer modulo $10^9 + 7$. | Define $G(N) = \sum_S \operatorname{lcm}(S)$ where $S$ ranges through all subsets of $\{1, \dots, N\}$ and $\operatorname{lcm}$ denotes the lowest common multiple. Note that the $\operatorname{lcm}$ of the empty set is $1$.
You are given $G(5) = 528$ and $G(20) = 8463108648960$.
Find $G(800)$. Give your answer modulo $10^9 + 7$. | <p>
Define $G(N) = \sum_S \operatorname{lcm}(S)$ where $S$ ranges through all subsets of $\{1, \dots, N\}$ and $\operatorname{lcm}$ denotes the lowest common multiple. Note that the $\operatorname{lcm}$ of the empty set is $1$.</p>
<p>
You are given $G(5) = 528$ and $G(20) = 8463108648960$.</p>
<p>
Find $G(800)$. Give your answer modulo $10^9 + 7$.</p> | 973077199 | Sunday, 8th October 2023, 05:00 am | 237 | 50% | medium |
125 | Palindromic Sums | The palindromic number $595$ is interesting because it can be written as the sum of consecutive squares: $6^2 + 7^2 + 8^2 + 9^2 + 10^2 + 11^2 + 12^2$.
There are exactly eleven palindromes below one-thousand that can be written as consecutive square sums, and the sum of these palindromes is $4164$. Note that $1 = 0^2 + 1^2$ has not been included as this problem is concerned with the squares of positive integers.
Find the sum of all the numbers less than $10^8$ that are both palindromic and can be written as the sum of consecutive squares. | The palindromic number $595$ is interesting because it can be written as the sum of consecutive squares: $6^2 + 7^2 + 8^2 + 9^2 + 10^2 + 11^2 + 12^2$.
There are exactly eleven palindromes below one-thousand that can be written as consecutive square sums, and the sum of these palindromes is $4164$. Note that $1 = 0^2 + 1^2$ has not been included as this problem is concerned with the squares of positive integers.
Find the sum of all the numbers less than $10^8$ that are both palindromic and can be written as the sum of consecutive squares. | <p>The palindromic number $595$ is interesting because it can be written as the sum of consecutive squares: $6^2 + 7^2 + 8^2 + 9^2 + 10^2 + 11^2 + 12^2$.</p>
<p>There are exactly eleven palindromes below one-thousand that can be written as consecutive square sums, and the sum of these palindromes is $4164$. Note that $1 = 0^2 + 1^2$ has not been included as this problem is concerned with the squares of positive integers.</p>
<p>Find the sum of all the numbers less than $10^8$ that are both palindromic and can be written as the sum of consecutive squares.</p> | 2906969179 | Friday, 4th August 2006, 06:00 pm | 14974 | 25% | easy |
878 | XOR-Equation B | We use $x\oplus y$ for the bitwise XOR of $x$ and $y$.
Define the XOR-product of $x$ and $y$, denoted by $x \otimes y$, similar to a long multiplication in base $2$, except that the intermediate results are XORed instead of the usual integer addition.
For example, $7 \otimes 3 = 9$, or in base $2$, $111_2 \otimes 11_2 = 1001_2$:
\begin{align*}
\phantom{\otimes 111} 111_2 \\
\otimes \phantom{1111} 11_2 \\
\hline
\phantom{\otimes 111} 111_2 \\
\oplus \phantom{11} 111_2 \phantom{9} \\
\hline
\phantom{\otimes 11} 1001_2 \\
\end{align*}
We consider the equation:
\begin{align}
(a \otimes a) \oplus (2 \otimes a \otimes b) \oplus (b \otimes b) = k.
\end{align}
For example, $(a, b) = (3, 6)$ is a solution to this equation for $k=5$.
Let $G(N,m)$ be the number of solutions to those equations with $k \le m$ and $0 \le a \le b \le N$.
You are given $G(1000,100)=398$.
Find $G(10^{17},1\,000\,000).$ | We use $x\oplus y$ for the bitwise XOR of $x$ and $y$.
Define the XOR-product of $x$ and $y$, denoted by $x \otimes y$, similar to a long multiplication in base $2$, except that the intermediate results are XORed instead of the usual integer addition.
For example, $7 \otimes 3 = 9$, or in base $2$, $111_2 \otimes 11_2 = 1001_2$:
\begin{align*}
\phantom{\otimes 111} 111_2 \\
\otimes \phantom{1111} 11_2 \\
\hline
\phantom{\otimes 111} 111_2 \\
\oplus \phantom{11} 111_2 \phantom{9} \\
\hline
\phantom{\otimes 11} 1001_2 \\
\end{align*}
We consider the equation:
\begin{align}
(a \otimes a) \oplus (2 \otimes a \otimes b) \oplus (b \otimes b) = k.
\end{align}
For example, $(a, b) = (3, 6)$ is a solution to this equation for $k=5$.
Let $G(N,m)$ be the number of solutions to those equations with $k \le m$ and $0 \le a \le b \le N$.
You are given $G(1000,100)=398$.
Find $G(10^{17},1\,000\,000).$ | We use $x\oplus y$ for the bitwise XOR of $x$ and $y$.<br/>
Define the <dfn>XOR-product</dfn> of $x$ and $y$, denoted by $x \otimes y$, similar to a long multiplication in base $2$, except that the intermediate results are XORed instead of the usual integer addition.<br/>
For example, $7 \otimes 3 = 9$, or in base $2$, $111_2 \otimes 11_2 = 1001_2$:
<center>
\begin{align*}
\phantom{\otimes 111} 111_2 \\
\otimes \phantom{1111} 11_2 \\
\hline
\phantom{\otimes 111} 111_2 \\
\oplus \phantom{11} 111_2 \phantom{9} \\
\hline
\phantom{\otimes 11} 1001_2 \\
\end{align*}
</center>
We consider the equation:
<center>
\begin{align}
(a \otimes a) \oplus (2 \otimes a \otimes b) \oplus (b \otimes b) = k.
\end{align}
</center>
<p>
For example, $(a, b) = (3, 6)$ is a solution to this equation for $k=5$.
</p>
<p>
Let $G(N,m)$ be the number of solutions to those equations with $k \le m$ and $0 \le a \le b \le N$.</p>
<p>
You are given $G(1000,100)=398$.
</p><p>
Find $G(10^{17},1\,000\,000).$
</p> | 23707109 | Saturday, 17th February 2024, 01:00 pm | 258 | 40% | medium |
60 | Prime Pair Sets | The primes $3$, $7$, $109$, and $673$, are quite remarkable. By taking any two primes and concatenating them in any order the result will always be prime. For example, taking $7$ and $109$, both $7109$ and $1097$ are prime. The sum of these four primes, $792$, represents the lowest sum for a set of four primes with this property.
Find the lowest sum for a set of five primes for which any two primes concatenate to produce another prime. | The primes $3$, $7$, $109$, and $673$, are quite remarkable. By taking any two primes and concatenating them in any order the result will always be prime. For example, taking $7$ and $109$, both $7109$ and $1097$ are prime. The sum of these four primes, $792$, represents the lowest sum for a set of four primes with this property.
Find the lowest sum for a set of five primes for which any two primes concatenate to produce another prime. | <p>The primes $3$, $7$, $109$, and $673$, are quite remarkable. By taking any two primes and concatenating them in any order the result will always be prime. For example, taking $7$ and $109$, both $7109$ and $1097$ are prime. The sum of these four primes, $792$, represents the lowest sum for a set of four primes with this property.</p>
<p>Find the lowest sum for a set of five primes for which any two primes concatenate to produce another prime.</p> | 26033 | Friday, 2nd January 2004, 06:00 pm | 30207 | 20% | easy |
531 | Chinese Leftovers | Let $g(a, n, b, m)$ be the smallest non-negative solution $x$ to the system:
$x = a \bmod n$
$x = b \bmod m$
if such a solution exists, otherwise $0$.
E.g. $g(2,4,4,6)=10$, but $g(3,4,4,6)=0$.
Let $\phi(n)$ be Euler's totient function.
Let $f(n,m)=g(\phi(n),n,\phi(m),m)$
Find $\sum f(n,m)$ for $1000000 \le n \lt m \lt 1005000$. | Let $g(a, n, b, m)$ be the smallest non-negative solution $x$ to the system:
$x = a \bmod n$
$x = b \bmod m$
if such a solution exists, otherwise $0$.
E.g. $g(2,4,4,6)=10$, but $g(3,4,4,6)=0$.
Let $\phi(n)$ be Euler's totient function.
Let $f(n,m)=g(\phi(n),n,\phi(m),m)$
Find $\sum f(n,m)$ for $1000000 \le n \lt m \lt 1005000$. | <p>
Let $g(a, n, b, m)$ be the smallest non-negative solution $x$ to the system:<br/>
$x = a \bmod n$<br/>
$x = b \bmod m$<br/>
if such a solution exists, otherwise $0$.
</p>
<p>
E.g. $g(2,4,4,6)=10$, but $g(3,4,4,6)=0$.
</p>
<p>
Let $\phi(n)$ be Euler's totient function.
</p>
<p>
Let $f(n,m)=g(\phi(n),n,\phi(m),m)$
</p>
<p>
Find $\sum f(n,m)$ for $1000000 \le n \lt m \lt 1005000$.
</p> | 4515432351156203105 | Sunday, 25th October 2015, 04:00 am | 1290 | 25% | easy |
613 | Pythagorean Ant | Dave is doing his homework on the balcony and, preparing a presentation about Pythagorean triangles, has just cut out a triangle with side lengths 30cm, 40cm and 50cm from some cardboard, when a gust of wind blows the triangle down into the garden.
Another gust blows a small ant straight onto this triangle. The poor ant is completely disoriented and starts to crawl straight ahead in random direction in order to get back into the grass.
Assuming that all possible positions of the ant within the triangle and all possible directions of moving on are equiprobable, what is the probability that the ant leaves the triangle along its longest side?
Give your answer rounded to 10 digits after the decimal point. | Dave is doing his homework on the balcony and, preparing a presentation about Pythagorean triangles, has just cut out a triangle with side lengths 30cm, 40cm and 50cm from some cardboard, when a gust of wind blows the triangle down into the garden.
Another gust blows a small ant straight onto this triangle. The poor ant is completely disoriented and starts to crawl straight ahead in random direction in order to get back into the grass.
Assuming that all possible positions of the ant within the triangle and all possible directions of moving on are equiprobable, what is the probability that the ant leaves the triangle along its longest side?
Give your answer rounded to 10 digits after the decimal point. | <p>Dave is doing his homework on the balcony and, preparing a presentation about Pythagorean triangles, has just cut out a triangle with side lengths 30cm, 40cm and 50cm from some cardboard, when a gust of wind blows the triangle down into the garden.<br>
Another gust blows a small ant straight onto this triangle. The poor ant is completely disoriented and starts to crawl straight ahead in random direction in order to get back into the grass.</br></p>
<p>Assuming that all possible positions of the ant within the triangle and all possible directions of moving on are equiprobable, what is the probability that the ant leaves the triangle along its longest side?<br/>
Give your answer rounded to 10 digits after the decimal point.</p> | 0.3916721504 | Sunday, 5th November 2017, 04:00 am | 1990 | 20% | easy |
625 | Gcd Sum | $G(N)=\sum_{j=1}^N\sum_{i=1}^j \gcd(i,j)$.
You are given: $G(10)=122$.
Find $G(10^{11})$. Give your answer modulo $998244353$. | $G(N)=\sum_{j=1}^N\sum_{i=1}^j \gcd(i,j)$.
You are given: $G(10)=122$.
Find $G(10^{11})$. Give your answer modulo $998244353$. | <p>
$G(N)=\sum_{j=1}^N\sum_{i=1}^j \gcd(i,j)$. <br/>
You are given: $G(10)=122$.</p>
<p>
Find $G(10^{11})$. Give your answer modulo $998244353$.
</p> | 551614306 | Saturday, 21st April 2018, 04:00 pm | 713 | 35% | medium |
494 | Collatz Prefix Families | The Collatz sequence is defined as:
$a_{i+1} = \left\{ \large{\frac {a_i} 2 \atop 3 a_i+1} {\text{if }a_i\text{ is even} \atop \text{if }a_i\text{ is odd}} \right.$.
The Collatz conjecture states that starting from any positive integer, the sequence eventually reaches the cycle $1,4,2,1, \dots$.
We shall define the sequence prefix $p(n)$ for the Collatz sequence starting with $a_1 = n$ as the sub-sequence of all numbers not a power of $2$ ($2^0=1$ is considered a power of $2$ for this problem). For example:$p(13) = \{13, 40, 20, 10, 5\}$ $p(8) = \{\}$
Any number invalidating the conjecture would have an infinite length sequence prefix.
Let $S_m$ be the set of all sequence prefixes of length $m$. Two sequences $\{a_1, a_2, \dots, a_m\}$ and $\{b_1, b_2, \dots, b_m\}$ in $S_m$ are said to belong to the same prefix family if $a_i \lt a_j$ if and only if $b_i \lt b_j$ for all $1 \le i,j \le m$.
For example, in $S_4$, $\{6, 3, 10, 5\}$ is in the same family as $\{454, 227, 682, 341\}$, but not $\{113, 340, 170, 85\}$.
Let $f(m)$ be the number of distinct prefix families in $S_m$.
You are given $f(5) = 5$, $f(10) = 55$, $f(20) = 6771$.
Find $f(90)$. | The Collatz sequence is defined as:
$a_{i+1} = \left\{ \large{\frac {a_i} 2 \atop 3 a_i+1} {\text{if }a_i\text{ is even} \atop \text{if }a_i\text{ is odd}} \right.$.
The Collatz conjecture states that starting from any positive integer, the sequence eventually reaches the cycle $1,4,2,1, \dots$.
We shall define the sequence prefix $p(n)$ for the Collatz sequence starting with $a_1 = n$ as the sub-sequence of all numbers not a power of $2$ ($2^0=1$ is considered a power of $2$ for this problem). For example:$p(13) = \{13, 40, 20, 10, 5\}$ $p(8) = \{\}$
Any number invalidating the conjecture would have an infinite length sequence prefix.
Let $S_m$ be the set of all sequence prefixes of length $m$. Two sequences $\{a_1, a_2, \dots, a_m\}$ and $\{b_1, b_2, \dots, b_m\}$ in $S_m$ are said to belong to the same prefix family if $a_i \lt a_j$ if and only if $b_i \lt b_j$ for all $1 \le i,j \le m$.
For example, in $S_4$, $\{6, 3, 10, 5\}$ is in the same family as $\{454, 227, 682, 341\}$, but not $\{113, 340, 170, 85\}$.
Let $f(m)$ be the number of distinct prefix families in $S_m$.
You are given $f(5) = 5$, $f(10) = 55$, $f(20) = 6771$.
Find $f(90)$. | <p>
The Collatz sequence is defined as:
$a_{i+1} = \left\{ \large{\frac {a_i} 2 \atop 3 a_i+1} {\text{if }a_i\text{ is even} \atop \text{if }a_i\text{ is odd}} \right.$.
</p>
<p>
The Collatz conjecture states that starting from any positive integer, the sequence eventually reaches the cycle $1,4,2,1, \dots$.<br/>
We shall define the sequence prefix $p(n)$ for the Collatz sequence starting with $a_1 = n$ as the sub-sequence of all numbers not a power of $2$ ($2^0=1$ is considered a power of $2$ for this problem). For example:<br/>$p(13) = \{13, 40, 20, 10, 5\}$ <br/>$p(8) = \{\}$<br/>
Any number invalidating the conjecture would have an infinite length sequence prefix.
</p>
<p>
Let $S_m$ be the set of all sequence prefixes of length $m$. Two sequences $\{a_1, a_2, \dots, a_m\}$ and $\{b_1, b_2, \dots, b_m\}$ in $S_m$ are said to belong to the same prefix family if $a_i \lt a_j$ if and only if $b_i \lt b_j$ for all $1 \le i,j \le m$.
</p>
<p>
For example, in $S_4$, $\{6, 3, 10, 5\}$ is in the same family as $\{454, 227, 682, 341\}$, but not $\{113, 340, 170, 85\}$.<br/>
Let $f(m)$ be the number of distinct prefix families in $S_m$.<br/>
You are given $f(5) = 5$, $f(10) = 55$, $f(20) = 6771$.
</p>
<p>
Find $f(90)$.
</p> | 2880067194446832666 | Saturday, 20th December 2014, 07:00 pm | 245 | 100% | hard |
793 | Median of Products | Let $S_i$ be an integer sequence produced with the following pseudo-random number generator:
$S_0 = 290797$
$S_{i+1} = S_i ^2 \bmod 50515093$
Let $M(n)$ be the median of the pairwise products $ S_i S_j $ for $0 \le i \lt j \lt n$.
You are given $M(3) = 3878983057768$ and $M(103) = 492700616748525$.
Find $M(1\,000\,003)$. | Let $S_i$ be an integer sequence produced with the following pseudo-random number generator:
$S_0 = 290797$
$S_{i+1} = S_i ^2 \bmod 50515093$
Let $M(n)$ be the median of the pairwise products $ S_i S_j $ for $0 \le i \lt j \lt n$.
You are given $M(3) = 3878983057768$ and $M(103) = 492700616748525$.
Find $M(1\,000\,003)$. | <p>
Let $S_i$ be an integer sequence produced with the following pseudo-random number generator:
</p>
<ul>
<li>$S_0 = 290797$</li>
<li> $S_{i+1} = S_i ^2 \bmod 50515093$</li>
</ul>
<p>
Let $M(n)$ be the median of the pairwise products $ S_i S_j $ for $0 \le i \lt j \lt n$.
</p>
<p>
You are given $M(3) = 3878983057768$ and $M(103) = 492700616748525$.
</p>
<p>
Find $M(1\,000\,003)$.
</p> | 475808650131120 | Sunday, 10th April 2022, 08:00 am | 740 | 20% | easy |
65 | Convergents of $e$ | The square root of $2$ can be written as an infinite continued fraction.
$\sqrt{2} = 1 + \dfrac{1}{2 + \dfrac{1}{2 + \dfrac{1}{2 + \dfrac{1}{2 + ...}}}}$
The infinite continued fraction can be written, $\sqrt{2} = [1; (2)]$, $(2)$ indicates that $2$ repeats ad infinitum. In a similar way, $\sqrt{23} = [4; (1, 3, 1, 8)]$.
It turns out that the sequence of partial values of continued fractions for square roots provide the best rational approximations. Let us consider the convergents for $\sqrt{2}$.
$\begin{align}
&1 + \dfrac{1}{2} = \dfrac{3}{2} \\
&1 + \dfrac{1}{2 + \dfrac{1}{2}} = \dfrac{7}{5}\\
&1 + \dfrac{1}{2 + \dfrac{1}{2 + \dfrac{1}{2}}} = \dfrac{17}{12}\\
&1 + \dfrac{1}{2 + \dfrac{1}{2 + \dfrac{1}{2 + \dfrac{1}{2}}}} = \dfrac{41}{29}
\end{align}$
Hence the sequence of the first ten convergents for $\sqrt{2}$ are:
$1, \dfrac{3}{2}, \dfrac{7}{5}, \dfrac{17}{12}, \dfrac{41}{29}, \dfrac{99}{70}, \dfrac{239}{169}, \dfrac{577}{408}, \dfrac{1393}{985}, \dfrac{3363}{2378}, ...$
What is most surprising is that the important mathematical constant,$e = [2; 1, 2, 1, 1, 4, 1, 1, 6, 1, ... , 1, 2k, 1, ...]$.
The first ten terms in the sequence of convergents for $e$ are:
$2, 3, \dfrac{8}{3}, \dfrac{11}{4}, \dfrac{19}{7}, \dfrac{87}{32}, \dfrac{106}{39}, \dfrac{193}{71}, \dfrac{1264}{465}, \dfrac{1457}{536}, ...$
The sum of digits in the numerator of the $10$th convergent is $1 + 4 + 5 + 7 = 17$.
Find the sum of digits in the numerator of the $100$th convergent of the continued fraction for $e$. | The square root of $2$ can be written as an infinite continued fraction.
$\sqrt{2} = 1 + \dfrac{1}{2 + \dfrac{1}{2 + \dfrac{1}{2 + \dfrac{1}{2 + ...}}}}$
The infinite continued fraction can be written, $\sqrt{2} = [1; (2)]$, $(2)$ indicates that $2$ repeats ad infinitum. In a similar way, $\sqrt{23} = [4; (1, 3, 1, 8)]$.
It turns out that the sequence of partial values of continued fractions for square roots provide the best rational approximations. Let us consider the convergents for $\sqrt{2}$.
$\begin{align}
&1 + \dfrac{1}{2} = \dfrac{3}{2} \\
&1 + \dfrac{1}{2 + \dfrac{1}{2}} = \dfrac{7}{5}\\
&1 + \dfrac{1}{2 + \dfrac{1}{2 + \dfrac{1}{2}}} = \dfrac{17}{12}\\
&1 + \dfrac{1}{2 + \dfrac{1}{2 + \dfrac{1}{2 + \dfrac{1}{2}}}} = \dfrac{41}{29}
\end{align}$
Hence the sequence of the first ten convergents for $\sqrt{2}$ are:
$1, \dfrac{3}{2}, \dfrac{7}{5}, \dfrac{17}{12}, \dfrac{41}{29}, \dfrac{99}{70}, \dfrac{239}{169}, \dfrac{577}{408}, \dfrac{1393}{985}, \dfrac{3363}{2378}, ...$
What is most surprising is that the important mathematical constant,$e = [2; 1, 2, 1, 1, 4, 1, 1, 6, 1, ... , 1, 2k, 1, ...]$.
The first ten terms in the sequence of convergents for $e$ are:
$2, 3, \dfrac{8}{3}, \dfrac{11}{4}, \dfrac{19}{7}, \dfrac{87}{32}, \dfrac{106}{39}, \dfrac{193}{71}, \dfrac{1264}{465}, \dfrac{1457}{536}, ...$
The sum of digits in the numerator of the $10$th convergent is $1 + 4 + 5 + 7 = 17$.
Find the sum of digits in the numerator of the $100$th convergent of the continued fraction for $e$. | <p>The square root of $2$ can be written as an infinite continued fraction.</p>
<p>$\sqrt{2} = 1 + \dfrac{1}{2 + \dfrac{1}{2 + \dfrac{1}{2 + \dfrac{1}{2 + ...}}}}$</p>
<p>The infinite continued fraction can be written, $\sqrt{2} = [1; (2)]$, $(2)$ indicates that $2$ repeats <i>ad infinitum</i>. In a similar way, $\sqrt{23} = [4; (1, 3, 1, 8)]$.</p>
<p>It turns out that the sequence of partial values of continued fractions for square roots provide the best rational approximations. Let us consider the convergents for $\sqrt{2}$.</p>
<p>$\begin{align}
&1 + \dfrac{1}{2} = \dfrac{3}{2} \\
&1 + \dfrac{1}{2 + \dfrac{1}{2}} = \dfrac{7}{5}\\
&1 + \dfrac{1}{2 + \dfrac{1}{2 + \dfrac{1}{2}}} = \dfrac{17}{12}\\
&1 + \dfrac{1}{2 + \dfrac{1}{2 + \dfrac{1}{2 + \dfrac{1}{2}}}} = \dfrac{41}{29}
\end{align}$</p>
<p>Hence the sequence of the first ten convergents for $\sqrt{2}$ are:</p>
<p>$1, \dfrac{3}{2}, \dfrac{7}{5}, \dfrac{17}{12}, \dfrac{41}{29}, \dfrac{99}{70}, \dfrac{239}{169}, \dfrac{577}{408}, \dfrac{1393}{985}, \dfrac{3363}{2378}, ...$</p>
<p>What is most surprising is that the important mathematical constant,<br/>$e = [2; 1, 2, 1, 1, 4, 1, 1, 6, 1, ... , 1, 2k, 1, ...]$.</p>
<p>The first ten terms in the sequence of convergents for $e$ are:</p>
<p>$2, 3, \dfrac{8}{3}, \dfrac{11}{4}, \dfrac{19}{7}, \dfrac{87}{32}, \dfrac{106}{39}, \dfrac{193}{71}, \dfrac{1264}{465}, \dfrac{1457}{536}, ...$</p>
<p>The sum of digits in the numerator of the $10$<sup>th</sup> convergent is $1 + 4 + 5 + 7 = 17$.</p>
<p>Find the sum of digits in the numerator of the $100$<sup>th</sup> convergent of the continued fraction for $e$.</p> | 272 | Friday, 12th March 2004, 06:00 pm | 33122 | 15% | easy |
235 | An Arithmetic Geometric Sequence | Given is the arithmetic-geometric sequence $u(k) = (900-3k)r^{k - 1}$.
Let $s(n) = \sum_{k = 1}^n u(k)$.
Find the value of $r$ for which $s(5000) = -600\,000\,000\,000$.
Give your answer rounded to $12$ places behind the decimal point. | Given is the arithmetic-geometric sequence $u(k) = (900-3k)r^{k - 1}$.
Let $s(n) = \sum_{k = 1}^n u(k)$.
Find the value of $r$ for which $s(5000) = -600\,000\,000\,000$.
Give your answer rounded to $12$ places behind the decimal point. | <p>
Given is the arithmetic-geometric sequence $u(k) = (900-3k)r^{k - 1}$.<br/>
Let $s(n) = \sum_{k = 1}^n u(k)$.
</p>
<p>
Find the value of $r$ for which $s(5000) = -600\,000\,000\,000$.
</p>
<p>
Give your answer rounded to $12$ places behind the decimal point.
</p> | 1.002322108633 | Saturday, 7th March 2009, 05:00 am | 5406 | 40% | medium |
593 | Fleeting Medians | We define two sequences $S = \{S(1), S(2), ..., S(n)\}$ and $S_2 = \{S_2(1), S_2(2), ..., S_2(n)\}$:
$S(k) = (p_k)^k \bmod 10007$ where $p_k$ is the $k$th prime number.
$S_2(k) = S(k) + S(\lfloor\frac{k}{10000}\rfloor + 1)$ where $\lfloor \cdot \rfloor$ denotes the floor function.
Then let $M(i, j)$ be the median of elements $S_2(i)$ through $S_2(j)$, inclusive. For example, $M(1, 10) = 2021.5$ and $M(10^2, 10^3) = 4715.0$.
Let $F(n, k) = \sum_{i=1}^{n-k+1} M(i, i + k - 1)$. For example, $F(100, 10) = 463628.5$ and $F(10^5, 10^4) = 675348207.5$.
Find $F(10^7, 10^5)$. If the sum is not an integer, use $.5$ to denote a half. Otherwise, use $.0$ instead. | We define two sequences $S = \{S(1), S(2), ..., S(n)\}$ and $S_2 = \{S_2(1), S_2(2), ..., S_2(n)\}$:
$S(k) = (p_k)^k \bmod 10007$ where $p_k$ is the $k$th prime number.
$S_2(k) = S(k) + S(\lfloor\frac{k}{10000}\rfloor + 1)$ where $\lfloor \cdot \rfloor$ denotes the floor function.
Then let $M(i, j)$ be the median of elements $S_2(i)$ through $S_2(j)$, inclusive. For example, $M(1, 10) = 2021.5$ and $M(10^2, 10^3) = 4715.0$.
Let $F(n, k) = \sum_{i=1}^{n-k+1} M(i, i + k - 1)$. For example, $F(100, 10) = 463628.5$ and $F(10^5, 10^4) = 675348207.5$.
Find $F(10^7, 10^5)$. If the sum is not an integer, use $.5$ to denote a half. Otherwise, use $.0$ instead. | <p>We define two sequences $S = \{S(1), S(2), ..., S(n)\}$ and $S_2 = \{S_2(1), S_2(2), ..., S_2(n)\}$:</p>
<p>$S(k) = (p_k)^k \bmod 10007$ where $p_k$ is the $k$th prime number.</p>
<p>$S_2(k) = S(k) + S(\lfloor\frac{k}{10000}\rfloor + 1)$ where $\lfloor \cdot \rfloor$ denotes the floor function.</p>
<p>Then let $M(i, j)$ be the median of elements $S_2(i)$ through $S_2(j)$, inclusive. For example, $M(1, 10) = 2021.5$ and $M(10^2, 10^3) = 4715.0$.</p>
<p>Let $F(n, k) = \sum_{i=1}^{n-k+1} M(i, i + k - 1)$. For example, $F(100, 10) = 463628.5$ and $F(10^5, 10^4) = 675348207.5$.</p>
<p>Find $F(10^7, 10^5)$. If the sum is not an integer, use $.5$ to denote a half. Otherwise, use $.0$ instead.</p> | 96632320042.0 | Saturday, 4th March 2017, 07:00 pm | 601 | 35% | medium |
599 | Distinct Colourings of a Rubik's Cube | The well-known Rubik's Cube puzzle has many fascinating mathematical properties. The 2×2×2 variant has 8 cubelets with a total of 24 visible faces, each with a coloured sticker. Successively turning faces will rearrange the cubelets, although not all arrangements of cubelets are reachable without dismantling the puzzle.
Suppose that we wish to apply new stickers to a 2×2×2 Rubik's cube in a non-standard colouring. Specifically, we have $n$ different colours available (with an unlimited supply of stickers of each colour), and we place one sticker on each of the 24 faces in any arrangement that we please. We are not required to use all the colours, and if desired the same colour may appear in more than one face of a single cubelet.
We say that two such colourings $c_1,c_2$ are essentially distinct if a cube coloured according to $c_1$ cannot be made to match a cube coloured according to $c_2$ by performing mechanically possible Rubik's Cube moves.
For example, with two colours available, there are 183 essentially distinct colourings.
How many essentially distinct colourings are there with 10 different colours available? | The well-known Rubik's Cube puzzle has many fascinating mathematical properties. The 2×2×2 variant has 8 cubelets with a total of 24 visible faces, each with a coloured sticker. Successively turning faces will rearrange the cubelets, although not all arrangements of cubelets are reachable without dismantling the puzzle.
Suppose that we wish to apply new stickers to a 2×2×2 Rubik's cube in a non-standard colouring. Specifically, we have $n$ different colours available (with an unlimited supply of stickers of each colour), and we place one sticker on each of the 24 faces in any arrangement that we please. We are not required to use all the colours, and if desired the same colour may appear in more than one face of a single cubelet.
We say that two such colourings $c_1,c_2$ are essentially distinct if a cube coloured according to $c_1$ cannot be made to match a cube coloured according to $c_2$ by performing mechanically possible Rubik's Cube moves.
For example, with two colours available, there are 183 essentially distinct colourings.
How many essentially distinct colourings are there with 10 different colours available? | <p>
The well-known <strong>Rubik's Cube</strong> puzzle has many fascinating mathematical properties. The 2×2×2 variant has 8 cubelets with a total of 24 visible faces, each with a coloured sticker. Successively turning faces will rearrange the cubelets, although not all arrangements of cubelets are reachable without dismantling the puzzle.
</p>
<p>
Suppose that we wish to apply new stickers to a 2×2×2 Rubik's cube in a non-standard colouring. Specifically, we have $n$ different colours available (with an unlimited supply of stickers of each colour), and we place one sticker on each of the 24 faces in any arrangement that we please. We are not required to use all the colours, and if desired the same colour may appear in more than one face of a single cubelet.
</p>
<p>
We say that two such colourings $c_1,c_2$ are <em>essentially distinct</em> if a cube coloured according to $c_1$ cannot be made to match a cube coloured according to $c_2$ by performing mechanically possible Rubik's Cube moves.
</p>
<p>
For example, with two colours available, there are 183 essentially distinct colourings.
</p>
<p>
How many essentially distinct colourings are there with 10 different colours available?
</p> | 12395526079546335 | Saturday, 15th April 2017, 01:00 pm | 342 | 60% | hard |
502 | Counting Castles | We define a block to be a rectangle with a height of $1$ and an integer-valued length. Let a castle be a configuration of stacked blocks.
Given a game grid that is $w$ units wide and $h$ units tall, a castle is generated according to the following rules:
Blocks can be placed on top of other blocks as long as nothing sticks out past the edges or hangs out over open space.
All blocks are aligned/snapped to the grid.
Any two neighboring blocks on the same row have at least one unit of space between them.
The bottom row is occupied by a block of length $w$.
The maximum achieved height of the entire castle is exactly $h$.
The castle is made from an even number of blocks.
The following is a sample castle for $w=8$ and $h=5$:
Let $F(w,h)$ represent the number of valid castles, given grid parameters $w$ and $h$.
For example, $F(4,2) = 10$, $F(13,10) = 3729050610636$, $F(10,13) = 37959702514$, and $F(100,100) \bmod 1\,000\,000\,007 = 841913936$.
Find $(F(10^{12},100) + F(10000,10000) + F(100,10^{12})) \bmod 1\,000\,000\,007$. | We define a block to be a rectangle with a height of $1$ and an integer-valued length. Let a castle be a configuration of stacked blocks.
Given a game grid that is $w$ units wide and $h$ units tall, a castle is generated according to the following rules:
Blocks can be placed on top of other blocks as long as nothing sticks out past the edges or hangs out over open space.
All blocks are aligned/snapped to the grid.
Any two neighboring blocks on the same row have at least one unit of space between them.
The bottom row is occupied by a block of length $w$.
The maximum achieved height of the entire castle is exactly $h$.
The castle is made from an even number of blocks.
The following is a sample castle for $w=8$ and $h=5$:
Let $F(w,h)$ represent the number of valid castles, given grid parameters $w$ and $h$.
For example, $F(4,2) = 10$, $F(13,10) = 3729050610636$, $F(10,13) = 37959702514$, and $F(100,100) \bmod 1\,000\,000\,007 = 841913936$.
Find $(F(10^{12},100) + F(10000,10000) + F(100,10^{12})) \bmod 1\,000\,000\,007$. | <p>We define a <dfn>block</dfn> to be a rectangle with a height of $1$ and an integer-valued length. Let a <dfn>castle</dfn> be a configuration of stacked blocks.</p>
<p>Given a game grid that is $w$ units wide and $h$ units tall, a castle is generated according to the following rules:</p>
<ol><li>Blocks can be placed on top of other blocks as long as nothing sticks out past the edges or hangs out over open space.</li>
<li>All blocks are aligned/snapped to the grid.</li>
<li>Any two neighboring blocks on the same row have at least one unit of space between them.</li>
<li>The bottom row is occupied by a block of length $w$.</li>
<li>The maximum achieved height of the entire castle is exactly $h$.</li>
<li>The castle is made from an even number of blocks.</li>
</ol><p>The following is a sample castle for $w=8$ and $h=5$:</p>
<p align="center"><img alt="0502_castles.png" src="resources/images/0502_castles.png?1678992053"/></p>
<p>Let $F(w,h)$ represent the number of valid castles, given grid parameters $w$ and $h$.</p>
<p>For example, $F(4,2) = 10$, $F(13,10) = 3729050610636$, $F(10,13) = 37959702514$, and $F(100,100) \bmod 1\,000\,000\,007 = 841913936$.</p>
<p>Find $(F(10^{12},100) + F(10000,10000) + F(100,10^{12})) \bmod 1\,000\,000\,007$.</p> | 749485217 | Saturday, 7th February 2015, 04:00 pm | 332 | 100% | hard |
41 | Pandigital Prime | We shall say that an $n$-digit number is pandigital if it makes use of all the digits $1$ to $n$ exactly once. For example, $2143$ is a $4$-digit pandigital and is also prime.
What is the largest $n$-digit pandigital prime that exists? | We shall say that an $n$-digit number is pandigital if it makes use of all the digits $1$ to $n$ exactly once. For example, $2143$ is a $4$-digit pandigital and is also prime.
What is the largest $n$-digit pandigital prime that exists? | <p>We shall say that an $n$-digit number is pandigital if it makes use of all the digits $1$ to $n$ exactly once. For example, $2143$ is a $4$-digit pandigital and is also prime.</p>
<p>What is the largest $n$-digit pandigital prime that exists?</p> | 7652413 | Friday, 11th April 2003, 06:00 pm | 74695 | 5% | easy |
543 | Prime-Sum Numbers | Define function $P(n, k) = 1$ if $n$ can be written as the sum of $k$ prime numbers (with repetitions allowed), and $P(n, k) = 0$ otherwise.
For example, $P(10,2) = 1$ because $10$ can be written as either $3 + 7$ or $5 + 5$, but $P(11,2) = 0$ because no two primes can sum to $11$.
Let $S(n)$ be the sum of all $P(i,k)$ over $1 \le i,k \le n$.
For example, $S(10) = 20$, $S(100) = 2402$, and $S(1000) = 248838$.
Let $F(k)$ be the $k$th Fibonacci number (with $F(0) = 0$ and $F(1) = 1$).
Find the sum of all $S(F(k))$ over $3 \le k \le 44$. | Define function $P(n, k) = 1$ if $n$ can be written as the sum of $k$ prime numbers (with repetitions allowed), and $P(n, k) = 0$ otherwise.
For example, $P(10,2) = 1$ because $10$ can be written as either $3 + 7$ or $5 + 5$, but $P(11,2) = 0$ because no two primes can sum to $11$.
Let $S(n)$ be the sum of all $P(i,k)$ over $1 \le i,k \le n$.
For example, $S(10) = 20$, $S(100) = 2402$, and $S(1000) = 248838$.
Let $F(k)$ be the $k$th Fibonacci number (with $F(0) = 0$ and $F(1) = 1$).
Find the sum of all $S(F(k))$ over $3 \le k \le 44$. | <p>Define function $P(n, k) = 1$ if $n$ can be written as the sum of $k$ prime numbers (with repetitions allowed), and $P(n, k) = 0$ otherwise.</p>
<p>For example, $P(10,2) = 1$ because $10$ can be written as either $3 + 7$ or $5 + 5$, but $P(11,2) = 0$ because no two primes can sum to $11$.</p>
<p>Let $S(n)$ be the sum of all $P(i,k)$ over $1 \le i,k \le n$.</p>
<p>For example, $S(10) = 20$, $S(100) = 2402$, and $S(1000) = 248838$.</p>
<p>Let $F(k)$ be the $k$th Fibonacci number (with $F(0) = 0$ and $F(1) = 1$).</p>
<p>Find the sum of all $S(F(k))$ over $3 \le k \le 44$.</p> | 199007746081234640 | Saturday, 16th January 2016, 04:00 pm | 766 | 30% | easy |
862 | Larger Digit Permutation | For a positive integer $n$ define $T(n)$ to be the number of strictly larger integers which can be formed by permuting the digits of $n$.
Leading zeros are not allowed and so for $n = 2302$ the total list of permutations would be:
$2023,2032,2203,2230,\mathbf{2302},2320,3022,32 02,3220$
giving $T(2302)=4$.
Further define $S(k)$ to be the sum of $T(n)$ for all $k$-digit numbers $n$. You are given $S(3) = 1701$.
Find $S(12)$. | For a positive integer $n$ define $T(n)$ to be the number of strictly larger integers which can be formed by permuting the digits of $n$.
Leading zeros are not allowed and so for $n = 2302$ the total list of permutations would be:
$2023,2032,2203,2230,\mathbf{2302},2320,3022,32 02,3220$
giving $T(2302)=4$.
Further define $S(k)$ to be the sum of $T(n)$ for all $k$-digit numbers $n$. You are given $S(3) = 1701$.
Find $S(12)$. | <p>
For a positive integer $n$ define $T(n)$ to be the number of strictly larger integers which can be formed by permuting the digits of $n$.</p>
<p>
Leading zeros are not allowed and so for $n = 2302$ the total list of permutations would be:</p>
<div style="text-align:center;">
$2023,2032,2203,2230,\mathbf{2302},2320,3022,32 02,3220$</div>
<p>
giving $T(2302)=4$.</p>
<p>
Further define $S(k)$ to be the sum of $T(n)$ for all $k$-digit numbers $n$. You are given $S(3) = 1701$.</p>
<p>
Find $S(12)$.</p> | 6111397420935766740 | Saturday, 4th November 2023, 04:00 pm | 802 | 10% | easy |
388 | Distinct Lines | Consider all lattice points $(a,b,c)$ with $0 \le a,b,c \le N$.
From the origin $O(0,0,0)$ all lines are drawn to the other lattice points.
Let $D(N)$ be the number of distinct such lines.
You are given that $D(1\,000\,000) = 831909254469114121$.
Find $D(10^{10})$. Give as your answer the first nine digits followed by the last nine digits. | Consider all lattice points $(a,b,c)$ with $0 \le a,b,c \le N$.
From the origin $O(0,0,0)$ all lines are drawn to the other lattice points.
Let $D(N)$ be the number of distinct such lines.
You are given that $D(1\,000\,000) = 831909254469114121$.
Find $D(10^{10})$. Give as your answer the first nine digits followed by the last nine digits. | <p>
Consider all lattice points $(a,b,c)$ with $0 \le a,b,c \le N$.
</p>
<p>
From the origin $O(0,0,0)$ all lines are drawn to the other lattice points.<br/>
Let $D(N)$ be the number of <i>distinct</i> such lines.
</p>
<p>
You are given that $D(1\,000\,000) = 831909254469114121$.
</p><p>
Find $D(10^{10})$. Give as your answer the first nine digits followed by the last nine digits.
</p> | 831907372805129931 | Saturday, 9th June 2012, 02:00 pm | 653 | 55% | medium |
533 | Minimum Values of the Carmichael Function | The Carmichael function $\lambda(n)$ is defined as the smallest positive integer $m$ such that $a^m = 1$ modulo $n$ for all integers $a$ coprime with $n$.
For example $\lambda(8) = 2$ and $\lambda(240) = 4$.
Define $L(n)$ as the smallest positive integer $m$ such that $\lambda(k) \ge n$ for all $k \ge m$.
For example, $L(6) = 241$ and $L(100) = 20\,174\,525\,281$.
Find $L(20\,000\,000)$. Give the last $9$ digits of your answer. | The Carmichael function $\lambda(n)$ is defined as the smallest positive integer $m$ such that $a^m = 1$ modulo $n$ for all integers $a$ coprime with $n$.
For example $\lambda(8) = 2$ and $\lambda(240) = 4$.
Define $L(n)$ as the smallest positive integer $m$ such that $\lambda(k) \ge n$ for all $k \ge m$.
For example, $L(6) = 241$ and $L(100) = 20\,174\,525\,281$.
Find $L(20\,000\,000)$. Give the last $9$ digits of your answer. | <p>The <strong>Carmichael function</strong> $\lambda(n)$ is defined as the smallest positive integer $m$ such that $a^m = 1$ modulo $n$ for all integers $a$ coprime with $n$.<br/>
For example $\lambda(8) = 2$ and $\lambda(240) = 4$.</p>
<p>Define $L(n)$ as the smallest positive integer $m$ such that $\lambda(k) \ge n$ for all $k \ge m$.<br/>
For example, $L(6) = 241$ and $L(100) = 20\,174\,525\,281$.</p>
<p>Find $L(20\,000\,000)$. Give the last $9$ digits of your answer.</p> | 789453601 | Sunday, 8th November 2015, 10:00 am | 367 | 50% | medium |
432 | Totient Sum | Let $S(n,m) = \sum\phi(n \times i)$ for $1 \leq i \leq m$. ($\phi$ is Euler's totient function)
You are given that $S(510510,10^6)= 45480596821125120$.
Find $S(510510,10^{11})$.
Give the last $9$ digits of your answer. | Let $S(n,m) = \sum\phi(n \times i)$ for $1 \leq i \leq m$. ($\phi$ is Euler's totient function)
You are given that $S(510510,10^6)= 45480596821125120$.
Find $S(510510,10^{11})$.
Give the last $9$ digits of your answer. | <p>
Let $S(n,m) = \sum\phi(n \times i)$ for $1 \leq i \leq m$. ($\phi$ is Euler's totient function)<br/>
You are given that $S(510510,10^6)= 45480596821125120$.
</p>
<p>
Find $S(510510,10^{11})$.<br/>
Give the last $9$ digits of your answer.
</p> | 754862080 | Saturday, 15th June 2013, 01:00 pm | 559 | 70% | hard |
585 | Nested Square Roots | Consider the term $\small \sqrt{x+\sqrt{y}+\sqrt{z}}$ that is representing a nested square root. $x$, $y$ and $z$ are positive integers and $y$ and $z$ are not allowed to be perfect squares, so the number below the outer square root is irrational. Still it can be shown that for some combinations of $x$, $y$ and $z$ the given term can be simplified into a sum and/or difference of simple square roots of integers, actually denesting the square roots in the initial expression.
Here are some examples of this denesting:
$\small \sqrt{3+\sqrt{2}+\sqrt{2}}=\sqrt{2}+\sqrt{1}=\sqrt{2}+1$
$\small \sqrt{8+\sqrt{15}+\sqrt{15}}=\sqrt{5}+\sqrt{3}$
$\small \sqrt{20+\sqrt{96}+\sqrt{12}}=\sqrt{9}+\sqrt{6}+\sqrt{3}-\sqrt{2}=3+\sqrt{6}+\sqrt{3}-\sqrt{2}$
$\small \sqrt{28+\sqrt{160}+\sqrt{108}}=\sqrt{15}+\sqrt{6}+\sqrt{5}-\sqrt{2}$
As you can see the integers used in the denested expression may also be perfect squares resulting in further simplification.
Let F($n$) be the number of different terms $\small \sqrt{x+\sqrt{y}+\sqrt{z}}$, that can be denested into the sum and/or difference of a finite number of square roots, given the additional condition that $0<x \le n$. That is,
$\small \displaystyle \sqrt{x+\sqrt{y}+\sqrt{z}}=\sum_{i=1}^k s_i\sqrt{a_i}$
with $k$, $x$, $y$, $z$ and all $a_i$ being positive integers, all $s_i =\pm 1$ and $x\le n$. Furthermore $y$ and $z$ are not allowed to be perfect squares.
Nested roots with the same value are not considered different, for example $\small \sqrt{7+\sqrt{3}+\sqrt{27}}$, $\small \sqrt{7+\sqrt{12}+\sqrt{12}}$ and $\small \sqrt{7+\sqrt{27}+\sqrt{3}}$, that can all three be denested into $\small 2+\sqrt{3}$, would only be counted once.
You are given that $F(10)=17$, $F(15)=46$, $F(20)=86$, $F(30)=213$ and $F(100)=2918$ and $F(5000)=11134074$.
Find $F(5000000)$. | Consider the term $\small \sqrt{x+\sqrt{y}+\sqrt{z}}$ that is representing a nested square root. $x$, $y$ and $z$ are positive integers and $y$ and $z$ are not allowed to be perfect squares, so the number below the outer square root is irrational. Still it can be shown that for some combinations of $x$, $y$ and $z$ the given term can be simplified into a sum and/or difference of simple square roots of integers, actually denesting the square roots in the initial expression.
Here are some examples of this denesting:
$\small \sqrt{3+\sqrt{2}+\sqrt{2}}=\sqrt{2}+\sqrt{1}=\sqrt{2}+1$
$\small \sqrt{8+\sqrt{15}+\sqrt{15}}=\sqrt{5}+\sqrt{3}$
$\small \sqrt{20+\sqrt{96}+\sqrt{12}}=\sqrt{9}+\sqrt{6}+\sqrt{3}-\sqrt{2}=3+\sqrt{6}+\sqrt{3}-\sqrt{2}$
$\small \sqrt{28+\sqrt{160}+\sqrt{108}}=\sqrt{15}+\sqrt{6}+\sqrt{5}-\sqrt{2}$
As you can see the integers used in the denested expression may also be perfect squares resulting in further simplification.
Let F($n$) be the number of different terms $\small \sqrt{x+\sqrt{y}+\sqrt{z}}$, that can be denested into the sum and/or difference of a finite number of square roots, given the additional condition that $0<x \le n$. That is,
$\small \displaystyle \sqrt{x+\sqrt{y}+\sqrt{z}}=\sum_{i=1}^k s_i\sqrt{a_i}$
with $k$, $x$, $y$, $z$ and all $a_i$ being positive integers, all $s_i =\pm 1$ and $x\le n$. Furthermore $y$ and $z$ are not allowed to be perfect squares.
Nested roots with the same value are not considered different, for example $\small \sqrt{7+\sqrt{3}+\sqrt{27}}$, $\small \sqrt{7+\sqrt{12}+\sqrt{12}}$ and $\small \sqrt{7+\sqrt{27}+\sqrt{3}}$, that can all three be denested into $\small 2+\sqrt{3}$, would only be counted once.
You are given that $F(10)=17$, $F(15)=46$, $F(20)=86$, $F(30)=213$ and $F(100)=2918$ and $F(5000)=11134074$.
Find $F(5000000)$. | <p>Consider the term $\small \sqrt{x+\sqrt{y}+\sqrt{z}}$ that is representing a <strong>nested square root</strong>. $x$, $y$ and $z$ are positive integers and $y$ and $z$ are not allowed to be perfect squares, so the number below the outer square root is irrational. Still it can be shown that for some combinations of $x$, $y$ and $z$ the given term can be simplified into a sum and/or difference of simple square roots of integers, actually <strong>denesting</strong> the square roots in the initial expression. </p>
<p>Here are some examples of this denesting:<br/>
$\small \sqrt{3+\sqrt{2}+\sqrt{2}}=\sqrt{2}+\sqrt{1}=\sqrt{2}+1$<br/>
$\small \sqrt{8+\sqrt{15}+\sqrt{15}}=\sqrt{5}+\sqrt{3}$<br/>
$\small \sqrt{20+\sqrt{96}+\sqrt{12}}=\sqrt{9}+\sqrt{6}+\sqrt{3}-\sqrt{2}=3+\sqrt{6}+\sqrt{3}-\sqrt{2}$<br/>
$\small \sqrt{28+\sqrt{160}+\sqrt{108}}=\sqrt{15}+\sqrt{6}+\sqrt{5}-\sqrt{2}$</p>
<p>As you can see the integers used in the denested expression may also be perfect squares resulting in further simplification.</p>
<p>Let F($n$) be the number of different terms $\small \sqrt{x+\sqrt{y}+\sqrt{z}}$, that can be denested into the sum and/or difference of a finite number of square roots, given the additional condition that $0<x \le n$. That is,<br/>
$\small \displaystyle \sqrt{x+\sqrt{y}+\sqrt{z}}=\sum_{i=1}^k s_i\sqrt{a_i}$<br/>
with $k$, $x$, $y$, $z$ and all $a_i$ being positive integers, all $s_i =\pm 1$ and $x\le n$.<br/> Furthermore $y$ and $z$ are not allowed to be perfect squares.</p>
<p>Nested roots with the same value are not considered different, for example $\small \sqrt{7+\sqrt{3}+\sqrt{27}}$, $\small \sqrt{7+\sqrt{12}+\sqrt{12}}$ and $\small \sqrt{7+\sqrt{27}+\sqrt{3}}$, that can all three be denested into $\small 2+\sqrt{3}$, would only be counted once.</p>
<p>You are given that $F(10)=17$, $F(15)=46$, $F(20)=86$, $F(30)=213$ and $F(100)=2918$ and $F(5000)=11134074$.<br/>
Find $F(5000000)$.</p> | 17714439395932 | Saturday, 7th January 2017, 07:00 pm | 201 | 100% | hard |
133 | Repunit Nonfactors | A number consisting entirely of ones is called a repunit. We shall define $R(k)$ to be a repunit of length $k$; for example, $R(6) = 111111$.
Let us consider repunits of the form $R(10^n)$.
Although $R(10)$, $R(100)$, or $R(1000)$ are not divisible by $17$, $R(10000)$ is divisible by $17$. Yet there is no value of $n$ for which $R(10^n)$ will divide by $19$. In fact, it is remarkable that $11$, $17$, $41$, and $73$ are the only four primes below one-hundred that can be a factor of $R(10^n)$.
Find the sum of all the primes below one-hundred thousand that will never be a factor of $R(10^n)$. | A number consisting entirely of ones is called a repunit. We shall define $R(k)$ to be a repunit of length $k$; for example, $R(6) = 111111$.
Let us consider repunits of the form $R(10^n)$.
Although $R(10)$, $R(100)$, or $R(1000)$ are not divisible by $17$, $R(10000)$ is divisible by $17$. Yet there is no value of $n$ for which $R(10^n)$ will divide by $19$. In fact, it is remarkable that $11$, $17$, $41$, and $73$ are the only four primes below one-hundred that can be a factor of $R(10^n)$.
Find the sum of all the primes below one-hundred thousand that will never be a factor of $R(10^n)$. | <p>A number consisting entirely of ones is called a repunit. We shall define $R(k)$ to be a repunit of length $k$; for example, $R(6) = 111111$.</p>
<p>Let us consider repunits of the form $R(10^n)$.</p>
<p>Although $R(10)$, $R(100)$, or $R(1000)$ are not divisible by $17$, $R(10000)$ is divisible by $17$. Yet there is no value of $n$ for which $R(10^n)$ will divide by $19$. In fact, it is remarkable that $11$, $17$, $41$, and $73$ are the only four primes below one-hundred that can be a factor of $R(10^n)$.</p>
<p>Find the sum of all the primes below one-hundred thousand that will never be a factor of $R(10^n)$.</p> | 453647705 | Friday, 1st December 2006, 06:00 pm | 6222 | 50% | medium |
428 | Necklace of Circles | Let $a$, $b$ and $c$ be positive numbers.
Let $W, X, Y, Z$ be four collinear points where $|WX| = a$, $|XY| = b$, $|YZ| = c$ and $|WZ| = a + b + c$.
Let $C_{in}$ be the circle having the diameter $XY$.
Let $C_{out}$ be the circle having the diameter $WZ$.
The triplet $(a, b, c)$ is called a necklace triplet if you can place $k \geq 3$ distinct circles $C_1, C_2, \dots, C_k$ such that:
$C_i$ has no common interior points with any $C_j$ for $1 \leq i, j \leq k$ and $i \neq j$,
$C_i$ is tangent to both $C_{in}$ and $C_{out}$ for $1 \leq i \leq k$,
$C_i$ is tangent to $C_{i+1}$ for $1 \leq i \lt k$, and
$C_k$ is tangent to $C_1$.
For example, $(5, 5, 5)$ and $(4, 3, 21)$ are necklace triplets, while it can be shown that $(2, 2, 5)$ is not.
Let $T(n)$ be the number of necklace triplets $(a, b, c)$ such that $a$, $b$ and $c$ are positive integers, and $b \leq n$.
For example, $T(1) = 9$, $T(20) = 732$ and $T(3000) = 438106$.
Find $T(1\,000\,000\,000)$. | Let $a$, $b$ and $c$ be positive numbers.
Let $W, X, Y, Z$ be four collinear points where $|WX| = a$, $|XY| = b$, $|YZ| = c$ and $|WZ| = a + b + c$.
Let $C_{in}$ be the circle having the diameter $XY$.
Let $C_{out}$ be the circle having the diameter $WZ$.
The triplet $(a, b, c)$ is called a necklace triplet if you can place $k \geq 3$ distinct circles $C_1, C_2, \dots, C_k$ such that:
$C_i$ has no common interior points with any $C_j$ for $1 \leq i, j \leq k$ and $i \neq j$,
$C_i$ is tangent to both $C_{in}$ and $C_{out}$ for $1 \leq i \leq k$,
$C_i$ is tangent to $C_{i+1}$ for $1 \leq i \lt k$, and
$C_k$ is tangent to $C_1$.
For example, $(5, 5, 5)$ and $(4, 3, 21)$ are necklace triplets, while it can be shown that $(2, 2, 5)$ is not.
Let $T(n)$ be the number of necklace triplets $(a, b, c)$ such that $a$, $b$ and $c$ are positive integers, and $b \leq n$.
For example, $T(1) = 9$, $T(20) = 732$ and $T(3000) = 438106$.
Find $T(1\,000\,000\,000)$. | <p>Let $a$, $b$ and $c$ be positive numbers.<br/>
Let $W, X, Y, Z$ be four collinear points where $|WX| = a$, $|XY| = b$, $|YZ| = c$ and $|WZ| = a + b + c$.<br/>
Let $C_{in}$ be the circle having the diameter $XY$.<br/>
Let $C_{out}$ be the circle having the diameter $WZ$.<br/></p>
<p>
The triplet $(a, b, c)$ is called a <dfn>necklace triplet</dfn> if you can place $k \geq 3$ distinct circles $C_1, C_2, \dots, C_k$ such that:
</p><ul><li>$C_i$ has no common interior points with any $C_j$ for $1 \leq i, j \leq k$ and $i \neq j$,
</li><li>$C_i$ is tangent to both $C_{in}$ and $C_{out}$ for $1 \leq i \leq k$,
</li><li>$C_i$ is tangent to $C_{i+1}$ for $1 \leq i \lt k$, and
</li><li>$C_k$ is tangent to $C_1$.
</li></ul><p>
For example, $(5, 5, 5)$ and $(4, 3, 21)$ are necklace triplets, while it can be shown that $(2, 2, 5)$ is not.
</p>
<p align="center"><img alt="0428_necklace.png" class="dark_img" src="resources/images/0428_necklace.png?1678992053"/></p>
<p>
Let $T(n)$ be the number of necklace triplets $(a, b, c)$ such that $a$, $b$ and $c$ are positive integers, and $b \leq n$.
For example, $T(1) = 9$, $T(20) = 732$ and $T(3000) = 438106$.
</p>
<p>
Find $T(1\,000\,000\,000)$.
</p> | 747215561862 | Sunday, 19th May 2013, 01:00 am | 274 | 90% | hard |
139 | Pythagorean Tiles | Let $(a, b, c)$ represent the three sides of a right angle triangle with integral length sides. It is possible to place four such triangles together to form a square with length $c$.
For example, $(3, 4, 5)$ triangles can be placed together to form a $5$ by $5$ square with a $1$ by $1$ hole in the middle and it can be seen that the $5$ by $5$ square can be tiled with twenty-five $1$ by $1$ squares.
However, if $(5, 12, 13)$ triangles were used then the hole would measure $7$ by $7$ and these could not be used to tile the $13$ by $13$ square.
Given that the perimeter of the right triangle is less than one-hundred million, how many Pythagorean triangles would allow such a tiling to take place? | Let $(a, b, c)$ represent the three sides of a right angle triangle with integral length sides. It is possible to place four such triangles together to form a square with length $c$.
For example, $(3, 4, 5)$ triangles can be placed together to form a $5$ by $5$ square with a $1$ by $1$ hole in the middle and it can be seen that the $5$ by $5$ square can be tiled with twenty-five $1$ by $1$ squares.
However, if $(5, 12, 13)$ triangles were used then the hole would measure $7$ by $7$ and these could not be used to tile the $13$ by $13$ square.
Given that the perimeter of the right triangle is less than one-hundred million, how many Pythagorean triangles would allow such a tiling to take place? | <p>Let $(a, b, c)$ represent the three sides of a right angle triangle with integral length sides. It is possible to place four such triangles together to form a square with length $c$.</p>
<p>For example, $(3, 4, 5)$ triangles can be placed together to form a $5$ by $5$ square with a $1$ by $1$ hole in the middle and it can be seen that the $5$ by $5$ square can be tiled with twenty-five $1$ by $1$ squares.</p>
<div class="center">
<img alt="" class="dark_img" src="resources/images/0139.png?1678992052"/></div>
<p>However, if $(5, 12, 13)$ triangles were used then the hole would measure $7$ by $7$ and these could not be used to tile the $13$ by $13$ square.</p>
<p>Given that the perimeter of the right triangle is less than one-hundred million, how many Pythagorean triangles would allow such a tiling to take place?</p> | 10057761 | Saturday, 27th January 2007, 09:00 am | 6359 | 50% | medium |
122 | Efficient Exponentiation | The most naive way of computing $n^{15}$ requires fourteen multiplications:
$$n \times n \times \cdots \times n = n^{15}.$$
But using a "binary" method you can compute it in six multiplications:
\begin{align}
n \times n &= n^2\\
n^2 \times n^2 &= n^4\\
n^4 \times n^4 &= n^8\\
n^8 \times n^4 &= n^{12}\\
n^{12} \times n^2 &= n^{14}\\
n^{14} \times n &= n^{15}
\end{align}
However it is yet possible to compute it in only five multiplications:
\begin{align}
n \times n &= n^2\\
n^2 \times n &= n^3\\
n^3 \times n^3 &= n^6\\
n^6 \times n^6 &= n^{12}\\
n^{12} \times n^3 &= n^{15}
\end{align}
We shall define $m(k)$ to be the minimum number of multiplications to compute $n^k$; for example $m(15) = 5$.
Find $\sum\limits_{k = 1}^{200} m(k)$. | The most naive way of computing $n^{15}$ requires fourteen multiplications:
$$n \times n \times \cdots \times n = n^{15}.$$
But using a "binary" method you can compute it in six multiplications:
\begin{align}
n \times n &= n^2\\
n^2 \times n^2 &= n^4\\
n^4 \times n^4 &= n^8\\
n^8 \times n^4 &= n^{12}\\
n^{12} \times n^2 &= n^{14}\\
n^{14} \times n &= n^{15}
\end{align}
However it is yet possible to compute it in only five multiplications:
\begin{align}
n \times n &= n^2\\
n^2 \times n &= n^3\\
n^3 \times n^3 &= n^6\\
n^6 \times n^6 &= n^{12}\\
n^{12} \times n^3 &= n^{15}
\end{align}
We shall define $m(k)$ to be the minimum number of multiplications to compute $n^k$; for example $m(15) = 5$.
Find $\sum\limits_{k = 1}^{200} m(k)$. | <p>The most naive way of computing $n^{15}$ requires fourteen multiplications:
$$n \times n \times \cdots \times n = n^{15}.$$</p>
<p>But using a "binary" method you can compute it in six multiplications:</p>
\begin{align}
n \times n &= n^2\\
n^2 \times n^2 &= n^4\\
n^4 \times n^4 &= n^8\\
n^8 \times n^4 &= n^{12}\\
n^{12} \times n^2 &= n^{14}\\
n^{14} \times n &= n^{15}
\end{align}
<p>However it is yet possible to compute it in only five multiplications:</p>
\begin{align}
n \times n &= n^2\\
n^2 \times n &= n^3\\
n^3 \times n^3 &= n^6\\
n^6 \times n^6 &= n^{12}\\
n^{12} \times n^3 &= n^{15}
\end{align}
<p>We shall define $m(k)$ to be the minimum number of multiplications to compute $n^k$; for example $m(15) = 5$.</p>
<p>Find $\sum\limits_{k = 1}^{200} m(k)$.</p> | 1582 | Friday, 2nd June 2006, 06:00 pm | 8782 | 40% | medium |
47 | Distinct Primes Factors | The first two consecutive numbers to have two distinct prime factors are:
\begin{align}
14 &= 2 \times 7\\
15 &= 3 \times 5.
\end{align}
The first three consecutive numbers to have three distinct prime factors are:
\begin{align}
644 &= 2^2 \times 7 \times 23\\
645 &= 3 \times 5 \times 43\\
646 &= 2 \times 17 \times 19.
\end{align}
Find the first four consecutive integers to have four distinct prime factors each. What is the first of these numbers? | The first two consecutive numbers to have two distinct prime factors are:
\begin{align}
14 &= 2 \times 7\\
15 &= 3 \times 5.
\end{align}
The first three consecutive numbers to have three distinct prime factors are:
\begin{align}
644 &= 2^2 \times 7 \times 23\\
645 &= 3 \times 5 \times 43\\
646 &= 2 \times 17 \times 19.
\end{align}
Find the first four consecutive integers to have four distinct prime factors each. What is the first of these numbers? | <p>The first two consecutive numbers to have two distinct prime factors are:</p>
\begin{align}
14 &= 2 \times 7\\
15 &= 3 \times 5.
\end{align}
<p>The first three consecutive numbers to have three distinct prime factors are:</p>
\begin{align}
644 &= 2^2 \times 7 \times 23\\
645 &= 3 \times 5 \times 43\\
646 &= 2 \times 17 \times 19.
\end{align}
<p>Find the first four consecutive integers to have four distinct prime factors each. What is the first of these numbers?</p> | 134043 | Friday, 4th July 2003, 06:00 pm | 63771 | 5% | easy |
654 | Neighbourly Constraints | Let $T(n, m)$ be the number of $m$-tuples of positive integers such that the sum of any two neighbouring elements of the tuple is $\le n$.
For example, $T(3, 4)=8$, via the following eight $4$-tuples:
$(1, 1, 1, 1)$
$(1, 1, 1, 2)$
$(1, 1, 2, 1)$
$(1, 2, 1, 1)$
$(1, 2, 1, 2)$
$(2, 1, 1, 1)$
$(2, 1, 1, 2)$
$(2, 1, 2, 1)$
You are also given that $T(5, 5)=246$, $T(10, 10^{2}) \equiv 862820094 \pmod{1\,000\,000\,007}$ and $T(10^2, 10) \equiv 782136797 \pmod{1\,000\,000\,007}$.
Find $T(5000, 10^{12}) \bmod 1\,000\,000\,007$. | Let $T(n, m)$ be the number of $m$-tuples of positive integers such that the sum of any two neighbouring elements of the tuple is $\le n$.
For example, $T(3, 4)=8$, via the following eight $4$-tuples:
$(1, 1, 1, 1)$
$(1, 1, 1, 2)$
$(1, 1, 2, 1)$
$(1, 2, 1, 1)$
$(1, 2, 1, 2)$
$(2, 1, 1, 1)$
$(2, 1, 1, 2)$
$(2, 1, 2, 1)$
You are also given that $T(5, 5)=246$, $T(10, 10^{2}) \equiv 862820094 \pmod{1\,000\,000\,007}$ and $T(10^2, 10) \equiv 782136797 \pmod{1\,000\,000\,007}$.
Find $T(5000, 10^{12}) \bmod 1\,000\,000\,007$. | <p>
Let $T(n, m)$ be the number of $m$-tuples of positive integers such that the sum of any two neighbouring elements of the tuple is $\le n$.
</p>
<p>
For example, $T(3, 4)=8$, via the following eight $4$-tuples:<br>
$(1, 1, 1, 1)$<br/>
$(1, 1, 1, 2)$<br/>
$(1, 1, 2, 1)$<br/>
$(1, 2, 1, 1)$<br/>
$(1, 2, 1, 2)$<br/>
$(2, 1, 1, 1)$<br/>
$(2, 1, 1, 2)$<br/>
$(2, 1, 2, 1)$<br/></br></p>
<p>
You are also given that $T(5, 5)=246$, $T(10, 10^{2}) \equiv 862820094 \pmod{1\,000\,000\,007}$ and $T(10^2, 10) \equiv 782136797 \pmod{1\,000\,000\,007}$.
</p>
<p>
Find $T(5000, 10^{12}) \bmod 1\,000\,000\,007$.
</p> | 815868280 | Sunday, 3rd February 2019, 04:00 am | 385 | 45% | medium |
185 | Number Mind | The game Number Mind is a variant of the well known game Master Mind.
Instead of coloured pegs, you have to guess a secret sequence of digits. After each guess you're only told in how many places you've guessed the correct digit. So, if the sequence was 1234 and you guessed 2036, you'd be told that you have one correct digit; however, you would NOT be told that you also have another digit in the wrong place.
For instance, given the following guesses for a 5-digit secret sequence,
90342 ;2 correct
70794 ;0 correct
39458 ;2 correct
34109 ;1 correct
51545 ;2 correct
12531 ;1 correct
The correct sequence 39542 is unique.
Based on the following guesses,
5616185650518293 ;2 correct
3847439647293047 ;1 correct
5855462940810587 ;3 correct
9742855507068353 ;3 correct
4296849643607543 ;3 correct
3174248439465858 ;1 correct
4513559094146117 ;2 correct
7890971548908067 ;3 correct
8157356344118483 ;1 correct
2615250744386899 ;2 correct
8690095851526254 ;3 correct
6375711915077050 ;1 correct
6913859173121360 ;1 correct
6442889055042768 ;2 correct
2321386104303845 ;0 correct
2326509471271448 ;2 correct
5251583379644322 ;2 correct
1748270476758276 ;3 correct
4895722652190306 ;1 correct
3041631117224635 ;3 correct
1841236454324589 ;3 correct
2659862637316867 ;2 correct
Find the unique 16-digit secret sequence. | The game Number Mind is a variant of the well known game Master Mind.
Instead of coloured pegs, you have to guess a secret sequence of digits. After each guess you're only told in how many places you've guessed the correct digit. So, if the sequence was 1234 and you guessed 2036, you'd be told that you have one correct digit; however, you would NOT be told that you also have another digit in the wrong place.
For instance, given the following guesses for a 5-digit secret sequence,
90342 ;2 correct
70794 ;0 correct
39458 ;2 correct
34109 ;1 correct
51545 ;2 correct
12531 ;1 correct
The correct sequence 39542 is unique.
Based on the following guesses,
5616185650518293 ;2 correct
3847439647293047 ;1 correct
5855462940810587 ;3 correct
9742855507068353 ;3 correct
4296849643607543 ;3 correct
3174248439465858 ;1 correct
4513559094146117 ;2 correct
7890971548908067 ;3 correct
8157356344118483 ;1 correct
2615250744386899 ;2 correct
8690095851526254 ;3 correct
6375711915077050 ;1 correct
6913859173121360 ;1 correct
6442889055042768 ;2 correct
2321386104303845 ;0 correct
2326509471271448 ;2 correct
5251583379644322 ;2 correct
1748270476758276 ;3 correct
4895722652190306 ;1 correct
3041631117224635 ;3 correct
1841236454324589 ;3 correct
2659862637316867 ;2 correct
Find the unique 16-digit secret sequence. | <p>The game Number Mind is a variant of the well known game Master Mind.</p>
<p>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.</p>
<p>For instance, given the following guesses for a 5-digit secret sequence,</p>
<p class="margin_left">90342 ;2 correct<br>
70794 ;0 correct<br/>
39458 ;2 correct<br/>
34109 ;1 correct<br/>
51545 ;2 correct<br/>
12531 ;1 correct</br></p>
<p>The correct sequence 39542 is unique.</p>
<p>Based on the following guesses,</p>
<p class="margin_left">5616185650518293 ;2 correct<br/>
3847439647293047 ;1 correct<br/>
5855462940810587 ;3 correct<br/>
9742855507068353 ;3 correct<br/>
4296849643607543 ;3 correct<br/>
3174248439465858 ;1 correct<br/>
4513559094146117 ;2 correct<br/>
7890971548908067 ;3 correct<br/>
8157356344118483 ;1 correct<br/>
2615250744386899 ;2 correct<br/>
8690095851526254 ;3 correct<br/>
6375711915077050 ;1 correct<br/>
6913859173121360 ;1 correct<br/>
6442889055042768 ;2 correct<br/>
2321386104303845 ;0 correct<br/>
2326509471271448 ;2 correct<br/>
5251583379644322 ;2 correct<br/>
1748270476758276 ;3 correct<br/>
4895722652190306 ;1 correct<br/>
3041631117224635 ;3 correct<br/>
1841236454324589 ;3 correct<br/>
2659862637316867 ;2 correct</p>
<p>Find the unique 16-digit secret sequence.</p> | 4640261571849533 | Saturday, 8th March 2008, 01:00 am | 3494 | 55% | medium |
54 | Poker Hands | In the card game poker, a hand consists of five cards and are ranked, from lowest to highest, in the following way:
High Card: Highest value card.
One Pair: Two cards of the same value.
Two Pairs: Two different pairs.
Three of a Kind: Three cards of the same value.
Straight: All cards are consecutive values.
Flush: All cards of the same suit.
Full House: Three of a kind and a pair.
Four of a Kind: Four cards of the same value.
Straight Flush: All cards are consecutive values of same suit.
Royal Flush: Ten, Jack, Queen, King, Ace, in same suit.
The cards are valued in the order:2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King, Ace.
If two players have the same ranked hands then the rank made up of the highest value wins; for example, a pair of eights beats a pair of fives (see example 1 below). But if two ranks tie, for example, both players have a pair of queens, then highest cards in each hand are compared (see example 4 below); if the highest cards tie then the next highest cards are compared, and so on.
Consider the following five hands dealt to two players:
Hand Player 1 Player 2 Winner
1 5H 5C 6S 7S KDPair of Fives 2C 3S 8S 8D TDPair of Eights Player 2
2 5D 8C 9S JS ACHighest card Ace 2C 5C 7D 8S QHHighest card Queen Player 1
3 2D 9C AS AH ACThree Aces 3D 6D 7D TD QDFlush with Diamonds Player 2
4 4D 6S 9H QH QCPair of QueensHighest card Nine 3D 6D 7H QD QSPair of QueensHighest card Seven Player 1
5 2H 2D 4C 4D 4SFull HouseWith Three Fours 3C 3D 3S 9S 9DFull Housewith Three Threes Player 1
The file, poker.txt, contains one-thousand random hands dealt to two players. Each line of the file contains ten cards (separated by a single space): the first five are Player 1's cards and the last five are Player 2's cards. You can assume that all hands are valid (no invalid characters or repeated cards), each player's hand is in no specific order, and in each hand there is a clear winner.
How many hands does Player 1 win? | In the card game poker, a hand consists of five cards and are ranked, from lowest to highest, in the following way:
High Card: Highest value card.
One Pair: Two cards of the same value.
Two Pairs: Two different pairs.
Three of a Kind: Three cards of the same value.
Straight: All cards are consecutive values.
Flush: All cards of the same suit.
Full House: Three of a kind and a pair.
Four of a Kind: Four cards of the same value.
Straight Flush: All cards are consecutive values of same suit.
Royal Flush: Ten, Jack, Queen, King, Ace, in same suit.
The cards are valued in the order:2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King, Ace.
If two players have the same ranked hands then the rank made up of the highest value wins; for example, a pair of eights beats a pair of fives (see example 1 below). But if two ranks tie, for example, both players have a pair of queens, then highest cards in each hand are compared (see example 4 below); if the highest cards tie then the next highest cards are compared, and so on.
Consider the following five hands dealt to two players:
Hand Player 1 Player 2 Winner
1 5H 5C 6S 7S KDPair of Fives 2C 3S 8S 8D TDPair of Eights Player 2
2 5D 8C 9S JS ACHighest card Ace 2C 5C 7D 8S QHHighest card Queen Player 1
3 2D 9C AS AH ACThree Aces 3D 6D 7D TD QDFlush with Diamonds Player 2
4 4D 6S 9H QH QCPair of QueensHighest card Nine 3D 6D 7H QD QSPair of QueensHighest card Seven Player 1
5 2H 2D 4C 4D 4SFull HouseWith Three Fours 3C 3D 3S 9S 9DFull Housewith Three Threes Player 1
The file, poker.txt, contains one-thousand random hands dealt to two players. Each line of the file contains ten cards (separated by a single space): the first five are Player 1's cards and the last five are Player 2's cards. You can assume that all hands are valid (no invalid characters or repeated cards), each player's hand is in no specific order, and in each hand there is a clear winner.
How many hands does Player 1 win? | <p>In the card game poker, a hand consists of five cards and are ranked, from lowest to highest, in the following way:</p>
<ul><li><b>High Card</b>: Highest value card.</li>
<li><b>One Pair</b>: Two cards of the same value.</li>
<li><b>Two Pairs</b>: Two different pairs.</li>
<li><b>Three of a Kind</b>: Three cards of the same value.</li>
<li><b>Straight</b>: All cards are consecutive values.</li>
<li><b>Flush</b>: All cards of the same suit.</li>
<li><b>Full House</b>: Three of a kind and a pair.</li>
<li><b>Four of a Kind</b>: Four cards of the same value.</li>
<li><b>Straight Flush</b>: All cards are consecutive values of same suit.</li>
<li><b>Royal Flush</b>: Ten, Jack, Queen, King, Ace, in same suit.</li>
</ul><p>The cards are valued in the order:<br/>2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King, Ace.</p>
<p>If two players have the same ranked hands then the rank made up of the highest value wins; for example, a pair of eights beats a pair of fives (see example 1 below). But if two ranks tie, for example, both players have a pair of queens, then highest cards in each hand are compared (see example 4 below); if the highest cards tie then the next highest cards are compared, and so on.</p>
<p>Consider the following five hands dealt to two players:</p>
<div class="center">
<table><tr><td><b>Hand</b></td><td> </td><td><b>Player 1</b></td><td> </td><td><b>Player 2</b></td><td> </td><td><b>Winner</b></td>
</tr><tr><td><b>1</b></td><td> </td><td>5H 5C 6S 7S KD<br/><div class="smaller">Pair of Fives</div></td><td> </td><td>2C 3S 8S 8D TD<br/><div class="smaller">Pair of Eights</div></td><td> </td><td>Player 2</td>
</tr><tr><td><b>2</b></td><td> </td><td>5D 8C 9S JS AC<br/><div class="smaller">Highest card Ace</div></td><td> </td><td>2C 5C 7D 8S QH<br/><div class="smaller">Highest card Queen</div></td><td> </td><td>Player 1</td>
</tr><tr><td><b>3</b></td><td> </td><td>2D 9C AS AH AC<br/><div class="smaller">Three Aces</div></td><td> </td><td>3D 6D 7D TD QD<br/><div class="smaller">Flush with Diamonds</div></td><td> </td><td>Player 2</td>
</tr><tr><td><b>4</b></td><td> </td><td>4D 6S 9H QH QC<br/><div class="smaller">Pair of Queens<br/>Highest card Nine</div></td><td> </td><td>3D 6D 7H QD QS<br/><div class="smaller">Pair of Queens<br/>Highest card Seven</div></td><td> </td><td>Player 1</td>
</tr><tr><td><b>5</b></td><td> </td><td>2H 2D 4C 4D 4S<br/><div class="smaller">Full House<br/>With Three Fours</div></td><td> </td><td>3C 3D 3S 9S 9D<br/><div class="smaller">Full House<br/>with Three Threes</div></td><td> </td><td>Player 1</td>
</tr></table></div>
<p>The file, <a href="resources/documents/0054_poker.txt">poker.txt</a>, contains one-thousand random hands dealt to two players. Each line of the file contains ten cards (separated by a single space): the first five are Player 1's cards and the last five are Player 2's cards. You can assume that all hands are valid (no invalid characters or repeated cards), each player's hand is in no specific order, and in each hand there is a clear winner.</p>
<p>How many hands does Player 1 win?</p> | 376 | Friday, 10th October 2003, 06:00 pm | 39978 | 10% | easy |
660 | Pandigital Triangles | We call an integer sided triangle $n$-pandigital if it contains one angle of $120$ degrees and, when the sides of the triangle are written in base $n$, together they use all $n$ digits of that base exactly once.
For example, the triangle $(217, 248, 403)$ is $9$-pandigital because it contains one angle of $120$ degrees and the sides written in base $9$ are $261_9, 305_9, 487_9$ using each of the $9$ digits of that base once.
Find the sum of the largest sides of all $n$-pandigital triangles with $9 \le n \le 18$. | We call an integer sided triangle $n$-pandigital if it contains one angle of $120$ degrees and, when the sides of the triangle are written in base $n$, together they use all $n$ digits of that base exactly once.
For example, the triangle $(217, 248, 403)$ is $9$-pandigital because it contains one angle of $120$ degrees and the sides written in base $9$ are $261_9, 305_9, 487_9$ using each of the $9$ digits of that base once.
Find the sum of the largest sides of all $n$-pandigital triangles with $9 \le n \le 18$. | <p>We call an integer sided triangle <dfn>$n$-pandigital</dfn> if it contains one angle of $120$ degrees and, when the sides of the triangle are written in base $n$, together they use all $n$ digits of that base exactly once.</p>
<p>
For example, the triangle $(217, 248, 403)$ is $9$-pandigital because it contains one angle of $120$ degrees and the sides written in base $9$ are $261_9, 305_9, 487_9$ using each of the $9$ digits of that base once.</p>
<p>Find the sum of the largest sides of all $n$-pandigital triangles with $9 \le n \le 18$.</p> | 474766783 | Saturday, 9th March 2019, 07:00 pm | 335 | 40% | medium |
537 | Counting Tuples | Let $\pi(x)$ be the prime counting function, i.e. the number of prime numbers less than or equal to $x$.
For example,$\pi(1)=0$, $\pi(2)=1$, $\pi(100)=25$.
Let $T(n, k)$ be the number of $k$-tuples $(x_1, \dots, x_k)$ which satisfy:
1. every $x_i$ is a positive integer;
2. $\displaystyle \sum_{i=1}^k \pi(x_i)=n$
For example $T(3,3)=19$.
The $19$ tuples are $(1,1,5)$, $(1,5,1)$, $(5,1,1)$, $(1,1,6)$, $(1,6,1)$, $(6,1,1)$, $(1,2,3)$, $(1,3,2)$, $(2,1,3)$, $(2,3,1)$, $(3,1,2)$, $(3,2,1)$, $(1,2,4)$, $(1,4,2)$, $(2,1,4)$, $(2,4,1)$, $(4,1,2)$, $(4,2,1)$, $(2,2,2)$.
You are given $T(10, 10) = 869\,985$ and $T(10^3,10^3) \equiv 578\,270\,566 \pmod{1\,004\,535\,809}$.
Find $T(20\,000, 20\,000) \pmod{1\,004\,535\,809}$. | Let $\pi(x)$ be the prime counting function, i.e. the number of prime numbers less than or equal to $x$.
For example,$\pi(1)=0$, $\pi(2)=1$, $\pi(100)=25$.
Let $T(n, k)$ be the number of $k$-tuples $(x_1, \dots, x_k)$ which satisfy:
1. every $x_i$ is a positive integer;
2. $\displaystyle \sum_{i=1}^k \pi(x_i)=n$
For example $T(3,3)=19$.
The $19$ tuples are $(1,1,5)$, $(1,5,1)$, $(5,1,1)$, $(1,1,6)$, $(1,6,1)$, $(6,1,1)$, $(1,2,3)$, $(1,3,2)$, $(2,1,3)$, $(2,3,1)$, $(3,1,2)$, $(3,2,1)$, $(1,2,4)$, $(1,4,2)$, $(2,1,4)$, $(2,4,1)$, $(4,1,2)$, $(4,2,1)$, $(2,2,2)$.
You are given $T(10, 10) = 869\,985$ and $T(10^3,10^3) \equiv 578\,270\,566 \pmod{1\,004\,535\,809}$.
Find $T(20\,000, 20\,000) \pmod{1\,004\,535\,809}$. | <p>
Let $\pi(x)$ be the prime counting function, i.e. the number of prime numbers less than or equal to $x$.<br/>
For example,$\pi(1)=0$, $\pi(2)=1$, $\pi(100)=25$.
</p>
<p>
Let $T(n, k)$ be the number of $k$-tuples $(x_1, \dots, x_k)$ which satisfy:<br/>
1. every $x_i$ is a positive integer;<br/>
2. $\displaystyle \sum_{i=1}^k \pi(x_i)=n$
</p>
<p>
For example $T(3,3)=19$.<br/>
The $19$ tuples are $(1,1,5)$, $(1,5,1)$, $(5,1,1)$, $(1,1,6)$, $(1,6,1)$, $(6,1,1)$, $(1,2,3)$, $(1,3,2)$, $(2,1,3)$, $(2,3,1)$, $(3,1,2)$, $(3,2,1)$, $(1,2,4)$, $(1,4,2)$, $(2,1,4)$, $(2,4,1)$, $(4,1,2)$, $(4,2,1)$, $(2,2,2)$.
</p>
<p>
You are given $T(10, 10) = 869\,985$ and $T(10^3,10^3) \equiv 578\,270\,566 \pmod{1\,004\,535\,809}$.
</p><p>
Find $T(20\,000, 20\,000) \pmod{1\,004\,535\,809}$.
</p> | 779429131 | Saturday, 5th December 2015, 10:00 pm | 709 | 35% | medium |
632 | Square Prime Factors | For an integer $n$, we define the square prime factors of $n$ to be the primes whose square divides $n$. For example, the square prime factors of $1500=2^2 \times 3 \times 5^3$ are $2$ and $5$.
Let $C_k(N)$ be the number of integers between $1$ and $N$ inclusive with exactly $k$ square prime factors. You are given some values of $C_k(N)$ in the table below.
\[\begin{array}{|c|c|c|c|c|c|c|}
\hline
& k = 0 & k = 1 & k = 2 & k = 3 & k = 4 & k = 5 \\
\hline
N=10 & 7 & 3 & 0 & 0 & 0 & 0 \\
\hline
N=10^2 & 61 & 36 & 3 & 0 & 0 & 0 \\
\hline
N=10^3 & 608 & 343 & 48 & 1 & 0 & 0 \\
\hline
N=10^4 & 6083 & 3363 & 533 & 21 & 0 & 0 \\
\hline
N=10^5 & 60794 & 33562 & 5345 & 297 & 2 & 0 \\
\hline
N=10^6 & 607926 & 335438 & 53358 & 3218 & 60 & 0 \\
\hline
N=10^7 & 6079291 & 3353956 & 533140 & 32777 & 834 & 2 \\
\hline
N=10^8 & 60792694 & 33539196 & 5329747 & 329028 & 9257 & 78 \\
\hline
\end{array}\]
Find the product of all non-zero $C_k(10^{16})$. Give the result reduced modulo $1\,000\,000\,007$. | For an integer $n$, we define the square prime factors of $n$ to be the primes whose square divides $n$. For example, the square prime factors of $1500=2^2 \times 3 \times 5^3$ are $2$ and $5$.
Let $C_k(N)$ be the number of integers between $1$ and $N$ inclusive with exactly $k$ square prime factors. You are given some values of $C_k(N)$ in the table below.
\[\begin{array}{|c|c|c|c|c|c|c|}
\hline
& k = 0 & k = 1 & k = 2 & k = 3 & k = 4 & k = 5 \\
\hline
N=10 & 7 & 3 & 0 & 0 & 0 & 0 \\
\hline
N=10^2 & 61 & 36 & 3 & 0 & 0 & 0 \\
\hline
N=10^3 & 608 & 343 & 48 & 1 & 0 & 0 \\
\hline
N=10^4 & 6083 & 3363 & 533 & 21 & 0 & 0 \\
\hline
N=10^5 & 60794 & 33562 & 5345 & 297 & 2 & 0 \\
\hline
N=10^6 & 607926 & 335438 & 53358 & 3218 & 60 & 0 \\
\hline
N=10^7 & 6079291 & 3353956 & 533140 & 32777 & 834 & 2 \\
\hline
N=10^8 & 60792694 & 33539196 & 5329747 & 329028 & 9257 & 78 \\
\hline
\end{array}\]
Find the product of all non-zero $C_k(10^{16})$. Give the result reduced modulo $1\,000\,000\,007$. | <p>For an integer $n$, we define the <dfn>square prime factors</dfn> of $n$ to be the primes whose square divides $n$. For example, the square prime factors of $1500=2^2 \times 3 \times 5^3$ are $2$ and $5$.</p>
<p>Let $C_k(N)$ be the number of integers between $1$ and $N$ inclusive with exactly $k$ square prime factors. You are given some values of $C_k(N)$ in the table below.</p>
\[\begin{array}{|c|c|c|c|c|c|c|}
\hline
& k = 0 & k = 1 & k = 2 & k = 3 & k = 4 & k = 5 \\
\hline
N=10 & 7 & 3 & 0 & 0 & 0 & 0 \\
\hline
N=10^2 & 61 & 36 & 3 & 0 & 0 & 0 \\
\hline
N=10^3 & 608 & 343 & 48 & 1 & 0 & 0 \\
\hline
N=10^4 & 6083 & 3363 & 533 & 21 & 0 & 0 \\
\hline
N=10^5 & 60794 & 33562 & 5345 & 297 & 2 & 0 \\
\hline
N=10^6 & 607926 & 335438 & 53358 & 3218 & 60 & 0 \\
\hline
N=10^7 & 6079291 & 3353956 & 533140 & 32777 & 834 & 2 \\
\hline
N=10^8 & 60792694 & 33539196 & 5329747 & 329028 & 9257 & 78 \\
\hline
\end{array}\]
<p>Find the product of all non-zero $C_k(10^{16})$. Give the result reduced modulo $1\,000\,000\,007$.</p> | 728378714 | Saturday, 28th July 2018, 01:00 pm | 548 | 35% | medium |
786 | Billiard | The following diagram shows a billiard table of a special quadrilateral shape.
The four angles $A, B, C, D$ are $120^\circ, 90^\circ, 60^\circ, 90^\circ$ respectively, and the lengths $AB$ and $AD$ are equal.
The diagram on the left shows the trace of an infinitesimally small billiard ball, departing from point $A$, bouncing twice on the edges of the table, and finally returning back to point $A$. The diagram on the right shows another such trace, but this time bouncing eight times:
The table has no friction and all bounces are perfect elastic collisions.
Note that no bounce should happen on any of the corners, as the behaviour would be unpredictable.
Let $B(N)$ be the number of possible traces of the ball, departing from point $A$, bouncing at most $N$ times on the edges and returning back to point $A$.
For example, $B(10) = 6$, $B(100) = 478$, $B(1000) = 45790$.
Find $B(10^9)$. | The following diagram shows a billiard table of a special quadrilateral shape.
The four angles $A, B, C, D$ are $120^\circ, 90^\circ, 60^\circ, 90^\circ$ respectively, and the lengths $AB$ and $AD$ are equal.
The diagram on the left shows the trace of an infinitesimally small billiard ball, departing from point $A$, bouncing twice on the edges of the table, and finally returning back to point $A$. The diagram on the right shows another such trace, but this time bouncing eight times:
The table has no friction and all bounces are perfect elastic collisions.
Note that no bounce should happen on any of the corners, as the behaviour would be unpredictable.
Let $B(N)$ be the number of possible traces of the ball, departing from point $A$, bouncing at most $N$ times on the edges and returning back to point $A$.
For example, $B(10) = 6$, $B(100) = 478$, $B(1000) = 45790$.
Find $B(10^9)$. | <p>
The following diagram shows a billiard table of a special quadrilateral shape.
The four angles $A, B, C, D$ are $120^\circ, 90^\circ, 60^\circ, 90^\circ$ respectively, and the lengths $AB$ and $AD$ are equal.
</p>
<div style="text-align:center;">
<img alt="" class="dark_img" height="160" src="project/images/p786_billiard_shape.jpg">
</img></div>
<p>
The diagram on the left shows the trace of an infinitesimally small billiard ball, departing from point $A$, bouncing twice on the edges of the table, and finally returning back to point $A$. The diagram on the right shows another such trace, but this time bouncing eight times:
</p>
<div style="text-align:center;">
<img alt="" class="dark_img" height="160" src="project/images/p786_billiard_traces.jpg">
</img></div>
<p>
The table has no friction and all bounces are perfect elastic collisions.<br>
Note that no bounce should happen on any of the corners, as the behaviour would be unpredictable.
</br></p>
<p>
Let $B(N)$ be the number of possible traces of the ball, departing from point $A$, bouncing at most $N$ times on the edges and returning back to point $A$.
</p>
<p>
For example, $B(10) = 6$, $B(100) = 478$, $B(1000) = 45790$.
</p>
<p>
Find $B(10^9)$.
</p> | 45594532839912702 | Sunday, 20th February 2022, 10:00 am | 139 | 100% | hard |
685 | Inverse Digit Sum II | Writing down the numbers which have a digit sum of 10 in ascending order, we get:
$19, 28, 37, 46,55,64,73,82,91,109, 118,\dots$
Let $f(n,m)$ be the $m^{\text{th}}$ occurrence of the digit sum $n$. For example, $f(10,1)=19$, $f(10,10)=109$ and $f(10,100)=1423$.
Let $\displaystyle S(k)=\sum_{n=1}^k f(n^3,n^4)$. For example $S(3)=7128$ and $S(10)\equiv 32287064 \mod 1\,000\,000\,007$.
Find $S(10\,000)$ modulo $1\,000\,000\,007$. | Writing down the numbers which have a digit sum of 10 in ascending order, we get:
$19, 28, 37, 46,55,64,73,82,91,109, 118,\dots$
Let $f(n,m)$ be the $m^{\text{th}}$ occurrence of the digit sum $n$. For example, $f(10,1)=19$, $f(10,10)=109$ and $f(10,100)=1423$.
Let $\displaystyle S(k)=\sum_{n=1}^k f(n^3,n^4)$. For example $S(3)=7128$ and $S(10)\equiv 32287064 \mod 1\,000\,000\,007$.
Find $S(10\,000)$ modulo $1\,000\,000\,007$. | <p>Writing down the numbers which have a digit sum of 10 in ascending order, we get:
$19, 28, 37, 46,55,64,73,82,91,109, 118,\dots$</p>
<p>
Let $f(n,m)$ be the $m^{\text{th}}$ occurrence of the digit sum $n$. For example, $f(10,1)=19$, $f(10,10)=109$ and $f(10,100)=1423$.</p>
<p>
Let $\displaystyle S(k)=\sum_{n=1}^k f(n^3,n^4)$. For example $S(3)=7128$ and $S(10)\equiv 32287064 \mod 1\,000\,000\,007$.</p>
<p>
Find $S(10\,000)$ modulo $1\,000\,000\,007$.</p> | 662878999 | Saturday, 19th October 2019, 04:00 pm | 224 | 65% | hard |
886 | Coprime Permutations | A permutation of $\{2,3,\ldots,n\}$ is a rearrangement of these numbers. A coprime permutation is a rearrangement such that all pairs of adjacent numbers are coprime.
Let $P(n)$ be the number of coprime permutations of $\{2,3,\ldots,n\}$.
For example, $P(4)=2$ as there are two coprime permutations, $(2,3,4)$ and $(4,3,2)$. You are also given $P(10)=576$.
Find $P(34)$ and give your answer modulo $83\,456\,729$. | A permutation of $\{2,3,\ldots,n\}$ is a rearrangement of these numbers. A coprime permutation is a rearrangement such that all pairs of adjacent numbers are coprime.
Let $P(n)$ be the number of coprime permutations of $\{2,3,\ldots,n\}$.
For example, $P(4)=2$ as there are two coprime permutations, $(2,3,4)$ and $(4,3,2)$. You are also given $P(10)=576$.
Find $P(34)$ and give your answer modulo $83\,456\,729$. | <p>A permutation of $\{2,3,\ldots,n\}$ is a rearrangement of these numbers. A <i>coprime permutation</i> is a rearrangement such that all pairs of adjacent numbers are coprime.</p>
<p>Let $P(n)$ be the number of coprime permutations of $\{2,3,\ldots,n\}$.</p>
<p>For example, $P(4)=2$ as there are two coprime permutations, $(2,3,4)$ and $(4,3,2)$. You are also given $P(10)=576$.</p>
<p>Find $P(34)$ and give your answer modulo $83\,456\,729$.</p> | 5570163 | Saturday, 13th April 2024, 02:00 pm | 269 | 40% | medium |
674 | Solving $\mathcal{I}$-equations | We define the $\mathcal{I}$ operator as the function
\[\mathcal{I}(x,y) = (1+x+y)^2+y-x\]
and $\mathcal{I}$-expressions as arithmetic expressions built only from variable names and applications of $\mathcal{I}$. A variable name may consist of one or more letters. For example, the three expressions $x$, $\mathcal{I}(x,y)$, and $\mathcal{I}(\mathcal{I}(x,ab),x)$ are all $\mathcal{I}$-expressions.
For two $\mathcal{I}$-expressions $e_1$ and $e_2$ such that the equation $e_1=e_2$ has a solution in non-negative integers, we define the least simultaneous value of $e_1$ and $e_2$ to be the minimum value taken by $e_1$ and $e_2$ on such a solution. If the equation $e_1=e_2$ has no solution in non-negative integers, we define the least simultaneous value of $e_1$ and $e_2$ to be $0$. For example, consider the following three $\mathcal{I}$-expressions:
\[\begin{array}{l}A = \mathcal{I}(x,\mathcal{I}(z,t))\\
B = \mathcal{I}(\mathcal{I}(y,z),y)\\
C = \mathcal{I}(\mathcal{I}(x,z),y)\end{array}\]
The least simultaneous value of $A$ and $B$ is $23$, attained for $x=3,y=1,z=t=0$. On the other hand, $A=C$ has no solutions in non-negative integers, so the least simultaneous value of $A$ and $C$ is $0$. The total sum of least simultaneous pairs made of $\mathcal{I}$-expressions from $\{A,B,C\}$ is $26$.
Find the sum of least simultaneous values of all $\mathcal{I}$-expressions pairs made of distinct expressions from file I-expressions.txt (pairs $(e_1,e_2)$ and $(e_2,e_1)$ are considered to be identical). Give the last nine digits of the result as the answer. | We define the $\mathcal{I}$ operator as the function
\[\mathcal{I}(x,y) = (1+x+y)^2+y-x\]
and $\mathcal{I}$-expressions as arithmetic expressions built only from variable names and applications of $\mathcal{I}$. A variable name may consist of one or more letters. For example, the three expressions $x$, $\mathcal{I}(x,y)$, and $\mathcal{I}(\mathcal{I}(x,ab),x)$ are all $\mathcal{I}$-expressions.
For two $\mathcal{I}$-expressions $e_1$ and $e_2$ such that the equation $e_1=e_2$ has a solution in non-negative integers, we define the least simultaneous value of $e_1$ and $e_2$ to be the minimum value taken by $e_1$ and $e_2$ on such a solution. If the equation $e_1=e_2$ has no solution in non-negative integers, we define the least simultaneous value of $e_1$ and $e_2$ to be $0$. For example, consider the following three $\mathcal{I}$-expressions:
\[\begin{array}{l}A = \mathcal{I}(x,\mathcal{I}(z,t))\\
B = \mathcal{I}(\mathcal{I}(y,z),y)\\
C = \mathcal{I}(\mathcal{I}(x,z),y)\end{array}\]
The least simultaneous value of $A$ and $B$ is $23$, attained for $x=3,y=1,z=t=0$. On the other hand, $A=C$ has no solutions in non-negative integers, so the least simultaneous value of $A$ and $C$ is $0$. The total sum of least simultaneous pairs made of $\mathcal{I}$-expressions from $\{A,B,C\}$ is $26$.
Find the sum of least simultaneous values of all $\mathcal{I}$-expressions pairs made of distinct expressions from file I-expressions.txt (pairs $(e_1,e_2)$ and $(e_2,e_1)$ are considered to be identical). Give the last nine digits of the result as the answer. | <p>We define the $\mathcal{I}$ operator as the function
\[\mathcal{I}(x,y) = (1+x+y)^2+y-x\]
and $\mathcal{I}$-expressions as arithmetic expressions built only from variable names and applications of $\mathcal{I}$. A variable name may consist of one or more letters. For example, the three expressions $x$, $\mathcal{I}(x,y)$, and $\mathcal{I}(\mathcal{I}(x,ab),x)$ are all $\mathcal{I}$-expressions.</p>
<p>For two $\mathcal{I}$-expressions $e_1$ and $e_2$ such that the equation $e_1=e_2$ has a solution in non-negative integers, we define the least simultaneous value of $e_1$ and $e_2$ to be the minimum value taken by $e_1$ and $e_2$ on such a solution. If the equation $e_1=e_2$ has no solution in non-negative integers, we define the least simultaneous value of $e_1$ and $e_2$ to be $0$. For example, consider the following three $\mathcal{I}$-expressions:
\[\begin{array}{l}A = \mathcal{I}(x,\mathcal{I}(z,t))\\
B = \mathcal{I}(\mathcal{I}(y,z),y)\\
C = \mathcal{I}(\mathcal{I}(x,z),y)\end{array}\]
The least simultaneous value of $A$ and $B$ is $23$, attained for $x=3,y=1,z=t=0$. On the other hand, $A=C$ has no solutions in non-negative integers, so the least simultaneous value of $A$ and $C$ is $0$. The total sum of least simultaneous pairs made of $\mathcal{I}$-expressions from $\{A,B,C\}$ is $26$.</p>
<p>Find the sum of least simultaneous values of all $\mathcal{I}$-expressions pairs made of distinct expressions from file <a href="project/resources/p674_i_expressions.txt">I-expressions.txt</a> (pairs $(e_1,e_2)$ and $(e_2,e_1)$ are considered to be identical). Give the last nine digits of the result as the answer.</p> | 416678753 | Sunday, 9th June 2019, 10:00 am | 184 | 75% | hard |
169 | Sums of Powers of Two | Define $f(0)=1$ and $f(n)$ to be the number of different ways $n$ can be expressed as a sum of integer powers of $2$ using each power no more than twice.
For example, $f(10)=5$ since there are five different ways to express $10$:
\begin{align}
& 1 + 1 + 8\\
& 1 + 1 + 4 + 4\\
& 1 + 1 + 2 + 2 + 4\\
& 2 + 4 + 4\\
& 2 + 8
\end{align}
What is $f(10^{25})$? | Define $f(0)=1$ and $f(n)$ to be the number of different ways $n$ can be expressed as a sum of integer powers of $2$ using each power no more than twice.
For example, $f(10)=5$ since there are five different ways to express $10$:
\begin{align}
& 1 + 1 + 8\\
& 1 + 1 + 4 + 4\\
& 1 + 1 + 2 + 2 + 4\\
& 2 + 4 + 4\\
& 2 + 8
\end{align}
What is $f(10^{25})$? | <p>Define $f(0)=1$ and $f(n)$ to be the number of different ways $n$ can be expressed as a sum of integer powers of $2$ using each power no more than twice.</p>
<p>For example, $f(10)=5$ since there are five different ways to express $10$:</p>
\begin{align}
& 1 + 1 + 8\\
& 1 + 1 + 4 + 4\\
& 1 + 1 + 2 + 2 + 4\\
& 2 + 4 + 4\\
& 2 + 8
\end{align}
<p>What is $f(10^{25})$?</p> | 178653872807 | Friday, 23rd November 2007, 09:00 pm | 5688 | 50% | medium |
448 | Average Least Common Multiple | The function $\operatorname{\mathbf{lcm}}(a,b)$ denotes the least common multiple of $a$ and $b$.
Let $A(n)$ be the average of the values of $\operatorname{lcm}(n,i)$ for $1 \le i \le n$.
E.g: $A(2)=(2+2)/2=2$ and $A(10)=(10+10+30+20+10+30+70+40+90+10)/10=32$.
Let $S(n)=\sum A(k)$ for $1 \le k \le n$.
$S(100)=122726$.
Find $S(99999999019) \bmod 999999017$. | The function $\operatorname{\mathbf{lcm}}(a,b)$ denotes the least common multiple of $a$ and $b$.
Let $A(n)$ be the average of the values of $\operatorname{lcm}(n,i)$ for $1 \le i \le n$.
E.g: $A(2)=(2+2)/2=2$ and $A(10)=(10+10+30+20+10+30+70+40+90+10)/10=32$.
Let $S(n)=\sum A(k)$ for $1 \le k \le n$.
$S(100)=122726$.
Find $S(99999999019) \bmod 999999017$. | <p>
The function $\operatorname{\mathbf{lcm}}(a,b)$ denotes the least common multiple of $a$ and $b$.<br/>
Let $A(n)$ be the average of the values of $\operatorname{lcm}(n,i)$ for $1 \le i \le n$.<br/>
E.g: $A(2)=(2+2)/2=2$ and $A(10)=(10+10+30+20+10+30+70+40+90+10)/10=32$.
</p>
Let $S(n)=\sum A(k)$ for $1 \le k \le n$.<br/>
$S(100)=122726$.
<p>
Find $S(99999999019) \bmod 999999017$.
</p> | 106467648 | Sunday, 24th November 2013, 01:00 am | 391 | 80% | hard |
383 | Divisibility Comparison Between Factorials | Let $f_5(n)$ be the largest integer $x$ for which $5^x$ divides $n$.
For example, $f_5(625000) = 7$.
Let $T_5(n)$ be the number of integers $i$ which satisfy $f_5((2 \cdot i - 1)!) \lt 2 \cdot f_5(i!)$ and $1 \le i \le n$.
It can be verified that $T_5(10^3) = 68$ and $T_5(10^9) = 2408210$.
Find $T_5(10^{18})$. | Let $f_5(n)$ be the largest integer $x$ for which $5^x$ divides $n$.
For example, $f_5(625000) = 7$.
Let $T_5(n)$ be the number of integers $i$ which satisfy $f_5((2 \cdot i - 1)!) \lt 2 \cdot f_5(i!)$ and $1 \le i \le n$.
It can be verified that $T_5(10^3) = 68$ and $T_5(10^9) = 2408210$.
Find $T_5(10^{18})$. | <p>
Let $f_5(n)$ be the largest integer $x$ for which $5^x$ divides $n$.<br/>
For example, $f_5(625000) = 7$.
</p>
<p>
Let $T_5(n)$ be the number of integers $i$ which satisfy $f_5((2 \cdot i - 1)!) \lt 2 \cdot f_5(i!)$ and $1 \le i \le n$.<br/>
It can be verified that $T_5(10^3) = 68$ and $T_5(10^9) = 2408210$.
</p>
<p>
Find $T_5(10^{18})$.
</p> | 22173624649806 | Saturday, 5th May 2012, 11:00 pm | 532 | 50% | medium |
173 | Hollow Square Laminae I | We shall define a square lamina to be a square outline with a square "hole" so that the shape possesses vertical and horizontal symmetry. For example, using exactly thirty-two square tiles we can form two different square laminae:
With one-hundred tiles, and not necessarily using all of the tiles at one time, it is possible to form forty-one different square laminae.
Using up to one million tiles how many different square laminae can be formed? | We shall define a square lamina to be a square outline with a square "hole" so that the shape possesses vertical and horizontal symmetry. For example, using exactly thirty-two square tiles we can form two different square laminae:
With one-hundred tiles, and not necessarily using all of the tiles at one time, it is possible to form forty-one different square laminae.
Using up to one million tiles how many different square laminae can be formed? | <p>We shall define a square lamina to be a square outline with a square "hole" so that the shape possesses vertical and horizontal symmetry. For example, using exactly thirty-two square tiles we can form two different square laminae:</p>
<div class="center">
<img alt="" src="resources/images/0173_square_laminas.gif?1678992055"/></div>
<p>With one-hundred tiles, and not necessarily using all of the tiles at one time, it is possible to form forty-one different square laminae.</p>
<p>Using up to one million tiles how many different square laminae can be formed?</p> | 1572729 | Saturday, 22nd December 2007, 01:00 pm | 9962 | 30% | easy |
270 | Cutting Squares | A square piece of paper with integer dimensions $N \times N$ is placed with a corner at the origin and two of its sides along the $x$- and $y$-axes. Then, we cut it up respecting the following rules:
We only make straight cuts between two points lying on different sides of the square, and having integer coordinates.
Two cuts cannot cross, but several cuts can meet at the same border point.
Proceed until no more legal cuts can be made.
Counting any reflections or rotations as distinct, we call $C(N)$ the number of ways to cut an $N \times N$ square. For example, $C(1) = 2$ and $C(2) = 30$ (shown below).
What is $C(30) \bmod 10^8$? | A square piece of paper with integer dimensions $N \times N$ is placed with a corner at the origin and two of its sides along the $x$- and $y$-axes. Then, we cut it up respecting the following rules:
We only make straight cuts between two points lying on different sides of the square, and having integer coordinates.
Two cuts cannot cross, but several cuts can meet at the same border point.
Proceed until no more legal cuts can be made.
Counting any reflections or rotations as distinct, we call $C(N)$ the number of ways to cut an $N \times N$ square. For example, $C(1) = 2$ and $C(2) = 30$ (shown below).
What is $C(30) \bmod 10^8$? | <p>A square piece of paper with integer dimensions $N \times N$ is placed with a corner at the origin and two of its sides along the $x$- and $y$-axes. Then, we cut it up respecting the following rules:
</p><ul><li>We only make straight cuts between two points lying on different sides of the square, and having integer coordinates.</li>
<li>Two cuts cannot cross, but several cuts can meet at the same border point.</li>
<li>Proceed until no more legal cuts can be made.</li>
</ul><p>Counting any reflections or rotations as distinct, we call $C(N)$ the number of ways to cut an $N \times N$ square. For example, $C(1) = 2$ and $C(2) = 30$ (shown below).</p>
<div align="center"><img alt="0270_CutSquare.gif" src="resources/images/0270_CutSquare.gif?1678992056"/></div>
<p>What is $C(30) \bmod 10^8$?</p> | 82282080 | Saturday, 26th December 2009, 01:00 am | 720 | 80% | hard |
512 | Sums of Totients of Powers | Let $\varphi(n)$ be Euler's totient function.
Let $f(n)=(\sum_{i=1}^{n}\varphi(n^i)) \bmod (n+1)$.
Let $g(n)=\sum_{i=1}^{n} f(i)$.
$g(100)=2007$.
Find $g(5 \times 10^8)$. | Let $\varphi(n)$ be Euler's totient function.
Let $f(n)=(\sum_{i=1}^{n}\varphi(n^i)) \bmod (n+1)$.
Let $g(n)=\sum_{i=1}^{n} f(i)$.
$g(100)=2007$.
Find $g(5 \times 10^8)$. | <p>Let $\varphi(n)$ be Euler's totient function.</p><p>
Let $f(n)=(\sum_{i=1}^{n}\varphi(n^i)) \bmod (n+1)$.</p><p>
Let $g(n)=\sum_{i=1}^{n} f(i)$.</p><p>
$g(100)=2007$.
</p>
<p>
Find $g(5 \times 10^8)$.
</p> | 50660591862310323 | Saturday, 18th April 2015, 10:00 pm | 1670 | 25% | easy |
807 | Loops of Ropes | Given a circle $C$ and an integer $n > 1$, we perform the following operations.
In step $0$, we choose two uniformly random points $R_0$ and $B_0$ on $C$.
In step $i$ ($1 \leq i < n$), we first choose a uniformly random point $R_i$ on $C$ and connect the points $R_{i - 1}$ and $R_i$ with a red rope; then choose a uniformly random point $B_i$ on $C$ and connect the points $B_{i - 1}$ and $B_i$ with a blue rope.
In step $n$, we first connect the points $R_{n - 1}$ and $R_0$ with a red rope; then connect the points $B_{n - 1}$ and $B_0$ with a blue rope.
Each rope is straight between its two end points, and lies above all previous ropes.
After step $n$, we get a loop of red ropes, and a loop of blue ropes.
Sometimes the two loops can be separated, as in the left figure below; sometimes they are "linked", hence cannot be separated, as in the middle and right figures below.
Let $P(n)$ be the probability that the two loops can be separated.
For example, $P(3) = \frac{11}{20}$ and $P(5) \approx 0.4304177690$.
Find $P(80)$, rounded to $10$ digits after decimal point. | Given a circle $C$ and an integer $n > 1$, we perform the following operations.
In step $0$, we choose two uniformly random points $R_0$ and $B_0$ on $C$.
In step $i$ ($1 \leq i < n$), we first choose a uniformly random point $R_i$ on $C$ and connect the points $R_{i - 1}$ and $R_i$ with a red rope; then choose a uniformly random point $B_i$ on $C$ and connect the points $B_{i - 1}$ and $B_i$ with a blue rope.
In step $n$, we first connect the points $R_{n - 1}$ and $R_0$ with a red rope; then connect the points $B_{n - 1}$ and $B_0$ with a blue rope.
Each rope is straight between its two end points, and lies above all previous ropes.
After step $n$, we get a loop of red ropes, and a loop of blue ropes.
Sometimes the two loops can be separated, as in the left figure below; sometimes they are "linked", hence cannot be separated, as in the middle and right figures below.
Let $P(n)$ be the probability that the two loops can be separated.
For example, $P(3) = \frac{11}{20}$ and $P(5) \approx 0.4304177690$.
Find $P(80)$, rounded to $10$ digits after decimal point. | <p>Given a circle $C$ and an integer $n > 1$, we perform the following operations.</p>
<p>In step $0$, we choose two uniformly random points $R_0$ and $B_0$ on $C$.<br>
In step $i$ ($1 \leq i < n$), we first choose a uniformly random point $R_i$ on $C$ and connect the points $R_{i - 1}$ and $R_i$ with a red rope; then choose a uniformly random point $B_i$ on $C$ and connect the points $B_{i - 1}$ and $B_i$ with a blue rope.<br/>
In step $n$, we first connect the points $R_{n - 1}$ and $R_0$ with a red rope; then connect the points $B_{n - 1}$ and $B_0$ with a blue rope.<br/>
Each rope is straight between its two end points, and lies above all previous ropes.</br></p>
<p>After step $n$, we get a loop of red ropes, and a loop of blue ropes.<br/>
Sometimes the two loops can be separated, as in the left figure below; sometimes they are "linked", hence cannot be separated, as in the middle and right figures below.</p>
<div style="text-align:center;">
<img alt="" class="dark_img" src="project/images/p807.jpg">
</img></div>
<p>Let $P(n)$ be the probability that the two loops can be separated.<br/>
For example, $P(3) = \frac{11}{20}$ and $P(5) \approx 0.4304177690$.</p>
<p>Find $P(80)$, rounded to $10$ digits after decimal point.</p> | 0.1091523673 | Sunday, 11th September 2022, 02:00 am | 141 | 90% | hard |
804 | Counting Binary Quadratic Representations | Let $g(n)$ denote the number of ways a positive integer $n$ can be represented in the form: $$x^2+xy+41y^2$$ where $x$ and $y$ are integers. For example, $g(53)=4$ due to $(x,y) \in \{(-4,1),(-3,-1),(3,1),(4,-1)\}$.
Define $\displaystyle T(N)=\sum_{n=1}^{N}g(n)$. You are given $T(10^3)=474$ and $T(10^6)=492128$.
Find $T(10^{16})$. | Let $g(n)$ denote the number of ways a positive integer $n$ can be represented in the form: $$x^2+xy+41y^2$$ where $x$ and $y$ are integers. For example, $g(53)=4$ due to $(x,y) \in \{(-4,1),(-3,-1),(3,1),(4,-1)\}$.
Define $\displaystyle T(N)=\sum_{n=1}^{N}g(n)$. You are given $T(10^3)=474$ and $T(10^6)=492128$.
Find $T(10^{16})$. | <p>Let $g(n)$ denote the number of ways a positive integer $n$ can be represented in the form: $$x^2+xy+41y^2$$ where $x$ and $y$ are integers. For example, $g(53)=4$ due to $(x,y) \in \{(-4,1),(-3,-1),(3,1),(4,-1)\}$.</p>
<p>Define $\displaystyle T(N)=\sum_{n=1}^{N}g(n)$. You are given $T(10^3)=474$ and $T(10^6)=492128$.</p>
<p>Find $T(10^{16})$.</p> | 4921370551019052 | Saturday, 25th June 2022, 05:00 pm | 725 | 20% | easy |
675 | $2^{\omega(n)}$ | Let $\omega(n)$ denote the number of distinct prime divisors of a positive integer $n$.
So $\omega(1) = 0$ and $\omega(360) = \omega(2^{3} \times 3^{2} \times 5) = 3$.
Let $S(n)$ be $ \sum_{d \mid n} 2^{\omega(d)} $.
E.g. $S(6) = 2^{\omega(1)}+2^{\omega(2)}+2^{\omega(3)}+2^{\omega(6)} = 2^0+2^1+2^1+2^2 = 9$.
Let $F(n)=\sum_{i=2}^n S(i!)$.
$F(10)=4821.$
Find $F(10\,000\,000)$. Give your answer modulo $1\,000\,000\,087$. | Let $\omega(n)$ denote the number of distinct prime divisors of a positive integer $n$.
So $\omega(1) = 0$ and $\omega(360) = \omega(2^{3} \times 3^{2} \times 5) = 3$.
Let $S(n)$ be $ \sum_{d \mid n} 2^{\omega(d)} $.
E.g. $S(6) = 2^{\omega(1)}+2^{\omega(2)}+2^{\omega(3)}+2^{\omega(6)} = 2^0+2^1+2^1+2^2 = 9$.
Let $F(n)=\sum_{i=2}^n S(i!)$.
$F(10)=4821.$
Find $F(10\,000\,000)$. Give your answer modulo $1\,000\,000\,087$. | <p>
Let $\omega(n)$ denote the number of distinct prime divisors of a positive integer $n$.<br/>
So $\omega(1) = 0$ and $\omega(360) = \omega(2^{3} \times 3^{2} \times 5) = 3$.
</p>
<p>
Let $S(n)$ be $ \sum_{d \mid n} 2^{\omega(d)} $.
<br/>
E.g. $S(6) = 2^{\omega(1)}+2^{\omega(2)}+2^{\omega(3)}+2^{\omega(6)} = 2^0+2^1+2^1+2^2 = 9$.
</p>
<p>
Let $F(n)=\sum_{i=2}^n S(i!)$.
$F(10)=4821.$
</p>
<p>
Find $F(10\,000\,000)$. Give your answer modulo $1\,000\,000\,087$.
</p> | 416146418 | Saturday, 15th June 2019, 01:00 pm | 844 | 25% | easy |
145 | Reversible Numbers | Some positive integers $n$ have the property that the sum $[n + \operatorname{reverse}(n)]$ consists entirely of odd (decimal) digits. For instance, $36 + 63 = 99$ and $409 + 904 = 1313$. We will call such numbers reversible; so $36$, $63$, $409$, and $904$ are reversible. Leading zeroes are not allowed in either $n$ or $\operatorname{reverse}(n)$.
There are $120$ reversible numbers below one-thousand.
How many reversible numbers are there below one-billion ($10^9$)? | Some positive integers $n$ have the property that the sum $[n + \operatorname{reverse}(n)]$ consists entirely of odd (decimal) digits. For instance, $36 + 63 = 99$ and $409 + 904 = 1313$. We will call such numbers reversible; so $36$, $63$, $409$, and $904$ are reversible. Leading zeroes are not allowed in either $n$ or $\operatorname{reverse}(n)$.
There are $120$ reversible numbers below one-thousand.
How many reversible numbers are there below one-billion ($10^9$)? | <p>Some positive integers $n$ have the property that the sum $[n + \operatorname{reverse}(n)]$ consists entirely of odd (decimal) digits. For instance, $36 + 63 = 99$ and $409 + 904 = 1313$. We will call such numbers <dfn>reversible</dfn>; so $36$, $63$, $409$, and $904$ are reversible. Leading zeroes are not allowed in either $n$ or $\operatorname{reverse}(n)$.</p>
<p>There are $120$ reversible numbers below one-thousand.</p>
<p>How many reversible numbers are there below one-billion ($10^9$)?</p> | 608720 | Friday, 16th March 2007, 01:00 pm | 18209 | 20% | easy |
539 | Odd Elimination | Start from an ordered list of all integers from $1$ to $n$. Going from left to right, remove the first number and every other number afterward until the end of the list. Repeat the procedure from right to left, removing the right most number and every other number from the numbers left. Continue removing every other numbers, alternating left to right and right to left, until a single number remains.
Starting with $n = 9$, we have:
$\underline 1\,2\,\underline 3\,4\,\underline 5\,6\,\underline 7\,8\,\underline 9$
$2\,\underline 4\,6\,\underline 8$
$\underline 2\,6$
$6$
Let $P(n)$ be the last number left starting with a list of length $n$.
Let $\displaystyle S(n) = \sum_{k=1}^n P(k)$.
You are given $P(1)=1$, $P(9) = 6$, $P(1000)=510$, $S(1000)=268271$.
Find $S(10^{18}) \bmod 987654321$. | Start from an ordered list of all integers from $1$ to $n$. Going from left to right, remove the first number and every other number afterward until the end of the list. Repeat the procedure from right to left, removing the right most number and every other number from the numbers left. Continue removing every other numbers, alternating left to right and right to left, until a single number remains.
Starting with $n = 9$, we have:
$\underline 1\,2\,\underline 3\,4\,\underline 5\,6\,\underline 7\,8\,\underline 9$
$2\,\underline 4\,6\,\underline 8$
$\underline 2\,6$
$6$
Let $P(n)$ be the last number left starting with a list of length $n$.
Let $\displaystyle S(n) = \sum_{k=1}^n P(k)$.
You are given $P(1)=1$, $P(9) = 6$, $P(1000)=510$, $S(1000)=268271$.
Find $S(10^{18}) \bmod 987654321$. | <p>
Start from an ordered list of all integers from $1$ to $n$. Going from left to right, remove the first number and every other number afterward until the end of the list. Repeat the procedure from right to left, removing the right most number and every other number from the numbers left. Continue removing every other numbers, alternating left to right and right to left, until a single number remains.
</p>
<p>
Starting with $n = 9$, we have:<br/>
$\underline 1\,2\,\underline 3\,4\,\underline 5\,6\,\underline 7\,8\,\underline 9$<br/>
$2\,\underline 4\,6\,\underline 8$<br/>
$\underline 2\,6$<br/>
$6$
</p>
<p>
Let $P(n)$ be the last number left starting with a list of length $n$.<br/>
Let $\displaystyle S(n) = \sum_{k=1}^n P(k)$.<br/>
You are given $P(1)=1$, $P(9) = 6$, $P(1000)=510$, $S(1000)=268271$.
</p>
<p>
Find $S(10^{18}) \bmod 987654321$.
</p> | 426334056 | Sunday, 20th December 2015, 04:00 am | 919 | 35% | medium |
445 | Retractions A | For every integer $n>1$, the family of functions $f_{n,a,b}$ is defined
by
$f_{n,a,b}(x)\equiv a x + b \mod n\,\,\, $ for $a,b,x$ integer and $0< a <n, 0 \le b < n,0 \le x < n$.
We will call $f_{n,a,b}$ a retraction if $\,\,\, f_{n,a,b}(f_{n,a,b}(x)) \equiv f_{n,a,b}(x) \mod n \,\,\,$ for every $0 \le x < n$.
Let $R(n)$ be the number of retractions for $n$.
You are given that
$\displaystyle \sum_{k=1}^{99\,999} R(\binom {100\,000} k) \equiv 628701600 \mod 1\,000\,000\,007$.
Find $\displaystyle \sum_{k=1}^{9\,999\,999} R(\binom {10\,000\,000} k)$.
Give your answer modulo $1\,000\,000\,007$. | For every integer $n>1$, the family of functions $f_{n,a,b}$ is defined
by
$f_{n,a,b}(x)\equiv a x + b \mod n\,\,\, $ for $a,b,x$ integer and $0< a <n, 0 \le b < n,0 \le x < n$.
We will call $f_{n,a,b}$ a retraction if $\,\,\, f_{n,a,b}(f_{n,a,b}(x)) \equiv f_{n,a,b}(x) \mod n \,\,\,$ for every $0 \le x < n$.
Let $R(n)$ be the number of retractions for $n$.
You are given that
$\displaystyle \sum_{k=1}^{99\,999} R(\binom {100\,000} k) \equiv 628701600 \mod 1\,000\,000\,007$.
Find $\displaystyle \sum_{k=1}^{9\,999\,999} R(\binom {10\,000\,000} k)$.
Give your answer modulo $1\,000\,000\,007$. | <p>
For every integer $n>1$, the family of functions $f_{n,a,b}$ is defined
by <br>
$f_{n,a,b}(x)\equiv a x + b \mod n\,\,\, $ for $a,b,x$ integer and $0< a <n, 0 \le b < n,0 \le x < n$. </br></p>
<p>
We will call $f_{n,a,b}$ a <i>retraction</i> if $\,\,\, f_{n,a,b}(f_{n,a,b}(x)) \equiv f_{n,a,b}(x) \mod n \,\,\,$ for every $0 \le x < n$.<br/>
Let $R(n)$ be the number of retractions for $n$.
</p>
<p>
You are given that<br/>
$\displaystyle \sum_{k=1}^{99\,999} R(\binom {100\,000} k) \equiv 628701600 \mod 1\,000\,000\,007$.</p>
<p>
Find $\displaystyle \sum_{k=1}^{9\,999\,999} R(\binom {10\,000\,000} k)$.<br/>
Give your answer modulo $1\,000\,000\,007$.
</p> | 659104042 | Saturday, 16th November 2013, 10:00 pm | 444 | 50% | medium |
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.
However, there are up to three "shortest" path candidates for any given cuboid and the shortest route doesn't always have integer length.
It can be shown that there are exactly $2060$ distinct cuboids, ignoring rotations, with integer dimensions, up to a maximum size of $M$ by $M$ by $M$, for which the shortest route has integer length when $M = 100$. This is the least value of $M$ for which the number of solutions first exceeds two thousand; the number of solutions when $M = 99$ is $1975$.
Find the least value of $M$ such that the number of solutions first exceeds one million. | 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.
However, there are up to three "shortest" path candidates for any given cuboid and the shortest route doesn't always have integer length.
It can be shown that there are exactly $2060$ distinct cuboids, ignoring rotations, with integer dimensions, up to a maximum size of $M$ by $M$ by $M$, for which the shortest route has integer length when $M = 100$. This is the least value of $M$ for which the number of solutions first exceeds two thousand; the number of solutions when $M = 99$ is $1975$.
Find the least value of $M$ such that the number of solutions first exceeds one million. | <p>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.</p>
<div class="center">
<img alt="" class="dark_img" src="resources/images/0086.png?1678992052"/><br/></div>
<p>However, there are up to three "shortest" path candidates for any given cuboid and the shortest route doesn't always have integer length.</p>
<p>It can be shown that there are exactly $2060$ distinct cuboids, ignoring rotations, with integer dimensions, up to a maximum size of $M$ by $M$ by $M$, for which the shortest route has integer length when $M = 100$. This is the least value of $M$ for which the number of solutions first exceeds two thousand; the number of solutions when $M = 99$ is $1975$.</p>
<p>Find the least value of $M$ such that the number of solutions first exceeds one million.</p> | 1818 | Friday, 7th January 2005, 06:00 pm | 14368 | 35% | medium |
440 | GCD and Tiling | We want to tile a board of length $n$ and height $1$ completely, with either $1 \times 2$ blocks or $1 \times 1$ blocks with a single decimal digit on top:
For example, here are some of the ways to tile a board of length $n = 8$:
Let $T(n)$ be the number of ways to tile a board of length $n$ as described above.
For example, $T(1) = 10$ and $T(2) = 101$.
Let $S(L)$ be the triple sum $\sum_{a, b, c}\gcd(T(c^a), T(c^b))$ for $1 \leq a, b, c \leq L$.
For example:
$S(2) = 10444$
$S(3) = 1292115238446807016106539989$
$S(4) \bmod 987\,898\,789 = 670616280$.
Find $S(2000) \bmod 987\,898\,789$. | We want to tile a board of length $n$ and height $1$ completely, with either $1 \times 2$ blocks or $1 \times 1$ blocks with a single decimal digit on top:
For example, here are some of the ways to tile a board of length $n = 8$:
Let $T(n)$ be the number of ways to tile a board of length $n$ as described above.
For example, $T(1) = 10$ and $T(2) = 101$.
Let $S(L)$ be the triple sum $\sum_{a, b, c}\gcd(T(c^a), T(c^b))$ for $1 \leq a, b, c \leq L$.
For example:
$S(2) = 10444$
$S(3) = 1292115238446807016106539989$
$S(4) \bmod 987\,898\,789 = 670616280$.
Find $S(2000) \bmod 987\,898\,789$. | <p>We want to tile a board of length $n$ and height $1$ completely, with either $1 \times 2$ blocks or $1 \times 1$ blocks with a single decimal digit on top:</p>
<div class="center">
<img alt="0440_tiles.png" src="resources/images/0440_tiles.png?1678992053"/>
</div>
<p>For example, here are some of the ways to tile a board of length $n = 8$:</p>
<div class="center">
<img alt="0440_some8.png" src="resources/images/0440_some8.png?1678992053"/>
</div>
<p>Let $T(n)$ be the number of ways to tile a board of length $n$ as described above.</p>
<p>For example, $T(1) = 10$ and $T(2) = 101$.</p>
<p>Let $S(L)$ be the triple sum $\sum_{a, b, c}\gcd(T(c^a), T(c^b))$ for $1 \leq a, b, c \leq L$.<br/>
For example:<br/>
$S(2) = 10444$<br/>
$S(3) = 1292115238446807016106539989$<br/>
$S(4) \bmod 987\,898\,789 = 670616280$.</p>
<p>Find $S(2000) \bmod 987\,898\,789$.</p> | 970746056 | Sunday, 13th October 2013, 07:00 am | 429 | 60% | hard |
639 | Summing a Multiplicative Function | A multiplicative function $f(x)$ is a function over positive integers satisfying $f(1)=1$ and $f(a b)=f(a) f(b)$ for any two coprime positive integers $a$ and $b$.
For integer $k$ let $f_k(n)$ be a multiplicative function additionally satisfying $f_k(p^e)=p^k$ for any prime $p$ and any integer $e>0$.
For example, $f_1(2)=2$, $f_1(4)=2$, $f_1(18)=6$ and $f_2(18)=36$.
Let $\displaystyle S_k(n)=\sum_{i=1}^{n} f_k(i)$.
For example, $S_1(10)=41$, $S_1(100)=3512$, $S_2(100)=208090$, $S_1(10000)=35252550$ and $\displaystyle \sum_{k=1}^{3} S_k(10^{8}) \equiv 338787512 \pmod{ 1\,000\,000\,007}$.
Find $\displaystyle \sum_{k=1}^{50} S_k(10^{12}) \bmod 1\,000\,000\,007$. | A multiplicative function $f(x)$ is a function over positive integers satisfying $f(1)=1$ and $f(a b)=f(a) f(b)$ for any two coprime positive integers $a$ and $b$.
For integer $k$ let $f_k(n)$ be a multiplicative function additionally satisfying $f_k(p^e)=p^k$ for any prime $p$ and any integer $e>0$.
For example, $f_1(2)=2$, $f_1(4)=2$, $f_1(18)=6$ and $f_2(18)=36$.
Let $\displaystyle S_k(n)=\sum_{i=1}^{n} f_k(i)$.
For example, $S_1(10)=41$, $S_1(100)=3512$, $S_2(100)=208090$, $S_1(10000)=35252550$ and $\displaystyle \sum_{k=1}^{3} S_k(10^{8}) \equiv 338787512 \pmod{ 1\,000\,000\,007}$.
Find $\displaystyle \sum_{k=1}^{50} S_k(10^{12}) \bmod 1\,000\,000\,007$. | <p>A <b>multiplicative function</b> $f(x)$ is a function over positive integers satisfying $f(1)=1$ and $f(a b)=f(a) f(b)$ for any two coprime positive integers $a$ and $b$.</p>
<p>For integer $k$ let $f_k(n)$ be a multiplicative function additionally satisfying $f_k(p^e)=p^k$ for any prime $p$ and any integer $e>0$.<br>
For example, $f_1(2)=2$, $f_1(4)=2$, $f_1(18)=6$ and $f_2(18)=36$.</br></p>
<p>Let $\displaystyle S_k(n)=\sum_{i=1}^{n} f_k(i)$.
For example, $S_1(10)=41$, $S_1(100)=3512$, $S_2(100)=208090$, $S_1(10000)=35252550$ and $\displaystyle \sum_{k=1}^{3} S_k(10^{8}) \equiv 338787512 \pmod{ 1\,000\,000\,007}$.</p>
<p>Find $\displaystyle \sum_{k=1}^{50} S_k(10^{12}) \bmod 1\,000\,000\,007$.</p> | 797866893 | Sunday, 21st October 2018, 07:00 am | 304 | 70% | hard |
852 | Coins in a Box | This game has a box of $N$ unfair coins and $N$ fair coins. Fair coins have probability 50% of landing heads while unfair coins have probability 75% of landing heads.
The player begins with a score of 0 which may become negative during play.
At each round the player randomly picks a coin from the box and guesses its type: fair or unfair. Before guessing they may toss the coin any number of times; however, each toss subtracts 1 from their score. The decision to stop tossing and make a guess can be made at any time. After guessing the player's score is increased by 20 if they are right and decreased by 50 if they are wrong. Then the coin type is revealed to the player and the coin is discarded.
After $2N$ rounds the box will be empty and the game is over. Let $S(N)$ be the expected score of the player at the end of the game assuming that they play optimally in order to maximize their expected score.
You are given $S(1) = 20.558591$ rounded to 6 digits after the decimal point.
Find $S(50)$. Give your answer rounded to 6 digits after the decimal point. | This game has a box of $N$ unfair coins and $N$ fair coins. Fair coins have probability 50% of landing heads while unfair coins have probability 75% of landing heads.
The player begins with a score of 0 which may become negative during play.
At each round the player randomly picks a coin from the box and guesses its type: fair or unfair. Before guessing they may toss the coin any number of times; however, each toss subtracts 1 from their score. The decision to stop tossing and make a guess can be made at any time. After guessing the player's score is increased by 20 if they are right and decreased by 50 if they are wrong. Then the coin type is revealed to the player and the coin is discarded.
After $2N$ rounds the box will be empty and the game is over. Let $S(N)$ be the expected score of the player at the end of the game assuming that they play optimally in order to maximize their expected score.
You are given $S(1) = 20.558591$ rounded to 6 digits after the decimal point.
Find $S(50)$. Give your answer rounded to 6 digits after the decimal point. | <p>This game has a box of $N$ unfair coins and $N$ fair coins. Fair coins have probability 50% of landing heads while unfair coins have probability 75% of landing heads.</p>
<p>The player begins with a score of 0 which may become negative during play.</p>
<p>At each round the player randomly picks a coin from the box and guesses its type: fair or unfair. Before guessing they may toss the coin any number of times; however, each toss subtracts 1 from their score. The decision to stop tossing and make a guess can be made at any time. After guessing the player's score is increased by 20 if they are right and decreased by 50 if they are wrong. Then the coin type is revealed to the player and the coin is discarded.</p>
<p>After $2N$ rounds the box will be empty and the game is over. Let $S(N)$ be the expected score of the player at the end of the game assuming that they play optimally in order to maximize their expected score.</p>
<p>You are given $S(1) = 20.558591$ rounded to 6 digits after the decimal point.</p>
<p>Find $S(50)$. Give your answer rounded to 6 digits after the decimal point.</p> | 130.313496 | Saturday, 2nd September 2023, 02:00 pm | 244 | 50% | medium |
888 | 1249 Nim | Two players play a game with a number of piles of stones, alternating turns. Each turn a player can choose to remove 1, 2, 4, or 9 stones from a single pile; or alternatively they can choose to split a pile containing two or more stones into two non-empty piles. The winner is the player who removes the last stone.
A collection of piles is called a losing position if the player to move cannot force a win with optimal play. Define $S(N, m)$ to be the number of distinct losing positions arising from $m$ piles of stones where each pile contains from $1$ to $N$ stones. Two positions are considered equivalent if they consist of the same pile sizes. That is, the order of the piles does not matter.
You are given $S(12,4)=204$ and $S(124,9)=2259208528408$.
Find $S(12491249,1249)$. Give your answer modulo $912491249$. | Two players play a game with a number of piles of stones, alternating turns. Each turn a player can choose to remove 1, 2, 4, or 9 stones from a single pile; or alternatively they can choose to split a pile containing two or more stones into two non-empty piles. The winner is the player who removes the last stone.
A collection of piles is called a losing position if the player to move cannot force a win with optimal play. Define $S(N, m)$ to be the number of distinct losing positions arising from $m$ piles of stones where each pile contains from $1$ to $N$ stones. Two positions are considered equivalent if they consist of the same pile sizes. That is, the order of the piles does not matter.
You are given $S(12,4)=204$ and $S(124,9)=2259208528408$.
Find $S(12491249,1249)$. Give your answer modulo $912491249$. | <p>
Two players play a game with a number of piles of stones, alternating turns. Each turn a player can choose to remove 1, 2, 4, or 9 stones from a single pile; or alternatively they can choose to split a pile containing two or more stones into two non-empty piles. The winner is the player who removes the last stone.</p>
<p>
A collection of piles is called a losing position if the player to move cannot force a win with optimal play. Define $S(N, m)$ to be the number of distinct losing positions arising from $m$ piles of stones where each pile contains from $1$ to $N$ stones. Two positions are considered equivalent if they consist of the same pile sizes. That is, the order of the piles does not matter.</p>
<p>
You are given $S(12,4)=204$ and $S(124,9)=2259208528408$.</p>
<p>
Find $S(12491249,1249)$. Give your answer modulo $912491249$.</p> | 227429102 | Saturday, 27th April 2024, 08:00 pm | 189 | 45% | medium |
227 | The Chase | The Chase is a game played with two dice and an even number of players.
The players sit around a table and the game begins with two opposite players having one die each. On each turn, the two players with a die roll it.
If the player rolls 1, then the die passes to the neighbour on the left.
If the player rolls 6, then the die passes to the neighbour on the right.
Otherwise, the player keeps the die for the next turn.
The game ends when one player has both dice after they have been rolled and passed; that player has then lost.
In a game with 100 players, what is the expected number of turns the game lasts?
Give your answer rounded to ten significant digits. | The Chase is a game played with two dice and an even number of players.
The players sit around a table and the game begins with two opposite players having one die each. On each turn, the two players with a die roll it.
If the player rolls 1, then the die passes to the neighbour on the left.
If the player rolls 6, then the die passes to the neighbour on the right.
Otherwise, the player keeps the die for the next turn.
The game ends when one player has both dice after they have been rolled and passed; that player has then lost.
In a game with 100 players, what is the expected number of turns the game lasts?
Give your answer rounded to ten significant digits. | <p><dfn>The Chase</dfn> is a game played with two dice and an even number of players.</p>
<p>The players sit around a table and the game begins with two opposite players having one die each. On each turn, the two players with a die roll it.</p>
<p>If the player rolls 1, then the die passes to the neighbour on the left.<br>
If the player rolls 6, then the die passes to the neighbour on the right.<br/>
Otherwise, the player keeps the die for the next turn.</br></p>
<p>The game ends when one player has both dice after they have been rolled and passed; that player has then lost.</p>
<p>In a game with 100 players, what is the expected number of turns the game lasts?</p>
<p>Give your answer rounded to ten significant digits.</p> | 3780.618622 | Saturday, 10th January 2009, 01:00 am | 2354 | 65% | hard |
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.$$
We shall say that $M(n, d)$ represents the maximum number of repeated digits for an $n$-digit prime where $d$ is the repeated digit, $N(n, d)$ represents the number of such primes, and $S(n, d)$ represents the sum of these primes.
So $M(4, 1) = 3$ is the maximum number of repeated digits for a $4$-digit prime where one is the repeated digit, there are $N(4, 1) = 9$ such primes, and the sum of these primes is $S(4, 1) = 22275$. It turns out that for $d = 0$, it is only possible to have $M(4, 0) = 2$ repeated digits, but there are $N(4, 0) = 13$ such cases.
In the same way we obtain the following results for $4$-digit primes.
Digit, d
M(4, d)
N(4, d)
S(4, d)
0
2
13
67061
1
3
9
22275
2
3
1
2221
3
3
12
46214
4
3
2
8888
5
3
1
5557
6
3
1
6661
7
3
9
57863
8
3
1
8887
9
3
7
48073
For $d = 0$ to $9$, the sum of all $S(4, d)$ is $273700$.
Find the sum of all $S(10, d)$. | Considering $4$-digit primes containing repeated digits it is clear that they cannot all be the same: $1111$ is divisible by $11$, $2222$ is divisible by $22$, and so on. But there are nine $4$-digit primes containing three ones:
$$1117, 1151, 1171, 1181, 1511, 1811, 2111, 4111, 8111.$$
We shall say that $M(n, d)$ represents the maximum number of repeated digits for an $n$-digit prime where $d$ is the repeated digit, $N(n, d)$ represents the number of such primes, and $S(n, d)$ represents the sum of these primes.
So $M(4, 1) = 3$ is the maximum number of repeated digits for a $4$-digit prime where one is the repeated digit, there are $N(4, 1) = 9$ such primes, and the sum of these primes is $S(4, 1) = 22275$. It turns out that for $d = 0$, it is only possible to have $M(4, 0) = 2$ repeated digits, but there are $N(4, 0) = 13$ such cases.
In the same way we obtain the following results for $4$-digit primes.
Digit, d
M(4, d)
N(4, d)
S(4, d)
0
2
13
67061
1
3
9
22275
2
3
1
2221
3
3
12
46214
4
3
2
8888
5
3
1
5557
6
3
1
6661
7
3
9
57863
8
3
1
8887
9
3
7
48073
For $d = 0$ to $9$, the sum of all $S(4, d)$ is $273700$.
Find the sum of all $S(10, d)$. | <p>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.$$</p>
<p>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.</p>
<p>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.</p>
<p>In the same way we obtain the following results for $4$-digit primes.</p>
<div class="center">
<table align="center" border="1" cellpadding="5" cellspacing="0"><tr><td><b>Digit, <i>d</i></b></td>
<td><b>M(4, <i>d</i>)</b></td>
<td><b>N(4, <i>d</i>)</b></td>
<td><b>S(4, <i>d</i>)</b></td>
</tr><tr><td>0</td>
<td>2</td>
<td>13</td>
<td>67061</td>
</tr><tr><td>1</td>
<td>3</td>
<td>9</td>
<td>22275</td>
</tr><tr><td>2</td>
<td>3</td>
<td>1</td>
<td>2221</td>
</tr><tr><td>3</td>
<td>3</td>
<td>12</td>
<td>46214</td>
</tr><tr><td>4</td>
<td>3</td>
<td>2</td>
<td>8888</td>
</tr><tr><td>5</td>
<td>3</td>
<td>1</td>
<td>5557</td>
</tr><tr><td>6</td>
<td>3</td>
<td>1</td>
<td>6661</td>
</tr><tr><td>7</td>
<td>3</td>
<td>9</td>
<td>57863</td>
</tr><tr><td>8</td>
<td>3</td>
<td>1</td>
<td>8887</td>
</tr><tr><td>9</td>
<td>3</td>
<td>7</td>
<td>48073</td>
</tr></table></div>
<p>For $d = 0$ to $9$, the sum of all $S(4, d)$ is $273700$.</p>
<p>Find the sum of all $S(10, d)$.</p> | 612407567715 | Friday, 16th December 2005, 06:00 pm | 8210 | 45% | medium |
617 | Mirror Power Sequence | For two integers $n,e \gt 1$, we define an $(n,e)$-MPS (Mirror Power Sequence) to be an infinite sequence of integers $(a_i)_{i\ge 0}$ such that for all $i\ge 0$, $a_{i+1} = \min(a_i^e,n-a_i^e)$ and $a_i \gt 1$. Examples of such sequences are the two $(18,2)$-MPS sequences made of alternating $2$ and $4$.
Note that even though such a sequence is uniquely determined by $n,e$ and $a_0$, for most values such a sequence does not exist. For example, no $(n,e)$-MPS exists for $n \lt 6$.
Define $C(n)$ to be the number of $(n,e)$-MPS for some $e$, and $\displaystyle D(N) = \sum_{n=2}^N C(n)$.
You are given that $D(10) = 2$, $D(100) = 21$, $D(1000) = 69$, $D(10^6) = 1303$ and $D(10^{12}) = 1014800$.
Find $D(10^{18})$. | For two integers $n,e \gt 1$, we define an $(n,e)$-MPS (Mirror Power Sequence) to be an infinite sequence of integers $(a_i)_{i\ge 0}$ such that for all $i\ge 0$, $a_{i+1} = \min(a_i^e,n-a_i^e)$ and $a_i \gt 1$. Examples of such sequences are the two $(18,2)$-MPS sequences made of alternating $2$ and $4$.
Note that even though such a sequence is uniquely determined by $n,e$ and $a_0$, for most values such a sequence does not exist. For example, no $(n,e)$-MPS exists for $n \lt 6$.
Define $C(n)$ to be the number of $(n,e)$-MPS for some $e$, and $\displaystyle D(N) = \sum_{n=2}^N C(n)$.
You are given that $D(10) = 2$, $D(100) = 21$, $D(1000) = 69$, $D(10^6) = 1303$ and $D(10^{12}) = 1014800$.
Find $D(10^{18})$. | <p>For two integers $n,e \gt 1$, we define an <dfn>$(n,e)$-MPS (Mirror Power Sequence)</dfn> to be an infinite sequence of integers $(a_i)_{i\ge 0}$ such that for all $i\ge 0$, $a_{i+1} = \min(a_i^e,n-a_i^e)$ and $a_i \gt 1$.<br/> Examples of such sequences are the two $(18,2)$-MPS sequences made of alternating $2$ and $4$.</p>
<p>Note that even though such a sequence is uniquely determined by $n,e$ and $a_0$, for most values such a sequence does not exist. For example, no $(n,e)$-MPS exists for $n \lt 6$.</p>
<p>Define $C(n)$ to be the number of $(n,e)$-MPS for some $e$, and $\displaystyle D(N) = \sum_{n=2}^N C(n)$.
<br/>You are given that $D(10) = 2$, $D(100) = 21$, $D(1000) = 69$, $D(10^6) = 1303$ and $D(10^{12}) = 1014800$.</p>
<p>Find $D(10^{18})$.</p> | 1001133757 | Saturday, 30th December 2017, 04:00 pm | 407 | 40% | medium |
614 | Special Partitions 2 | An integer partition of a number $n$ is a way of writing $n$ as a sum of positive integers. Partitions that differ only by the order of their summands are considered the same.
We call an integer partition special if 1) all its summands are distinct, and 2) all its even summands are also divisible by $4$.For example, the special partitions of $10$ are: \[10 = 1+4+5=3+7=1+9\]
The number $10$ admits many more integer partitions (a total of $42$), but only those three are special.
Let be $P(n)$ the number of special integer partitions of $n$. You are given that $P(1) = 1$, $P(2) = 0$, $P(3) = 1$, $P(6) = 1$, $P(10)=3$, $P(100) = 37076$ and $P(1000)=3699177285485660336$.
Find $\displaystyle \sum_{i=1}^{10^7} P(i)$. Give the result modulo $10^9+7$. | An integer partition of a number $n$ is a way of writing $n$ as a sum of positive integers. Partitions that differ only by the order of their summands are considered the same.
We call an integer partition special if 1) all its summands are distinct, and 2) all its even summands are also divisible by $4$.For example, the special partitions of $10$ are: \[10 = 1+4+5=3+7=1+9\]
The number $10$ admits many more integer partitions (a total of $42$), but only those three are special.
Let be $P(n)$ the number of special integer partitions of $n$. You are given that $P(1) = 1$, $P(2) = 0$, $P(3) = 1$, $P(6) = 1$, $P(10)=3$, $P(100) = 37076$ and $P(1000)=3699177285485660336$.
Find $\displaystyle \sum_{i=1}^{10^7} P(i)$. Give the result modulo $10^9+7$. | <p>An <strong>integer partition</strong> of a number $n$ is a way of writing $n$ as a sum of positive integers. Partitions that differ only by the order of their summands are considered the same.</p>
<p>We call an integer partition <dfn>special</dfn> if 1) all its summands are distinct, and 2) all its even summands are also divisible by $4$.<br/>For example, the special partitions of $10$ are: \[10 = 1+4+5=3+7=1+9\]
The number $10$ admits many more integer partitions (a total of $42$), but only those three are special.</p>
<p>Let be $P(n)$ the number of special integer partitions of $n$. You are given that $P(1) = 1$, $P(2) = 0$, $P(3) = 1$, $P(6) = 1$, $P(10)=3$, $P(100) = 37076$ and $P(1000)=3699177285485660336$.</p>
<p>Find $\displaystyle \sum_{i=1}^{10^7} P(i)$. Give the result modulo $10^9+7$.</p> | 130694090 | Sunday, 19th November 2017, 07:00 am | 331 | 55% | medium |
903 | Total Permutation Powers | A permutation $\pi$ of $\{1, \dots, n\}$ can be represented in one-line notation as $\pi(1),\ldots,\pi(n) $. If all $n!$ permutations are written in lexicographic order then $\textrm{rank}(\pi)$ is the position of $\pi$ in this 1-based list.
For example, $\text{rank}(2,1,3) = 3$ because the six permutations of $\{1, 2, 3\}$ in lexicographic order are:
$$1, 2, 3\quad 1, 3, 2 \quad 2, 1, 3 \quad 2, 3, 1 \quad 3, 1, 2 \quad 3, 2, 1$$
Let $Q(n)$ be the sum $\sum_{\pi}\sum_{i = 1}^{n!} \text{rank}(\pi^i)$, where $\pi$ ranges over all permutations of $\{1, \dots, n\}$, and $\pi^i$ is the permutation arising from applying $\pi$ $i$ times.
For example, $Q(2) = 5$, $Q(3) = 88$, $Q(6) = 133103808$ and $Q(10) \equiv 468421536 \pmod {10^9 + 7}$.
Find $Q(10^6)$. Give your answer modulo $(10^9 + 7)$. | A permutation $\pi$ of $\{1, \dots, n\}$ can be represented in one-line notation as $\pi(1),\ldots,\pi(n) $. If all $n!$ permutations are written in lexicographic order then $\textrm{rank}(\pi)$ is the position of $\pi$ in this 1-based list.
For example, $\text{rank}(2,1,3) = 3$ because the six permutations of $\{1, 2, 3\}$ in lexicographic order are:
$$1, 2, 3\quad 1, 3, 2 \quad 2, 1, 3 \quad 2, 3, 1 \quad 3, 1, 2 \quad 3, 2, 1$$
Let $Q(n)$ be the sum $\sum_{\pi}\sum_{i = 1}^{n!} \text{rank}(\pi^i)$, where $\pi$ ranges over all permutations of $\{1, \dots, n\}$, and $\pi^i$ is the permutation arising from applying $\pi$ $i$ times.
For example, $Q(2) = 5$, $Q(3) = 88$, $Q(6) = 133103808$ and $Q(10) \equiv 468421536 \pmod {10^9 + 7}$.
Find $Q(10^6)$. Give your answer modulo $(10^9 + 7)$. | <p>A permutation $\pi$ of $\{1, \dots, n\}$ can be represented in <b>one-line notation</b> as $\pi(1),\ldots,\pi(n) $. If all $n!$ permutations are written in lexicographic order then $\textrm{rank}(\pi)$ is the position of $\pi$ in this 1-based list.</p>
<p>For example, $\text{rank}(2,1,3) = 3$ because the six permutations of $\{1, 2, 3\}$ in lexicographic order are:
$$1, 2, 3\quad 1, 3, 2 \quad 2, 1, 3 \quad 2, 3, 1 \quad 3, 1, 2 \quad 3, 2, 1$$
</p>
<p>Let $Q(n)$ be the sum $\sum_{\pi}\sum_{i = 1}^{n!} \text{rank}(\pi^i)$, where $\pi$ ranges over all permutations of $\{1, \dots, n\}$, and $\pi^i$ is the permutation arising from applying $\pi$ $i$ times.</p>
<p>For example, $Q(2) = 5$, $Q(3) = 88$, $Q(6) = 133103808$ and $Q(10) \equiv 468421536 \pmod {10^9 + 7}$.</p>
<p>Find $Q(10^6)$. Give your answer modulo $(10^9 + 7)$.</p> | 128553191 | Sunday, 28th July 2024, 11:00 am | 118 | 90% | hard |
664 | An Infinite Game | Peter is playing a solitaire game on an infinite checkerboard, each square of which can hold an unlimited number of tokens.
Each move of the game consists of the following steps:
Choose one token $T$ to move. This may be any token on the board, as long as not all of its four adjacent squares are empty.
Select and discard one token $D$ from a square adjacent to that of $T$.
Move $T$ to any one of its four adjacent squares (even if that square is already occupied).
The board is marked with a line called the dividing line. Initially, every square to the left of the dividing line contains a token, and every square to the right of the dividing line is empty:
Peter's goal is to get a token as far as possible to the right in a finite number of moves. However, he quickly finds out that, even with his infinite supply of tokens, he cannot move a token more than four squares beyond the dividing line.
Peter then considers starting configurations with larger supplies of tokens: each square in the $d$th column to the left of the dividing line starts with $d^n$ tokens instead of $1$. This is illustrated below for $n=1$:
Let $F(n)$ be the maximum number of squares Peter can move a token beyond the dividing line. For example, $F(0)=4$.
You are also given that $F(1)=6$, $F(2)=9$, $F(3)=13$, $F(11)=58$ and $F(123)=1173$.
Find $F(1234567)$. | Peter is playing a solitaire game on an infinite checkerboard, each square of which can hold an unlimited number of tokens.
Each move of the game consists of the following steps:
Choose one token $T$ to move. This may be any token on the board, as long as not all of its four adjacent squares are empty.
Select and discard one token $D$ from a square adjacent to that of $T$.
Move $T$ to any one of its four adjacent squares (even if that square is already occupied).
The board is marked with a line called the dividing line. Initially, every square to the left of the dividing line contains a token, and every square to the right of the dividing line is empty:
Peter's goal is to get a token as far as possible to the right in a finite number of moves. However, he quickly finds out that, even with his infinite supply of tokens, he cannot move a token more than four squares beyond the dividing line.
Peter then considers starting configurations with larger supplies of tokens: each square in the $d$th column to the left of the dividing line starts with $d^n$ tokens instead of $1$. This is illustrated below for $n=1$:
Let $F(n)$ be the maximum number of squares Peter can move a token beyond the dividing line. For example, $F(0)=4$.
You are also given that $F(1)=6$, $F(2)=9$, $F(3)=13$, $F(11)=58$ and $F(123)=1173$.
Find $F(1234567)$. | <p>Peter is playing a solitaire game on an infinite checkerboard, each square of which can hold an unlimited number of tokens.</p>
<p>Each move of the game consists of the following steps:</p>
<ol>
<li>Choose one token $T$ to move. This may be any token on the board, as long as not all of its four adjacent squares are empty.</li>
<li>Select and discard one token $D$ from a square adjacent to that of $T$.</li>
<li>Move $T$ to any one of its four adjacent squares (even if that square is already occupied).</li>
</ol>
<div class="center">
<img alt="Allowed moves" src="resources/images/0664_moves.gif?1678992057"/>
</div>
<p>The board is marked with a line called the <dfn>dividing line</dfn>. Initially, every square to the left of the dividing line contains a token, and every square to the right of the dividing line is empty:</p>
<div class="center">
<img alt="Initial setup" src="resources/images/0664_starting_0.png?1678992054"/>
</div>
<p>Peter's goal is to get a token as far as possible to the right in a finite number of moves. However, he quickly finds out that, even with his infinite supply of tokens, he cannot move a token more than four squares beyond the dividing line.</p>
<p>Peter then considers starting configurations with larger supplies of tokens: each square in the $d$th column to the left of the dividing line starts with $d^n$ tokens instead of $1$. This is illustrated below for $n=1$:</p>
<div class="center">
<img alt="Initial setup n=1" src="resources/images/0664_starting_1.png?1678992054"/>
</div>
<p>Let $F(n)$ be the maximum number of squares Peter can move a token beyond the dividing line. For example, $F(0)=4$.
You are also given that $F(1)=6$, $F(2)=9$, $F(3)=13$, $F(11)=58$ and $F(123)=1173$.</p>
<p>Find $F(1234567)$.</p> | 35295862 | Sunday, 7th April 2019, 07:00 am | 212 | 65% | hard |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.