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 |
---|---|---|---|---|---|---|---|---|---|
569 | Prime Mountain Range | A mountain range consists of a line of mountains with slopes of exactly $45^\circ$, and heights governed by the prime numbers, $p_n$. The up-slope of the $k$th mountain is of height $p_{2k - 1}$, and the downslope is $p_{2k}$. The first few foot-hills of this range are illustrated below.
Tenzing sets out to climb each one in turn, starting from the lowest. At the top of each peak, he looks back and counts how many of the previous peaks he can see. In the example above, the eye-line from the third mountain is drawn in red, showing that he can only see the peak of the second mountain from this viewpoint. Similarly, from the $9$th mountain, he can see three peaks, those of the $5$th, $7$th and $8$th mountain.
Let $P(k)$ be the number of peaks that are visible looking back from the $k$th mountain. Hence $P(3)=1$ and $P(9)=3$.
Also $\displaystyle \sum_{k=1}^{100} P(k) = 227$.
Find $\displaystyle \sum_{k=1}^{2500000} P(k)$. | A mountain range consists of a line of mountains with slopes of exactly $45^\circ$, and heights governed by the prime numbers, $p_n$. The up-slope of the $k$th mountain is of height $p_{2k - 1}$, and the downslope is $p_{2k}$. The first few foot-hills of this range are illustrated below.
Tenzing sets out to climb each one in turn, starting from the lowest. At the top of each peak, he looks back and counts how many of the previous peaks he can see. In the example above, the eye-line from the third mountain is drawn in red, showing that he can only see the peak of the second mountain from this viewpoint. Similarly, from the $9$th mountain, he can see three peaks, those of the $5$th, $7$th and $8$th mountain.
Let $P(k)$ be the number of peaks that are visible looking back from the $k$th mountain. Hence $P(3)=1$ and $P(9)=3$.
Also $\displaystyle \sum_{k=1}^{100} P(k) = 227$.
Find $\displaystyle \sum_{k=1}^{2500000} P(k)$. | <p>A <dfn>mountain range</dfn> consists of a line of mountains with slopes of exactly $45^\circ$, and heights governed by the prime numbers, $p_n$. The up-slope of the $k$<sup>th</sup> mountain is of height $p_{2k - 1}$, and the downslope is $p_{2k}$. The first few foot-hills of this range are illustrated below.</p>
<div class="center">
<img alt="0569-prime-mountain-range.gif" src="resources/images/0569-prime-mountain-range.gif?1678992057"/>
</div>
<p>Tenzing sets out to climb each one in turn, starting from the lowest. At the top of each peak, he looks back and counts how many of the previous peaks he can see. In the example above, the eye-line from the third mountain is drawn in red, showing that he can only see the peak of the second mountain from this viewpoint. Similarly, from the $9$<sup>th</sup> mountain, he can see three peaks, those of the $5$<sup>th</sup>, $7$<sup>th</sup> and $8$<sup>th</sup> mountain.</p>
<p>Let $P(k)$ be the number of peaks that are visible looking back from the $k$<sup>th</sup> mountain. Hence $P(3)=1$ and $P(9)=3$.<br/>
Also $\displaystyle \sum_{k=1}^{100} P(k) = 227$.</p>
<p>Find $\displaystyle \sum_{k=1}^{2500000} P(k)$.</p> | 21025060 | Saturday, 10th September 2016, 07:00 pm | 442 | 45% | medium |
461 | Almost Pi | Let $f_n(k) = e^{k/n} - 1$, for all non-negative integers $k$.
Remarkably, $f_{200}(6)+f_{200}(75)+f_{200}(89)+f_{200}(226)=\underline{3.1415926}44529\cdots\approx\pi$.
In fact, it is the best approximation of $\pi$ of the form $f_n(a) + f_n(b) + f_n(c) + f_n(d)$ for $n=200$.
Let $g(n)=a^2 + b^2 + c^2 + d^2$ for $a, b, c, d$ that minimize the error: $|f_n(a) + f_n(b) + f_n(c) + f_n(d) - \pi|$
(where $|x|$ denotes the absolute value of $x$).
You are given $g(200)=6^2+75^2+89^2+226^2=64658$.
Find $g(10000)$. | Let $f_n(k) = e^{k/n} - 1$, for all non-negative integers $k$.
Remarkably, $f_{200}(6)+f_{200}(75)+f_{200}(89)+f_{200}(226)=\underline{3.1415926}44529\cdots\approx\pi$.
In fact, it is the best approximation of $\pi$ of the form $f_n(a) + f_n(b) + f_n(c) + f_n(d)$ for $n=200$.
Let $g(n)=a^2 + b^2 + c^2 + d^2$ for $a, b, c, d$ that minimize the error: $|f_n(a) + f_n(b) + f_n(c) + f_n(d) - \pi|$
(where $|x|$ denotes the absolute value of $x$).
You are given $g(200)=6^2+75^2+89^2+226^2=64658$.
Find $g(10000)$. | <p>Let $f_n(k) = e^{k/n} - 1$, for all non-negative integers $k$.</p>
<p>Remarkably, $f_{200}(6)+f_{200}(75)+f_{200}(89)+f_{200}(226)=\underline{3.1415926}44529\cdots\approx\pi$.</p>
<p>In fact, it is the best approximation of $\pi$ of the form $f_n(a) + f_n(b) + f_n(c) + f_n(d)$ for $n=200$.</p>
<p>Let $g(n)=a^2 + b^2 + c^2 + d^2$ for $a, b, c, d$ that minimize the error: $|f_n(a) + f_n(b) + f_n(c) + f_n(d) - \pi|$<br/>
(where $|x|$ denotes the absolute value of $x$).</p>
<p>You are given $g(200)=6^2+75^2+89^2+226^2=64658$.</p>
<p>Find $g(10000)$.</p> | 159820276 | Saturday, 1st March 2014, 04:00 pm | 1350 | 30% | easy |
20 | Factorial Digit Sum | $n!$ means $n \times (n - 1) \times \cdots \times 3 \times 2 \times 1$.
For example, $10! = 10 \times 9 \times \cdots \times 3 \times 2 \times 1 = 3628800$,and the sum of the digits in the number $10!$ is $3 + 6 + 2 + 8 + 8 + 0 + 0 = 27$.
Find the sum of the digits in the number $100!$. | $n!$ means $n \times (n - 1) \times \cdots \times 3 \times 2 \times 1$.
For example, $10! = 10 \times 9 \times \cdots \times 3 \times 2 \times 1 = 3628800$,and the sum of the digits in the number $10!$ is $3 + 6 + 2 + 8 + 8 + 0 + 0 = 27$.
Find the sum of the digits in the number $100!$. | <p>$n!$ means $n \times (n - 1) \times \cdots \times 3 \times 2 \times 1$.</p>
<p>For example, $10! = 10 \times 9 \times \cdots \times 3 \times 2 \times 1 = 3628800$,<br/>and the sum of the digits in the number $10!$ is $3 + 6 + 2 + 8 + 8 + 0 + 0 = 27$.</p>
<p>Find the sum of the digits in the number $100!$.</p> | 648 | Friday, 21st June 2002, 06:00 pm | 213193 | 5% | easy |
163 | Cross-hatched Triangles | Consider an equilateral triangle in which straight lines are drawn from each vertex to the middle of the opposite side, such as in the size $1$ triangle in the sketch below.
Sixteen triangles of either different shape or size or orientation or location can now be observed in that triangle. Using size $1$ triangles as building blocks, larger triangles can be formed, such as the size $2$ triangle in the above sketch. One-hundred and four triangles of either different shape or size or orientation or location can now be observed in that size $2$ triangle.
It can be observed that the size $2$ triangle contains $4$ size $1$ triangle building blocks. A size $3$ triangle would contain $9$ size $1$ triangle building blocks and a size $n$ triangle would thus contain $n^2$ size $1$ triangle building blocks.
If we denote $T(n)$ as the number of triangles present in a triangle of size $n$, then
\begin{align}
T(1) &= 16\\
T(2) &= 104
\end{align}
Find $T(36)$. | Consider an equilateral triangle in which straight lines are drawn from each vertex to the middle of the opposite side, such as in the size $1$ triangle in the sketch below.
Sixteen triangles of either different shape or size or orientation or location can now be observed in that triangle. Using size $1$ triangles as building blocks, larger triangles can be formed, such as the size $2$ triangle in the above sketch. One-hundred and four triangles of either different shape or size or orientation or location can now be observed in that size $2$ triangle.
It can be observed that the size $2$ triangle contains $4$ size $1$ triangle building blocks. A size $3$ triangle would contain $9$ size $1$ triangle building blocks and a size $n$ triangle would thus contain $n^2$ size $1$ triangle building blocks.
If we denote $T(n)$ as the number of triangles present in a triangle of size $n$, then
\begin{align}
T(1) &= 16\\
T(2) &= 104
\end{align}
Find $T(36)$. | <p>Consider an equilateral triangle in which straight lines are drawn from each vertex to the middle of the opposite side, such as in the <i>size $1$</i> triangle in the sketch below.</p>
<div class="center"><img alt="" class="dark_img" src="resources/images/0163.gif?1678992055"/></div>
<p>Sixteen triangles of either different shape or size or orientation or location can now be observed in that triangle. Using <i>size $1$</i> triangles as building blocks, larger triangles can be formed, such as the <i>size $2$</i> triangle in the above sketch. One-hundred and four triangles of either different shape or size or orientation or location can now be observed in that <i>size $2$</i> triangle.</p>
<p>It can be observed that the <i>size $2$</i> triangle contains $4$ <i>size $1$</i> triangle building blocks. A <i>size $3$</i> triangle would contain $9$ <i>size $1$</i> triangle building blocks and a <i>size $n$</i> triangle would thus contain $n^2$ <i>size $1$</i> triangle building blocks.</p>
<p>If we denote $T(n)$ as the number of triangles present in a triangle of <i>size $n$</i>, then</p>
\begin{align}
T(1) &= 16\\
T(2) &= 104
\end{align}
<p>Find $T(36)$.</p> | 343047 | Saturday, 13th October 2007, 02:00 am | 2079 | 70% | hard |
17 | Number Letter Counts | If the numbers $1$ to $5$ are written out in words: one, two, three, four, five, then there are $3 + 3 + 5 + 4 + 4 = 19$ letters used in total.
If all the numbers from $1$ to $1000$ (one thousand) inclusive were written out in words, how many letters would be used?
NOTE: Do not count spaces or hyphens. For example, $342$ (three hundred and forty-two) contains $23$ letters and $115$ (one hundred and fifteen) contains $20$ letters. The use of "and" when writing out numbers is in compliance with British usage. | If the numbers $1$ to $5$ are written out in words: one, two, three, four, five, then there are $3 + 3 + 5 + 4 + 4 = 19$ letters used in total.
If all the numbers from $1$ to $1000$ (one thousand) inclusive were written out in words, how many letters would be used?
NOTE: Do not count spaces or hyphens. For example, $342$ (three hundred and forty-two) contains $23$ letters and $115$ (one hundred and fifteen) contains $20$ letters. The use of "and" when writing out numbers is in compliance with British usage. | <p>If the numbers $1$ to $5$ are written out in words: one, two, three, four, five, then there are $3 + 3 + 5 + 4 + 4 = 19$ letters used in total.</p>
<p>If all the numbers from $1$ to $1000$ (one thousand) inclusive were written out in words, how many letters would be used? </p>
<br/><p class="note"><b>NOTE:</b> Do not count spaces or hyphens. For example, $342$ (three hundred and forty-two) contains $23$ letters and $115$ (one hundred and fifteen) contains $20$ letters. The use of "and" when writing out numbers is in compliance with British usage.</p> | 21124 | Friday, 17th May 2002, 06:00 pm | 164064 | 5% | easy |
824 | Chess Sliders | A Slider is a chess piece that can move one square left or right.
This problem uses a cylindrical chess board where the left hand edge of the board is connected to the right hand edge. This means that a Slider that is on the left hand edge of the chess board can move to the right hand edge of the same row and vice versa.
Let $L(N,K)$ be the number of ways $K$ non-attacking Sliders can be placed on an $N \times N$ cylindrical chess-board.
For example, $L(2,2)=4$ and $L(6,12)=4204761$.
Find $L(10^9,10^{15}) \bmod \left(10^7+19\right)^2$. | A Slider is a chess piece that can move one square left or right.
This problem uses a cylindrical chess board where the left hand edge of the board is connected to the right hand edge. This means that a Slider that is on the left hand edge of the chess board can move to the right hand edge of the same row and vice versa.
Let $L(N,K)$ be the number of ways $K$ non-attacking Sliders can be placed on an $N \times N$ cylindrical chess-board.
For example, $L(2,2)=4$ and $L(6,12)=4204761$.
Find $L(10^9,10^{15}) \bmod \left(10^7+19\right)^2$. | <p>A <dfn>Slider</dfn> is a chess piece that can move one square left or right.</p>
<p>This problem uses a cylindrical chess board where the left hand edge of the board is connected to the right hand edge. This means that a Slider that is on the left hand edge of the chess board can move to the right hand edge of the same row and vice versa.</p>
<p>Let $L(N,K)$ be the number of ways $K$ non-attacking Sliders can be placed on an $N \times N$ cylindrical chess-board.</p>
<p>For example, $L(2,2)=4$ and $L(6,12)=4204761$.</p>
<p>Find $L(10^9,10^{15}) \bmod \left(10^7+19\right)^2$.</p> | 26532152736197 | Sunday, 8th January 2023, 04:00 am | 135 | 95% | hard |
309 | Integer Ladders | In the classic "Crossing Ladders" problem, we are given the lengths $x$ and $y$ of two ladders resting on the opposite walls of a narrow, level street. We are also given the height $h$ above the street where the two ladders cross and we are asked to find the width of the street ($w$).
Here, we are only concerned with instances where all four variables are positive integers.
For example, if $x = 70$, $y = 119$ and $h = 30$, we can calculate that $w = 56$.
In fact, for integer values $x$, $y$, $h$ and $0 \lt x \lt y \lt 200$, there are only five triplets $(x, y, h)$ producing integer solutions for $w$:
$(70, 119, 30)$, $(74, 182, 21)$, $(87, 105, 35)$, $(100, 116, 35)$ and $(119, 175, 40)$.
For integer values $x, y, h$ and $0 \lt x \lt y \lt 1\,000\,000$, how many triplets $(x, y, h)$ produce integer solutions for $w$? | In the classic "Crossing Ladders" problem, we are given the lengths $x$ and $y$ of two ladders resting on the opposite walls of a narrow, level street. We are also given the height $h$ above the street where the two ladders cross and we are asked to find the width of the street ($w$).
Here, we are only concerned with instances where all four variables are positive integers.
For example, if $x = 70$, $y = 119$ and $h = 30$, we can calculate that $w = 56$.
In fact, for integer values $x$, $y$, $h$ and $0 \lt x \lt y \lt 200$, there are only five triplets $(x, y, h)$ producing integer solutions for $w$:
$(70, 119, 30)$, $(74, 182, 21)$, $(87, 105, 35)$, $(100, 116, 35)$ and $(119, 175, 40)$.
For integer values $x, y, h$ and $0 \lt x \lt y \lt 1\,000\,000$, how many triplets $(x, y, h)$ produce integer solutions for $w$? | <p>In the classic "Crossing Ladders" problem, we are given the lengths $x$ and $y$ of two ladders resting on the opposite walls of a narrow, level street. We are also given the height $h$ above the street where the two ladders cross and we are asked to find the width of the street ($w$).</p>
<div align="center"><img alt="0309_ladders.gif" class="dark_img" src="resources/images/0309_ladders.gif?1678992056"/></div>
<p>Here, we are only concerned with instances where all four variables are positive integers.<br/>
For example, if $x = 70$, $y = 119$ and $h = 30$, we can calculate that $w = 56$.</p>
<p>In fact, for integer values $x$, $y$, $h$ and $0 \lt x \lt y \lt 200$, there are only five triplets $(x, y, h)$ producing integer solutions for $w$:<br/>
$(70, 119, 30)$, $(74, 182, 21)$, $(87, 105, 35)$, $(100, 116, 35)$ and $(119, 175, 40)$.</p>
<p>For integer values $x, y, h$ and $0 \lt x \lt y \lt 1\,000\,000$, how many triplets $(x, y, h)$ produce integer solutions for $w$?</p> | 210139 | Saturday, 6th November 2010, 04:00 pm | 915 | 50% | medium |
896 | Divisible Ranges | A contiguous range of positive integers is called a divisible range if all the integers in the range can be arranged in a row such that the $n$-th term is a multiple of $n$.
For example, the range $[6..9]$ is a divisible range because we can arrange the numbers as $7,6,9,8$.
In fact, it is the $4$th divisible range of length $4$, the first three being $[1..4], [2..5], [3..6]$.
Find the $36$th divisible range of length $36$.
Give as answer the smallest number in the range. | A contiguous range of positive integers is called a divisible range if all the integers in the range can be arranged in a row such that the $n$-th term is a multiple of $n$.
For example, the range $[6..9]$ is a divisible range because we can arrange the numbers as $7,6,9,8$.
In fact, it is the $4$th divisible range of length $4$, the first three being $[1..4], [2..5], [3..6]$.
Find the $36$th divisible range of length $36$.
Give as answer the smallest number in the range. | <p>
A contiguous range of positive integers is called a <dfn>divisible range</dfn> if all the integers in the range can be arranged in a row such that the $n$-th term is a multiple of $n$.<br/>
For example, the range $[6..9]$ is a divisible range because we can arrange the numbers as $7,6,9,8$.<br/>
In fact, it is the $4$th divisible range of length $4$, the first three being $[1..4], [2..5], [3..6]$.</p>
<p>
Find the $36$th divisible range of length $36$.<br/>
Give as answer the smallest number in the range.</p> | 274229635640 | Saturday, 22nd June 2024, 08:00 pm | 217 | 50% | medium |
496 | Incenter and Circumcenter of Triangle | Given an integer sided triangle $ABC$:
Let $I$ be the incenter of $ABC$.
Let $D$ be the intersection between the line $AI$ and the circumcircle of $ABC$ ($A \ne D$).
We define $F(L)$ as the sum of $BC$ for the triangles $ABC$ that satisfy $AC = DI$ and $BC \le L$.
For example, $F(15) = 45$ because the triangles $ABC$ with $(BC,AC,AB) = (6,4,5), (12,8,10), (12,9,7), (15,9,16)$ satisfy the conditions.
Find $F(10^9)$. | Given an integer sided triangle $ABC$:
Let $I$ be the incenter of $ABC$.
Let $D$ be the intersection between the line $AI$ and the circumcircle of $ABC$ ($A \ne D$).
We define $F(L)$ as the sum of $BC$ for the triangles $ABC$ that satisfy $AC = DI$ and $BC \le L$.
For example, $F(15) = 45$ because the triangles $ABC$ with $(BC,AC,AB) = (6,4,5), (12,8,10), (12,9,7), (15,9,16)$ satisfy the conditions.
Find $F(10^9)$. | <p>Given an integer sided triangle $ABC$:<br/>
Let $I$ be the incenter of $ABC$.<br/>
Let $D$ be the intersection between the line $AI$ and the circumcircle of $ABC$ ($A \ne D$).</p>
<p>We define $F(L)$ as the sum of $BC$ for the triangles $ABC$ that satisfy $AC = DI$ and $BC \le L$.</p>
<p>For example, $F(15) = 45$ because the triangles $ABC$ with $(BC,AC,AB) = (6,4,5), (12,8,10), (12,9,7), (15,9,16)$ satisfy the conditions.</p>
<p>Find $F(10^9)$.</p> | 2042473533769142717 | Sunday, 4th January 2015, 01:00 am | 361 | 50% | medium |
326 | Modulo Summations | Let $a_n$ be a sequence recursively defined by:$\quad a_1=1,\quad\displaystyle a_n=\biggl(\sum_{k=1}^{n-1}k\cdot a_k\biggr)\bmod n$.
So the first $10$ elements of $a_n$ are: $1,1,0,3,0,3,5,4,1,9$.
Let $f(N, M)$ represent the number of pairs $(p, q)$ such that:
$$
\def\htmltext#1{\style{font-family:inherit;}{\text{#1}}}
1\le p\le q\le N \quad\htmltext{and}\quad\biggl(\sum_{i=p}^qa_i\biggr)\bmod M=0
$$
It can be seen that $f(10,10)=4$ with the pairs $(3,3)$, $(5,5)$, $(7,9)$ and $(9,10)$.
You are also given that $f(10^4,10^3)=97158$.
Find $f(10^{12},10^6)$. | Let $a_n$ be a sequence recursively defined by:$\quad a_1=1,\quad\displaystyle a_n=\biggl(\sum_{k=1}^{n-1}k\cdot a_k\biggr)\bmod n$.
So the first $10$ elements of $a_n$ are: $1,1,0,3,0,3,5,4,1,9$.
Let $f(N, M)$ represent the number of pairs $(p, q)$ such that:
$$
\def\htmltext#1{\style{font-family:inherit;}{\text{#1}}}
1\le p\le q\le N \quad\htmltext{and}\quad\biggl(\sum_{i=p}^qa_i\biggr)\bmod M=0
$$
It can be seen that $f(10,10)=4$ with the pairs $(3,3)$, $(5,5)$, $(7,9)$ and $(9,10)$.
You are also given that $f(10^4,10^3)=97158$.
Find $f(10^{12},10^6)$. | <p>
Let $a_n$ be a sequence recursively defined by:$\quad a_1=1,\quad\displaystyle a_n=\biggl(\sum_{k=1}^{n-1}k\cdot a_k\biggr)\bmod n$.
</p>
<p>
So the first $10$ elements of $a_n$ are: $1,1,0,3,0,3,5,4,1,9$.
</p>
<p>Let $f(N, M)$ represent the number of pairs $(p, q)$ such that: </p>
<p>
$$
\def\htmltext#1{\style{font-family:inherit;}{\text{#1}}}
1\le p\le q\le N \quad\htmltext{and}\quad\biggl(\sum_{i=p}^qa_i\biggr)\bmod M=0
$$
</p>
<p>
It can be seen that $f(10,10)=4$ with the pairs $(3,3)$, $(5,5)$, $(7,9)$ and $(9,10)$.
</p>
<p>
You are also given that $f(10^4,10^3)=97158$.</p>
<p>
Find $f(10^{12},10^6)$.
</p> | 1966666166408794329 | Saturday, 26th February 2011, 04:00 pm | 593 | 55% | medium |
74 | Digit Factorial Chains | The number $145$ is well known for the property that the sum of the factorial of its digits is equal to $145$:
$$1! + 4! + 5! = 1 + 24 + 120 = 145.$$
Perhaps less well known is $169$, in that it produces the longest chain of numbers that link back to $169$; it turns out that there are only three such loops that exist:
\begin{align}
&169 \to 363601 \to 1454 \to 169\\
&871 \to 45361 \to 871\\
&872 \to 45362 \to 872
\end{align}
It is not difficult to prove that EVERY starting number will eventually get stuck in a loop. For example,
\begin{align}
&69 \to 363600 \to 1454 \to 169 \to 363601 (\to 1454)\\
&78 \to 45360 \to 871 \to 45361 (\to 871)\\
&540 \to 145 (\to 145)
\end{align}
Starting with $69$ produces a chain of five non-repeating terms, but the longest non-repeating chain with a starting number below one million is sixty terms.
How many chains, with a starting number below one million, contain exactly sixty non-repeating terms? | The number $145$ is well known for the property that the sum of the factorial of its digits is equal to $145$:
$$1! + 4! + 5! = 1 + 24 + 120 = 145.$$
Perhaps less well known is $169$, in that it produces the longest chain of numbers that link back to $169$; it turns out that there are only three such loops that exist:
\begin{align}
&169 \to 363601 \to 1454 \to 169\\
&871 \to 45361 \to 871\\
&872 \to 45362 \to 872
\end{align}
It is not difficult to prove that EVERY starting number will eventually get stuck in a loop. For example,
\begin{align}
&69 \to 363600 \to 1454 \to 169 \to 363601 (\to 1454)\\
&78 \to 45360 \to 871 \to 45361 (\to 871)\\
&540 \to 145 (\to 145)
\end{align}
Starting with $69$ produces a chain of five non-repeating terms, but the longest non-repeating chain with a starting number below one million is sixty terms.
How many chains, with a starting number below one million, contain exactly sixty non-repeating terms? | <p>The number $145$ is well known for the property that the sum of the factorial of its digits is equal to $145$:
$$1! + 4! + 5! = 1 + 24 + 120 = 145.$$</p>
<p>Perhaps less well known is $169$, in that it produces the longest chain of numbers that link back to $169$; it turns out that there are only three such loops that exist:</p>
\begin{align}
&169 \to 363601 \to 1454 \to 169\\
&871 \to 45361 \to 871\\
&872 \to 45362 \to 872
\end{align}
<p>It is not difficult to prove that EVERY starting number will eventually get stuck in a loop. For example,</p>
\begin{align}
&69 \to 363600 \to 1454 \to 169 \to 363601 (\to 1454)\\
&78 \to 45360 \to 871 \to 45361 (\to 871)\\
&540 \to 145 (\to 145)
\end{align}
<p>Starting with $69$ produces a chain of five non-repeating terms, but the longest non-repeating chain with a starting number below one million is sixty terms.</p>
<p>How many chains, with a starting number below one million, contain exactly sixty non-repeating terms?</p> | 402 | Friday, 16th July 2004, 06:00 pm | 29660 | 15% | easy |
76 | Counting Summations | It is possible to write five as a sum in exactly six different ways:
\begin{align}
&4 + 1\\
&3 + 2\\
&3 + 1 + 1\\
&2 + 2 + 1\\
&2 + 1 + 1 + 1\\
&1 + 1 + 1 + 1 + 1
\end{align}
How many different ways can one hundred be written as a sum of at least two positive integers? | It is possible to write five as a sum in exactly six different ways:
\begin{align}
&4 + 1\\
&3 + 2\\
&3 + 1 + 1\\
&2 + 2 + 1\\
&2 + 1 + 1 + 1\\
&1 + 1 + 1 + 1 + 1
\end{align}
How many different ways can one hundred be written as a sum of at least two positive integers? | <p>It is possible to write five as a sum in exactly six different ways:</p>
\begin{align}
&4 + 1\\
&3 + 2\\
&3 + 1 + 1\\
&2 + 2 + 1\\
&2 + 1 + 1 + 1\\
&1 + 1 + 1 + 1 + 1
\end{align}
<p>How many different ways can one hundred be written as a sum of at least two positive integers?</p> | 190569291 | Friday, 13th August 2004, 06:00 pm | 31588 | 10% | easy |
516 | $5$-smooth Totients | $5$-smooth numbers are numbers whose largest prime factor doesn't exceed $5$.
$5$-smooth numbers are also called Hamming numbers.
Let $S(L)$ be the sum of the numbers $n$ not exceeding $L$ such that Euler's totient function $\phi(n)$ is a Hamming number.
$S(100)=3728$.
Find $S(10^{12})$. Give your answer modulo $2^{32}$. | $5$-smooth numbers are numbers whose largest prime factor doesn't exceed $5$.
$5$-smooth numbers are also called Hamming numbers.
Let $S(L)$ be the sum of the numbers $n$ not exceeding $L$ such that Euler's totient function $\phi(n)$ is a Hamming number.
$S(100)=3728$.
Find $S(10^{12})$. Give your answer modulo $2^{32}$. | <p>
$5$-smooth numbers are numbers whose largest prime factor doesn't exceed $5$.<br/>
$5$-smooth numbers are also called Hamming numbers.<br/>
Let $S(L)$ be the sum of the numbers $n$ not exceeding $L$ such that Euler's totient function $\phi(n)$ is a Hamming number.<br/>
$S(100)=3728$.
</p>
<p>
Find $S(10^{12})$. Give your answer modulo $2^{32}$.
</p> | 939087315 | Sunday, 17th May 2015, 10:00 am | 1715 | 20% | easy |
759 | A Squared Recurrence Relation | The function $f$ is defined for all positive integers as follows:
\begin{align*}
f(1) &= 1\\
f(2n) &= 2f(n)\\
f(2n+1) &= 2n+1 + 2f(n)+\tfrac 1n f(n)
\end{align*}
It can be proven that $f(n)$ is integer for all values of $n$.
The function $S(n)$ is defined as $S(n) = \displaystyle \sum_{i=1}^n f(i) ^2$.
For example, $S(10)=1530$ and $S(10^2)=4798445$.
Find $S(10^{16})$. Give your answer modulo $1\,000\,000\,007$. | The function $f$ is defined for all positive integers as follows:
\begin{align*}
f(1) &= 1\\
f(2n) &= 2f(n)\\
f(2n+1) &= 2n+1 + 2f(n)+\tfrac 1n f(n)
\end{align*}
It can be proven that $f(n)$ is integer for all values of $n$.
The function $S(n)$ is defined as $S(n) = \displaystyle \sum_{i=1}^n f(i) ^2$.
For example, $S(10)=1530$ and $S(10^2)=4798445$.
Find $S(10^{16})$. Give your answer modulo $1\,000\,000\,007$. | <p>The function $f$ is defined for all positive integers as follows:</p>
\begin{align*}
f(1) &= 1\\
f(2n) &= 2f(n)\\
f(2n+1) &= 2n+1 + 2f(n)+\tfrac 1n f(n)
\end{align*}
<p>It can be proven that $f(n)$ is integer for all values of $n$.</p>
<p>The function $S(n)$ is defined as $S(n) = \displaystyle \sum_{i=1}^n f(i) ^2$.</p>
<p>For example, $S(10)=1530$ and $S(10^2)=4798445$.</p>
<p>Find $S(10^{16})$. Give your answer modulo $1\,000\,000\,007$.</p> | 282771304 | Saturday, 12th June 2021, 11:00 pm | 599 | 25% | easy |
889 | Rational Blancmange | Recall the blancmange function from Problem 226: $T(x) = \sum\limits_{n = 0}^\infty\dfrac{s(2^nx)}{2^n}$, where $s(x)$ is the distance from $x$ to the nearest integer.
For positive integers $k, t, r$, we write $$F(k, t, r) = (2^{2k} - 1)T\left(\frac{(2^t + 1)^r}{2^k + 1}\right).$$ It can be shown that $F(k, t, r)$ is always an integer.
For example, $F(3, 1, 1) = 42$, $F(13, 3, 3) = 23093880$ and $F(103, 13, 6) \equiv 878922518\pmod {1\,000\,062\,031}$.
Find $F(10^{18} + 31, 10^{14} + 31, 62)$. Give your answer modulo $1\,000\,062\,031$. | Recall the blancmange function from Problem 226: $T(x) = \sum\limits_{n = 0}^\infty\dfrac{s(2^nx)}{2^n}$, where $s(x)$ is the distance from $x$ to the nearest integer.
For positive integers $k, t, r$, we write $$F(k, t, r) = (2^{2k} - 1)T\left(\frac{(2^t + 1)^r}{2^k + 1}\right).$$ It can be shown that $F(k, t, r)$ is always an integer.
For example, $F(3, 1, 1) = 42$, $F(13, 3, 3) = 23093880$ and $F(103, 13, 6) \equiv 878922518\pmod {1\,000\,062\,031}$.
Find $F(10^{18} + 31, 10^{14} + 31, 62)$. Give your answer modulo $1\,000\,062\,031$. | <p>
Recall the blancmange function from <a href="problem=226">Problem 226</a>: $T(x) = \sum\limits_{n = 0}^\infty\dfrac{s(2^nx)}{2^n}$, where $s(x)$ is the distance from $x$ to the nearest integer.</p>
<p>
For positive integers $k, t, r$, we write $$F(k, t, r) = (2^{2k} - 1)T\left(\frac{(2^t + 1)^r}{2^k + 1}\right).$$ It can be shown that $F(k, t, r)$ is always an integer.<br/>
For example, $F(3, 1, 1) = 42$, $F(13, 3, 3) = 23093880$ and $F(103, 13, 6) \equiv 878922518\pmod {1\,000\,062\,031}$.</p>
<p>
Find $F(10^{18} + 31, 10^{14} + 31, 62)$. Give your answer modulo $1\,000\,062\,031$.</p> | 424315113 | Saturday, 4th May 2024, 11:00 pm | 125 | 70% | hard |
578 | Integers with Decreasing Prime Powers | Any positive integer can be written as a product of prime powers: $p_1^{a_1} \times p_2^{a_2} \times \cdots \times p_k^{a_k}$,
where $p_i$ are distinct prime integers, $a_i \gt 0$ and $p_i \lt p_j$ if $i \lt j$.
A decreasing prime power positive integer is one for which $a_i \ge a_j$ if $i \lt j$.
For example, $1$, $2$, $15=3 \times 5$, $360=2^3 \times 3^2 \times 5$ and $1000=2^3 \times 5^3$ are decreasing prime power integers.
Let $C(n)$ be the count of decreasing prime power positive integers not exceeding $n$.
$C(100) = 94$ since all positive integers not exceeding $100$ have decreasing prime powers except $18$, $50$, $54$, $75$, $90$ and $98$.
You are given $C(10^6) = 922052$.
Find $C(10^{13})$. | Any positive integer can be written as a product of prime powers: $p_1^{a_1} \times p_2^{a_2} \times \cdots \times p_k^{a_k}$,
where $p_i$ are distinct prime integers, $a_i \gt 0$ and $p_i \lt p_j$ if $i \lt j$.
A decreasing prime power positive integer is one for which $a_i \ge a_j$ if $i \lt j$.
For example, $1$, $2$, $15=3 \times 5$, $360=2^3 \times 3^2 \times 5$ and $1000=2^3 \times 5^3$ are decreasing prime power integers.
Let $C(n)$ be the count of decreasing prime power positive integers not exceeding $n$.
$C(100) = 94$ since all positive integers not exceeding $100$ have decreasing prime powers except $18$, $50$, $54$, $75$, $90$ and $98$.
You are given $C(10^6) = 922052$.
Find $C(10^{13})$. | <p>Any positive integer can be written as a product of prime powers: $p_1^{a_1} \times p_2^{a_2} \times \cdots \times p_k^{a_k}$,<br/>
where $p_i$ are distinct prime integers, $a_i \gt 0$ and $p_i \lt p_j$ if $i \lt j$.</p>
<p>A <dfn>decreasing prime power</dfn> positive integer is one for which $a_i \ge a_j$ if $i \lt j$.<br/>
For example, $1$, $2$, $15=3 \times 5$, $360=2^3 \times 3^2 \times 5$ and $1000=2^3 \times 5^3$ are decreasing prime power integers.</p>
<p>Let $C(n)$ be the count of decreasing prime power positive integers not exceeding $n$.<br/>
$C(100) = 94$ since all positive integers not exceeding $100$ have decreasing prime powers except $18$, $50$, $54$, $75$, $90$ and $98$.<br/>
You are given $C(10^6) = 922052$.</p>
<p>Find $C(10^{13})$.</p> | 9219696799346 | Saturday, 19th November 2016, 10:00 pm | 267 | 80% | hard |
861 | Products of Bi-Unitary Divisors | A unitary divisor of a positive integer $n$ is a divisor $d$ of $n$ such that $\gcd\left(d,\frac{n}{d}\right)=1$.
A bi-unitary divisor of $n$ is a divisor $d$ for which $1$ is the only unitary divisor of $d$ that is also a unitary divisor of $\frac{n}{d}$.
For example, $2$ is a bi-unitary divisor of $8$, because the unitary divisors of $2$ are $\{1,2\}$, and the unitary divisors of $8/2$ are $\{1,4\}$, with $1$ being the only unitary divisor in common.
The bi-unitary divisors of $240$ are $\{1,2,3,5,6,8,10,15,16,24,30,40,48,80,120,240\}$.
Let $P(n)$ be the product of all bi-unitary divisors of $n$. Define $Q_k(N)$ as the number of positive integers $1 \lt n \leq N$ such that $P(n)=n^k$. For example, $Q_2\left(10^2\right)=51$ and $Q_6\left(10^6\right)=6189$.
Find $\sum_{k=2}^{10}Q_k\left(10^{12}\right)$. | A unitary divisor of a positive integer $n$ is a divisor $d$ of $n$ such that $\gcd\left(d,\frac{n}{d}\right)=1$.
A bi-unitary divisor of $n$ is a divisor $d$ for which $1$ is the only unitary divisor of $d$ that is also a unitary divisor of $\frac{n}{d}$.
For example, $2$ is a bi-unitary divisor of $8$, because the unitary divisors of $2$ are $\{1,2\}$, and the unitary divisors of $8/2$ are $\{1,4\}$, with $1$ being the only unitary divisor in common.
The bi-unitary divisors of $240$ are $\{1,2,3,5,6,8,10,15,16,24,30,40,48,80,120,240\}$.
Let $P(n)$ be the product of all bi-unitary divisors of $n$. Define $Q_k(N)$ as the number of positive integers $1 \lt n \leq N$ such that $P(n)=n^k$. For example, $Q_2\left(10^2\right)=51$ and $Q_6\left(10^6\right)=6189$.
Find $\sum_{k=2}^{10}Q_k\left(10^{12}\right)$. | <p>A <i>unitary divisor</i> of a positive integer $n$ is a divisor $d$ of $n$ such that $\gcd\left(d,\frac{n}{d}\right)=1$.</p>
<p>A <i>bi-unitary divisor</i> of $n$ is a divisor $d$ for which $1$ is the only unitary divisor of $d$ that is also a unitary divisor of $\frac{n}{d}$.</p>
<p>For example, $2$ is a bi-unitary divisor of $8$, because the unitary divisors of $2$ are $\{1,2\}$, and the unitary divisors of $8/2$ are $\{1,4\}$, with $1$ being the only unitary divisor in common.</p>
<p>The bi-unitary divisors of $240$ are $\{1,2,3,5,6,8,10,15,16,24,30,40,48,80,120,240\}$.</p>
<p>Let $P(n)$ be the product of all bi-unitary divisors of $n$. Define $Q_k(N)$ as the number of positive integers $1 \lt n \leq N$ such that $P(n)=n^k$. For example, $Q_2\left(10^2\right)=51$ and $Q_6\left(10^6\right)=6189$.</p>
<p>Find $\sum_{k=2}^{10}Q_k\left(10^{12}\right)$.</p> | 672623540591 | Saturday, 28th October 2023, 02:00 pm | 217 | 40% | medium |
637 | Flexible Digit Sum | Given any positive integer $n$, we can construct a new integer by inserting plus signs between some of the digits of the base $B$ representation of $n$, and then carrying out the additions.
For example, from $n=123_{10}$ ($n$ in base $10$) we can construct the four base $10$ integers $123_{10}$, $1+23=24_{10}$, $12+3=15_{10}$ and $1+2+3=6_{10}$.
Let $f(n,B)$ be the smallest number of steps needed to arrive at a single-digit number in base $B$. For example, $f(7,10)=0$ and $f(123,10)=1$.
Let $g(n,B_1,B_2)$ be the sum of the positive integers $i$ not exceeding $n$ such that $f(i,B_1)=f(i,B_2)$.
You are given $g(100,10,3)=3302$.
Find $g(10^7,10,3)$. | Given any positive integer $n$, we can construct a new integer by inserting plus signs between some of the digits of the base $B$ representation of $n$, and then carrying out the additions.
For example, from $n=123_{10}$ ($n$ in base $10$) we can construct the four base $10$ integers $123_{10}$, $1+23=24_{10}$, $12+3=15_{10}$ and $1+2+3=6_{10}$.
Let $f(n,B)$ be the smallest number of steps needed to arrive at a single-digit number in base $B$. For example, $f(7,10)=0$ and $f(123,10)=1$.
Let $g(n,B_1,B_2)$ be the sum of the positive integers $i$ not exceeding $n$ such that $f(i,B_1)=f(i,B_2)$.
You are given $g(100,10,3)=3302$.
Find $g(10^7,10,3)$. | <p>
Given any positive integer $n$, we can construct a new integer by inserting plus signs between some of the digits of the base $B$ representation of $n$, and then carrying out the additions.
</p>
<p>
For example, from $n=123_{10}$ ($n$ in base $10$) we can construct the four base $10$ integers $123_{10}$, $1+23=24_{10}$, $12+3=15_{10}$ and $1+2+3=6_{10}$.
</p>
<p>
Let $f(n,B)$ be the smallest number of steps needed to arrive at a single-digit number in base $B$. For example, $f(7,10)=0$ and $f(123,10)=1$.
</p>
<p>
Let $g(n,B_1,B_2)$ be the sum of the positive integers $i$ not exceeding $n$ such that $f(i,B_1)=f(i,B_2)$.
</p>
<p>
You are given $g(100,10,3)=3302$.
</p>
<p>
Find $g(10^7,10,3)$.
</p> | 49000634845039 | Sunday, 23rd September 2018, 01:00 am | 354 | 45% | medium |
284 | Steady Squares | The 3-digit number 376 in the decimal numbering system is an example of numbers with the special property that its square ends with the same digits: 3762 = 141376. Let's call a number with this property a steady square.
Steady squares can also be observed in other numbering systems. In the base 14 numbering system, the 3-digit number c37 is also a steady square: c372 = aa0c37, and the sum of its digits is c+3+7=18 in the same numbering system. The letters a, b, c and d are used for the 10, 11, 12 and 13 digits respectively, in a manner similar to the hexadecimal numbering system.
For 1 ≤ n ≤ 9, the sum of the digits of all the n-digit steady squares in the base 14 numbering system is 2d8 (582 decimal). Steady squares with leading 0's are not allowed.
Find the sum of the digits of all the n-digit steady squares in the base 14 numbering system for
1 ≤ n ≤ 10000 (decimal) and give your answer in the base 14 system using lower case letters where necessary. | The 3-digit number 376 in the decimal numbering system is an example of numbers with the special property that its square ends with the same digits: 3762 = 141376. Let's call a number with this property a steady square.
Steady squares can also be observed in other numbering systems. In the base 14 numbering system, the 3-digit number c37 is also a steady square: c372 = aa0c37, and the sum of its digits is c+3+7=18 in the same numbering system. The letters a, b, c and d are used for the 10, 11, 12 and 13 digits respectively, in a manner similar to the hexadecimal numbering system.
For 1 ≤ n ≤ 9, the sum of the digits of all the n-digit steady squares in the base 14 numbering system is 2d8 (582 decimal). Steady squares with leading 0's are not allowed.
Find the sum of the digits of all the n-digit steady squares in the base 14 numbering system for
1 ≤ n ≤ 10000 (decimal) and give your answer in the base 14 system using lower case letters where necessary. | <p>The 3-digit number 376 in the decimal numbering system is an example of numbers with the special property that its square ends with the same digits: 376<sup>2</sup> = 141376. Let's call a number with this property a steady square.</p>
<p>Steady squares can also be observed in other numbering systems. In the base 14 numbering system, the 3-digit number c37 is also a steady square: c37<sup>2</sup> = aa0c37, and the sum of its digits is c+3+7=18 in the same numbering system. The letters a, b, c and d are used for the 10, 11, 12 and 13 digits respectively, in a manner similar to the hexadecimal numbering system.</p>
<p>For 1 ≤ n ≤ 9, the sum of the digits of all the n-digit steady squares in the base 14 numbering system is 2d8 (582 decimal). Steady squares with leading 0's are not allowed.</p>
<p>Find the sum of the digits of all the n-digit steady squares in the base 14 numbering system for<br>
1 ≤ n ≤ 10000 (decimal) and give your answer in the base 14 system using lower case letters where necessary.</br></p> | 5a411d7b | Saturday, 27th March 2010, 01:00 am | 1397 | 55% | medium |
575 | Wandering Robots | It was quite an ordinary day when a mysterious alien vessel appeared as if from nowhere. After waiting several hours and receiving no response it is decided to send a team to investigate, of which you are included. Upon entering the vessel you are met by a friendly holographic figure, Katharina, who explains the purpose of the vessel, Eulertopia.
She claims that Eulertopia is almost older than time itself. Its mission was to take advantage of a combination of incredible computational power and vast periods of time to discover the answer to life, the universe, and everything. Hence the resident cleaning robot, Leonhard, along with his housekeeping responsibilities, was built with a powerful computational matrix to ponder the meaning of life as he wanders through a massive 1000 by 1000 square grid of rooms. She goes on to explain that the rooms are numbered sequentially from left to right, row by row. So, for example, if Leonhard was wandering around a 5 by 5 grid then the rooms would be numbered in the following way.
Many millenia ago Leonhard reported to Katharina to have found the answer and he is willing to share it with any life form who proves to be worthy of such knowledge.
Katharina further explains that the designers of Leonhard were given instructions to program him with equal probability of remaining in the same room or travelling to an adjacent room. However, it was not clear to them if this meant (i) an equal probability being split equally between remaining in the room and the number of available routes, or, (ii) an equal probability (50%) of remaining in the same room and then the other 50% was to be split equally between the number of available routes.
(i) Probability of remaining related to number of exits
(ii) Fixed 50% probability of remaining
The records indicate that they decided to flip a coin. Heads would mean that the probability of remaining was dynamically related to the number of exits whereas tails would mean that they program Leonhard with a fixed 50% probability of remaining in a particular room. Unfortunately there is no record of the outcome of the coin, so without further information we would need to assume that there is equal probability of either of the choices being implemented.
Katharina suggests it should not be too challenging to determine that the probability of finding him in a square numbered room in a 5 by 5 grid after unfathomable periods of time would be approximately 0.177976190476 [12 d.p.].
In order to prove yourself worthy of visiting the great oracle you must calculate the probability of finding him in a square numbered room in the 1000 by 1000 lair in which he has been wandering.
(Give your answer rounded to 12 decimal places) | It was quite an ordinary day when a mysterious alien vessel appeared as if from nowhere. After waiting several hours and receiving no response it is decided to send a team to investigate, of which you are included. Upon entering the vessel you are met by a friendly holographic figure, Katharina, who explains the purpose of the vessel, Eulertopia.
She claims that Eulertopia is almost older than time itself. Its mission was to take advantage of a combination of incredible computational power and vast periods of time to discover the answer to life, the universe, and everything. Hence the resident cleaning robot, Leonhard, along with his housekeeping responsibilities, was built with a powerful computational matrix to ponder the meaning of life as he wanders through a massive 1000 by 1000 square grid of rooms. She goes on to explain that the rooms are numbered sequentially from left to right, row by row. So, for example, if Leonhard was wandering around a 5 by 5 grid then the rooms would be numbered in the following way.
Many millenia ago Leonhard reported to Katharina to have found the answer and he is willing to share it with any life form who proves to be worthy of such knowledge.
Katharina further explains that the designers of Leonhard were given instructions to program him with equal probability of remaining in the same room or travelling to an adjacent room. However, it was not clear to them if this meant (i) an equal probability being split equally between remaining in the room and the number of available routes, or, (ii) an equal probability (50%) of remaining in the same room and then the other 50% was to be split equally between the number of available routes.
(i) Probability of remaining related to number of exits
(ii) Fixed 50% probability of remaining
The records indicate that they decided to flip a coin. Heads would mean that the probability of remaining was dynamically related to the number of exits whereas tails would mean that they program Leonhard with a fixed 50% probability of remaining in a particular room. Unfortunately there is no record of the outcome of the coin, so without further information we would need to assume that there is equal probability of either of the choices being implemented.
Katharina suggests it should not be too challenging to determine that the probability of finding him in a square numbered room in a 5 by 5 grid after unfathomable periods of time would be approximately 0.177976190476 [12 d.p.].
In order to prove yourself worthy of visiting the great oracle you must calculate the probability of finding him in a square numbered room in the 1000 by 1000 lair in which he has been wandering.
(Give your answer rounded to 12 decimal places) | <p>It was quite an ordinary day when a mysterious alien vessel appeared as if from nowhere. After waiting several hours and receiving no response it is decided to send a team to investigate, of which you are included. Upon entering the vessel you are met by a friendly holographic figure, Katharina, who explains the purpose of the vessel, Eulertopia.</p>
<p>She claims that Eulertopia is almost older than time itself. Its mission was to take advantage of a combination of incredible computational power and vast periods of time to discover the answer to life, the universe, and everything. Hence the resident cleaning robot, Leonhard, along with his housekeeping responsibilities, was built with a powerful computational matrix to ponder the meaning of life as he wanders through a massive 1000 by 1000 square grid of rooms. She goes on to explain that the rooms are numbered sequentially from left to right, row by row. So, for example, if Leonhard was wandering around a 5 by 5 grid then the rooms would be numbered in the following way.</p>
<div class="center">
<img alt="p575_wandering_robot_1_5x5.png" src="project/images/p575_wandering_robot_1_5x5.png"/></div>
<p>Many millenia ago Leonhard reported to Katharina to have found the answer and he is willing to share it with any life form who proves to be worthy of such knowledge.</p>
<p>Katharina further explains that the designers of Leonhard were given instructions to program him with equal probability of remaining in the same room or travelling to an adjacent room. However, it was not clear to them if this meant (i) an equal probability being split equally between remaining in the room and the number of available routes, or, (ii) an equal probability (50%) of remaining in the same room and then the other 50% was to be split equally between the number of available routes.</p>
<div class="center">
<img alt="p575_wandering_robot_2_fixed.png" src="project/images/p575_wandering_robot_2_fixed.png"><br><div style="font-style:italic;">(i) Probability of remaining related to number of exits</div>
<br/><img alt="p575_wandering_robot_3_dynamic.png" src="project/images/p575_wandering_robot_3_dynamic.png"><br/><div style="font-style:italic;">(ii) Fixed 50% probability of remaining</div>
</img></br></img></div>
<p>The records indicate that they decided to flip a coin. Heads would mean that the probability of remaining was dynamically related to the number of exits whereas tails would mean that they program Leonhard with a fixed 50% probability of remaining in a particular room. Unfortunately there is no record of the outcome of the coin, so without further information we would need to assume that there is equal probability of either of the choices being implemented.</p>
<p>Katharina suggests it should not be too challenging to determine that the probability of finding him in a square numbered room in a 5 by 5 grid after unfathomable periods of time would be approximately 0.177976190476 [12 d.p.].</p>
<p>In order to prove yourself worthy of visiting the great oracle you must calculate the probability of finding him in a square numbered room in the 1000 by 1000 lair in which he has been wandering.<br/>
(Give your answer rounded to 12 decimal places)</p> | 0.000989640561 | Saturday, 22nd October 2016, 01:00 pm | 645 | 35% | medium |
457 | A Polynomial Modulo the Square of a Prime | Let $f(n) = n^2 - 3n - 1$.
Let $p$ be a prime.
Let $R(p)$ be the smallest positive integer $n$ such that $f(n) \bmod p^2 = 0$ if such an integer $n$ exists, otherwise $R(p) = 0$.
Let $SR(L)$ be $\sum R(p)$ for all primes not exceeding $L$.
Find $SR(10^7)$. | Let $f(n) = n^2 - 3n - 1$.
Let $p$ be a prime.
Let $R(p)$ be the smallest positive integer $n$ such that $f(n) \bmod p^2 = 0$ if such an integer $n$ exists, otherwise $R(p) = 0$.
Let $SR(L)$ be $\sum R(p)$ for all primes not exceeding $L$.
Find $SR(10^7)$. | <p>
Let $f(n) = n^2 - 3n - 1$.<br/>
Let $p$ be a prime.<br/>
Let $R(p)$ be the smallest positive integer $n$ such that $f(n) \bmod p^2 = 0$ if such an integer $n$ exists, otherwise $R(p) = 0$.
</p>
<p>
Let $SR(L)$ be $\sum R(p)$ for all primes not exceeding $L$.
</p>
<p>
Find $SR(10^7)$.
</p> | 2647787126797397063 | Sunday, 2nd February 2014, 04:00 am | 903 | 35% | medium |
747 | Triangular Pizza | Mamma Triangolo baked a triangular pizza. She wants to cut the pizza into $n$ pieces. She first chooses a point $P$ in the interior (not boundary) of the triangle pizza, and then performs $n$ cuts, which all start from $P$ and extend straight to the boundary of the pizza so that the $n$ pieces are all triangles and all have the same area.
Let $\psi(n)$ be the number of different ways for Mamma Triangolo to cut the pizza, subject to the constraints.
For example, $\psi(3)=7$.
Also $\psi(6)=34$, and $\psi(10)=90$.
Let $\Psi(m)=\displaystyle\sum_{n=3}^m \psi(n)$. You are given $\Psi(10)=345$ and $\Psi(1000)=172166601$.
Find $\Psi(10^8)$. Give your answer modulo $1\,000\,000\,007$. | Mamma Triangolo baked a triangular pizza. She wants to cut the pizza into $n$ pieces. She first chooses a point $P$ in the interior (not boundary) of the triangle pizza, and then performs $n$ cuts, which all start from $P$ and extend straight to the boundary of the pizza so that the $n$ pieces are all triangles and all have the same area.
Let $\psi(n)$ be the number of different ways for Mamma Triangolo to cut the pizza, subject to the constraints.
For example, $\psi(3)=7$.
Also $\psi(6)=34$, and $\psi(10)=90$.
Let $\Psi(m)=\displaystyle\sum_{n=3}^m \psi(n)$. You are given $\Psi(10)=345$ and $\Psi(1000)=172166601$.
Find $\Psi(10^8)$. Give your answer modulo $1\,000\,000\,007$. | <p>Mamma Triangolo baked a triangular pizza. She wants to cut the pizza into $n$ pieces. She first chooses a point $P$ in the interior (not boundary) of the triangle pizza, and then performs $n$ cuts, which all start from $P$ and extend straight to the boundary of the pizza so that the $n$ pieces are all triangles and all have the same area.</p>
<p>Let $\psi(n)$ be the number of different ways for Mamma Triangolo to cut the pizza, subject to the constraints.<br>
For example, $\psi(3)=7$.</br></p>
<div style="text-align:center;">
<img alt="" class="dark_img" src="project/images/p747_PizzaDiag.jpg"/></div>
<p>Also $\psi(6)=34$, and $\psi(10)=90$.</p>
<p>Let $\Psi(m)=\displaystyle\sum_{n=3}^m \psi(n)$. You are given $\Psi(10)=345$ and $\Psi(1000)=172166601$.</p>
<p>Find $\Psi(10^8)$. Give your answer modulo $1\,000\,000\,007$.</p> | 681813395 | Sunday, 14th February 2021, 10:00 am | 210 | 60% | hard |
467 | Superinteger | An integer $s$ is called a superinteger of another integer $n$ if the digits of $n$ form a subsequenceA subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements. of the digits of $s$.
For example, $2718281828$ is a superinteger of $18828$, while $314159$ is not a superinteger of $151$.
Let $p(n)$ be the $n$th prime number, and let $c(n)$ be the $n$th composite number. For example, $p(1) = 2$, $p(10) = 29$, $c(1)$ = 4 and $c(10) = 18$.
$\{p(i) : i \ge 1\} = \{2, 3, 5, 7, 11, 13, 17, 19, 23, 29, \dots\}$
$\{c(i) : i \ge 1\} = \{4, 6, 8, 9, 10, 12, 14, 15, 16, 18, \dots\}$
Let $P^D$ be the sequence of the digital roots of $\{p(i)\}$ ($C^D$ is defined similarly for $\{c(i)\}$):
$P^D = \{2, 3, 5, 7, 2, 4, 8, 1, 5, 2, \dots\}$
$C^D = \{4, 6, 8, 9, 1, 3, 5, 6, 7, 9, \dots\}$
Let $P_n$ be the integer formed by concatenating the first $n$ elements of $P^D$ ($C_n$ is defined similarly for $C^D$).
$P_{10} = 2357248152$
$C_{10} = 4689135679$
Let $f(n)$ be the smallest positive integer that is a common superinteger of $P_n$ and $C_n$. For example, $f(10) = 2357246891352679$, and $f(100) \bmod 1\,000\,000\,007 = 771661825$.
Find $f(10\,000) \bmod 1\,000\,000\,007$. | An integer $s$ is called a superinteger of another integer $n$ if the digits of $n$ form a subsequenceA subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements. of the digits of $s$.
For example, $2718281828$ is a superinteger of $18828$, while $314159$ is not a superinteger of $151$.
Let $p(n)$ be the $n$th prime number, and let $c(n)$ be the $n$th composite number. For example, $p(1) = 2$, $p(10) = 29$, $c(1)$ = 4 and $c(10) = 18$.
$\{p(i) : i \ge 1\} = \{2, 3, 5, 7, 11, 13, 17, 19, 23, 29, \dots\}$
$\{c(i) : i \ge 1\} = \{4, 6, 8, 9, 10, 12, 14, 15, 16, 18, \dots\}$
Let $P^D$ be the sequence of the digital roots of $\{p(i)\}$ ($C^D$ is defined similarly for $\{c(i)\}$):
$P^D = \{2, 3, 5, 7, 2, 4, 8, 1, 5, 2, \dots\}$
$C^D = \{4, 6, 8, 9, 1, 3, 5, 6, 7, 9, \dots\}$
Let $P_n$ be the integer formed by concatenating the first $n$ elements of $P^D$ ($C_n$ is defined similarly for $C^D$).
$P_{10} = 2357248152$
$C_{10} = 4689135679$
Let $f(n)$ be the smallest positive integer that is a common superinteger of $P_n$ and $C_n$. For example, $f(10) = 2357246891352679$, and $f(100) \bmod 1\,000\,000\,007 = 771661825$.
Find $f(10\,000) \bmod 1\,000\,000\,007$. | <p>An integer $s$ is called a <dfn>superinteger</dfn> of another integer $n$ if the digits of $n$ form a <strong class="tooltip">subsequence<span class="tooltiptext">A subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements.</span></strong> of the digits of $s$.<br/>
For example, $2718281828$ is a superinteger of $18828$, while $314159$ is not a superinteger of $151$.
</p>
<p>Let $p(n)$ be the $n$th prime number, and let $c(n)$ be the $n$th composite number. For example, $p(1) = 2$, $p(10) = 29$, $c(1)$ = 4 and $c(10) = 18$.<br/>
$\{p(i) : i \ge 1\} = \{2, 3, 5, 7, 11, 13, 17, 19, 23, 29, \dots\}$<br/>
$\{c(i) : i \ge 1\} = \{4, 6, 8, 9, 10, 12, 14, 15, 16, 18, \dots\}$</p>
<p>Let $P^D$ be the sequence of the <strong>digital roots</strong> of $\{p(i)\}$ ($C^D$ is defined similarly for $\{c(i)\}$):<br/>
$P^D = \{2, 3, 5, 7, 2, 4, 8, 1, 5, 2, \dots\}$<br/>
$C^D = \{4, 6, 8, 9, 1, 3, 5, 6, 7, 9, \dots\}$</p>
<p>Let $P_n$ be the integer formed by concatenating the first $n$ elements of $P^D$ ($C_n$ is defined similarly for $C^D$).<br/>
$P_{10} = 2357248152$<br/>
$C_{10} = 4689135679$</p>
<p>Let $f(n)$ be the smallest positive integer that is a common superinteger of $P_n$ and $C_n$. <br/>For example, $f(10) = 2357246891352679$, and $f(100) \bmod 1\,000\,000\,007 = 771661825$.</p>
<p>Find $f(10\,000) \bmod 1\,000\,000\,007$.</p> | 775181359 | Sunday, 13th April 2014, 10:00 am | 491 | 50% | medium |
892 | Zebra Circles | Consider a circle where $2n$ distinct points have been marked on its circumference.
A cutting $C$ consists of connecting the $2n$ points with $n$ line segments, so that no two line segments intersect, including on their end points. The $n$ line segments then cut the circle into $n + 1$ pieces.
Each piece is painted either black or white, so that adjacent pieces are opposite colours.
Let $d(C)$ be the absolute difference between the numbers of black and white pieces under the cutting $C$.
Let $D(n)$ be the sum of $d(C)$ over all different cuttings $C$.
For example, there are five different cuttings with $n = 3$.
The upper three cuttings all have $d = 0$ because there are two black and two white pieces; the lower two cuttings both have $d = 2$ because there are three black and one white pieces.
Therefore $D(3) = 0 + 0 + 0 + 2 + 2 = 4$.
You are also given $D(100) \equiv 1172122931\pmod{1234567891}$.
Find $\displaystyle \sum_{n=1}^{10^7} D(n)$. Give your answer modulo $1234567891$. | Consider a circle where $2n$ distinct points have been marked on its circumference.
A cutting $C$ consists of connecting the $2n$ points with $n$ line segments, so that no two line segments intersect, including on their end points. The $n$ line segments then cut the circle into $n + 1$ pieces.
Each piece is painted either black or white, so that adjacent pieces are opposite colours.
Let $d(C)$ be the absolute difference between the numbers of black and white pieces under the cutting $C$.
Let $D(n)$ be the sum of $d(C)$ over all different cuttings $C$.
For example, there are five different cuttings with $n = 3$.
The upper three cuttings all have $d = 0$ because there are two black and two white pieces; the lower two cuttings both have $d = 2$ because there are three black and one white pieces.
Therefore $D(3) = 0 + 0 + 0 + 2 + 2 = 4$.
You are also given $D(100) \equiv 1172122931\pmod{1234567891}$.
Find $\displaystyle \sum_{n=1}^{10^7} D(n)$. Give your answer modulo $1234567891$. | <p>
Consider a circle where $2n$ distinct points have been marked on its circumference.</p>
<p>
A <i>cutting</i> $C$ consists of connecting the $2n$ points with $n$ line segments, so that no two line segments intersect, including on their end points. The $n$ line segments then cut the circle into $n + 1$ pieces.
Each piece is painted either black or white, so that adjacent pieces are opposite colours.
Let $d(C)$ be the absolute difference between the numbers of black and white pieces under the cutting $C$.</p>
<p>
Let $D(n)$ be the sum of $d(C)$ over all different cuttings $C$.
For example, there are five different cuttings with $n = 3$.</p>
<div style="text-align:center;">
<img alt="0892_Zebra.png" src="resources/images/0892_Zebra.png?1714876283"/></div>
<p>
The upper three cuttings all have $d = 0$ because there are two black and two white pieces; the lower two cuttings both have $d = 2$ because there are three black and one white pieces.
Therefore $D(3) = 0 + 0 + 0 + 2 + 2 = 4$.
You are also given $D(100) \equiv 1172122931\pmod{1234567891}$.</p>
<p>
Find $\displaystyle \sum_{n=1}^{10^7} D(n)$. Give your answer modulo $1234567891$.</p> | 469137427 | Sunday, 26th May 2024, 08:00 am | 154 | 60% | hard |
662 | Fibonacci Paths | Alice walks on a lattice grid. She can step from one lattice point $A (a,b)$ to another $B (a+x,b+y)$ providing distance $AB = \sqrt{x^2+y^2}$ is a Fibonacci number $\{1,2,3,5,8,13,\ldots\}$ and $x\ge 0,$ $y\ge 0$.
In the lattice grid below Alice can step from the blue point to any of the red points.
Let $F(W,H)$ be the number of paths Alice can take from $(0,0)$ to $(W,H)$.
You are given $F(3,4) = 278$ and $F(10,10) = 215846462$.
Find $F(10\,000,10\,000) \bmod 1\,000\,000\,007$. | Alice walks on a lattice grid. She can step from one lattice point $A (a,b)$ to another $B (a+x,b+y)$ providing distance $AB = \sqrt{x^2+y^2}$ is a Fibonacci number $\{1,2,3,5,8,13,\ldots\}$ and $x\ge 0,$ $y\ge 0$.
In the lattice grid below Alice can step from the blue point to any of the red points.
Let $F(W,H)$ be the number of paths Alice can take from $(0,0)$ to $(W,H)$.
You are given $F(3,4) = 278$ and $F(10,10) = 215846462$.
Find $F(10\,000,10\,000) \bmod 1\,000\,000\,007$. | <p>
Alice walks on a lattice grid. She can step from one lattice point $A (a,b)$ to another $B (a+x,b+y)$ providing distance $AB = \sqrt{x^2+y^2}$ is a Fibonacci number $\{1,2,3,5,8,13,\ldots\}$ and $x\ge 0,$ $y\ge 0$.
</p>
<p>
In the lattice grid below Alice can step from the blue point to any of the red points.<br/></p>
<p align="center"><img alt="p662_fibonacciwalks.png" src="project/images/p662_fibonacciwalks.png"/></p>
<p>
Let $F(W,H)$ be the number of paths Alice can take from $(0,0)$ to $(W,H)$.<br/>
You are given $F(3,4) = 278$ and $F(10,10) = 215846462$.
</p>
<p>
Find $F(10\,000,10\,000) \bmod 1\,000\,000\,007$.</p> | 860873428 | Sunday, 24th March 2019, 01:00 am | 895 | 25% | easy |
28 | Number Spiral Diagonals | Starting with the number $1$ and moving to the right in a clockwise direction a $5$ by $5$ spiral is formed as follows:
21 22 23 24 25
20 7 8 9 10
19 6 1 2 11
18 5 4 3 1217 16 15 14 13
It can be verified that the sum of the numbers on the diagonals is $101$.
What is the sum of the numbers on the diagonals in a $1001$ by $1001$ spiral formed in the same way? | Starting with the number $1$ and moving to the right in a clockwise direction a $5$ by $5$ spiral is formed as follows:
21 22 23 24 25
20 7 8 9 10
19 6 1 2 11
18 5 4 3 1217 16 15 14 13
It can be verified that the sum of the numbers on the diagonals is $101$.
What is the sum of the numbers on the diagonals in a $1001$ by $1001$ spiral formed in the same way? | <p>Starting with the number $1$ and moving to the right in a clockwise direction a $5$ by $5$ spiral is formed as follows:</p>
<p class="monospace center"><span class="red"><b>21</b></span> 22 23 24 <span class="red"><b>25</b></span><br/>
20 <span class="red"><b>7</b></span> 8 <span class="red"><b>9</b></span> 10<br/>
19 6 <span class="red"><b>1</b></span> 2 11<br/>
18 <span class="red"><b>5</b></span> 4 <span class="red"><b>3</b></span> 12<br/><span class="red"><b>17</b></span> 16 15 14 <span class="red"><b>13</b></span></p>
<p>It can be verified that the sum of the numbers on the diagonals is $101$.</p>
<p>What is the sum of the numbers on the diagonals in a $1001$ by $1001$ spiral formed in the same way?</p> | 669171001 | Friday, 11th October 2002, 06:00 pm | 116784 | 5% | easy |
250 | $250250$ | Find the number of non-empty subsets of $\{1^1, 2^2, 3^3,\dots, 250250^{250250}\}$, the sum of whose elements is divisible by $250$. Enter the rightmost $16$ digits as your answer. | Find the number of non-empty subsets of $\{1^1, 2^2, 3^3,\dots, 250250^{250250}\}$, the sum of whose elements is divisible by $250$. Enter the rightmost $16$ digits as your answer. | <p>Find the number of non-empty subsets of $\{1^1, 2^2, 3^3,\dots, 250250^{250250}\}$, the sum of whose elements is divisible by $250$. Enter the rightmost $16$ digits as your answer.</p> | 1425480602091519 | Saturday, 13th June 2009, 05:00 am | 3325 | 55% | medium |
293 | Pseudo-Fortunate Numbers | An even positive integer $N$ will be called admissible, if it is a power of $2$ or its distinct prime factors are consecutive primes.
The first twelve admissible numbers are $2,4,6,8,12,16,18,24,30,32,36,48$.
If $N$ is admissible, the smallest integer $M \gt 1$ such that $N+M$ is prime, will be called the pseudo-Fortunate number for $N$.
For example, $N=630$ is admissible since it is even and its distinct prime factors are the consecutive primes $2,3,5$ and $7$.
The next prime number after $631$ is $641$; hence, the pseudo-Fortunate number for $630$ is $M=11$.
It can also be seen that the pseudo-Fortunate number for $16$ is $3$.
Find the sum of all distinct pseudo-Fortunate numbers for admissible numbers $N$ less than $10^9$. | An even positive integer $N$ will be called admissible, if it is a power of $2$ or its distinct prime factors are consecutive primes.
The first twelve admissible numbers are $2,4,6,8,12,16,18,24,30,32,36,48$.
If $N$ is admissible, the smallest integer $M \gt 1$ such that $N+M$ is prime, will be called the pseudo-Fortunate number for $N$.
For example, $N=630$ is admissible since it is even and its distinct prime factors are the consecutive primes $2,3,5$ and $7$.
The next prime number after $631$ is $641$; hence, the pseudo-Fortunate number for $630$ is $M=11$.
It can also be seen that the pseudo-Fortunate number for $16$ is $3$.
Find the sum of all distinct pseudo-Fortunate numbers for admissible numbers $N$ less than $10^9$. | <p>
An even positive integer $N$ will be called admissible, if it is a power of $2$ or its distinct prime factors are consecutive primes.<br/>
The first twelve admissible numbers are $2,4,6,8,12,16,18,24,30,32,36,48$.
</p>
<p>
If $N$ is admissible, the smallest integer $M \gt 1$ such that $N+M$ is prime, will be called the pseudo-Fortunate number for $N$.
</p>
<p>
For example, $N=630$ is admissible since it is even and its distinct prime factors are the consecutive primes $2,3,5$ and $7$.<br/>
The next prime number after $631$ is $641$; hence, the pseudo-Fortunate number for $630$ is $M=11$.<br/>
It can also be seen that the pseudo-Fortunate number for $16$ is $3$.
</p>
<p>
Find the sum of all distinct pseudo-Fortunate numbers for admissible numbers $N$ less than $10^9$.
</p> | 2209 | Saturday, 22nd May 2010, 05:00 am | 3264 | 30% | easy |
478 | Mixtures | Let us consider mixtures of three substances: A, B and C. A mixture can be described by a ratio of the amounts of A, B, and C in it, i.e., $(a : b : c)$. For example, a mixture described by the ratio $(2 : 3 : 5)$ contains $20\%$ A, $30\%$ B and $50\%$ C.
For the purposes of this problem, we cannot separate the individual components from a mixture. However, we can combine different amounts of different mixtures to form mixtures with new ratios.
For example, say we have three mixtures with ratios $(3 : 0 : 2)$, $(3: 6 : 11)$ and $(3 : 3 : 4)$. By mixing $10$ units of the first, $20$ units of the second and $30$ units of the third, we get a new mixture with ratio $(6 : 5 : 9)$, since:
$(10 \cdot \tfrac 3 5$ + $20 \cdot \tfrac 3 {20} + 30 \cdot \tfrac 3 {10} : 10 \cdot \tfrac 0 5 + 20 \cdot \tfrac 6 {20} + 30 \cdot \tfrac 3 {10} : 10 \cdot \tfrac 2 5 + 20 \cdot \tfrac {11} {20} + 30 \cdot \tfrac 4 {10})
= (18 : 15 : 27) = (6 : 5 : 9)$
However, with the same three mixtures, it is impossible to form the ratio $(3 : 2 : 1)$, since the amount of B is always less than the amount of C.
Let $n$ be a positive integer. Suppose that for every triple of integers $(a, b, c)$ with $0 \le a, b, c \le n$ and $\gcd(a, b, c) = 1$, we have a mixture with ratio $(a : b : c)$. Let $M(n)$ be the set of all such mixtures.
For example, $M(2)$ contains the $19$ mixtures with the following ratios:
\begin{align}
\{&(0 : 0 : 1), (0 : 1 : 0), (0 : 1 : 1), (0 : 1 : 2), (0 : 2 : 1),\\
&(1 : 0 : 0), (1 : 0 : 1), (1 : 0 : 2), (1 : 1 : 0), (1 : 1 : 1),\\
&(1 : 1 : 2), (1 : 2 : 0), (1 : 2 : 1), (1 : 2 : 2), (2 : 0 : 1),\\
&(2 : 1 : 0), (2 : 1 : 1), (2 : 1 : 2), (2 : 2 : 1)\}.
\end{align}
Let $E(n)$ be the number of subsets of $M(n)$ which can produce the mixture with ratio $(1 : 1 : 1)$, i.e., the mixture with equal parts A, B and C.
We can verify that $E(1) = 103$, $E(2) = 520447$, $E(10) \bmod 11^8 = 82608406$ and $E(500) \bmod 11^8 = 13801403$.
Find $E(10\,000\,000) \bmod 11^8$. | Let us consider mixtures of three substances: A, B and C. A mixture can be described by a ratio of the amounts of A, B, and C in it, i.e., $(a : b : c)$. For example, a mixture described by the ratio $(2 : 3 : 5)$ contains $20\%$ A, $30\%$ B and $50\%$ C.
For the purposes of this problem, we cannot separate the individual components from a mixture. However, we can combine different amounts of different mixtures to form mixtures with new ratios.
For example, say we have three mixtures with ratios $(3 : 0 : 2)$, $(3: 6 : 11)$ and $(3 : 3 : 4)$. By mixing $10$ units of the first, $20$ units of the second and $30$ units of the third, we get a new mixture with ratio $(6 : 5 : 9)$, since:
$(10 \cdot \tfrac 3 5$ + $20 \cdot \tfrac 3 {20} + 30 \cdot \tfrac 3 {10} : 10 \cdot \tfrac 0 5 + 20 \cdot \tfrac 6 {20} + 30 \cdot \tfrac 3 {10} : 10 \cdot \tfrac 2 5 + 20 \cdot \tfrac {11} {20} + 30 \cdot \tfrac 4 {10})
= (18 : 15 : 27) = (6 : 5 : 9)$
However, with the same three mixtures, it is impossible to form the ratio $(3 : 2 : 1)$, since the amount of B is always less than the amount of C.
Let $n$ be a positive integer. Suppose that for every triple of integers $(a, b, c)$ with $0 \le a, b, c \le n$ and $\gcd(a, b, c) = 1$, we have a mixture with ratio $(a : b : c)$. Let $M(n)$ be the set of all such mixtures.
For example, $M(2)$ contains the $19$ mixtures with the following ratios:
\begin{align}
\{&(0 : 0 : 1), (0 : 1 : 0), (0 : 1 : 1), (0 : 1 : 2), (0 : 2 : 1),\\
&(1 : 0 : 0), (1 : 0 : 1), (1 : 0 : 2), (1 : 1 : 0), (1 : 1 : 1),\\
&(1 : 1 : 2), (1 : 2 : 0), (1 : 2 : 1), (1 : 2 : 2), (2 : 0 : 1),\\
&(2 : 1 : 0), (2 : 1 : 1), (2 : 1 : 2), (2 : 2 : 1)\}.
\end{align}
Let $E(n)$ be the number of subsets of $M(n)$ which can produce the mixture with ratio $(1 : 1 : 1)$, i.e., the mixture with equal parts A, B and C.
We can verify that $E(1) = 103$, $E(2) = 520447$, $E(10) \bmod 11^8 = 82608406$ and $E(500) \bmod 11^8 = 13801403$.
Find $E(10\,000\,000) \bmod 11^8$. | <p>Let us consider <b>mixtures</b> of three substances: <b>A</b>, <b>B</b> and <b>C</b>. A mixture can be described by a ratio of the amounts of <b>A</b>, <b>B</b>, and <b>C</b> in it, i.e., $(a : b : c)$. For example, a mixture described by the ratio $(2 : 3 : 5)$ contains $20\%$ <b>A</b>, $30\%$ <b>B</b> and $50\%$ <b>C</b>.</p>
<p>For the purposes of this problem, we cannot separate the individual components from a mixture. However, we can combine different amounts of different mixtures to form mixtures with new ratios.</p>
<p>For example, say we have three mixtures with ratios $(3 : 0 : 2)$, $(3: 6 : 11)$ and $(3 : 3 : 4)$. By mixing $10$ units of the first, $20$ units of the second and $30$ units of the third, we get a new mixture with ratio $(6 : 5 : 9)$, since:<br/>
$(10 \cdot \tfrac 3 5$ + $20 \cdot \tfrac 3 {20} + 30 \cdot \tfrac 3 {10} : 10 \cdot \tfrac 0 5 + 20 \cdot \tfrac 6 {20} + 30 \cdot \tfrac 3 {10} : 10 \cdot \tfrac 2 5 + 20 \cdot \tfrac {11} {20} + 30 \cdot \tfrac 4 {10})
= (18 : 15 : 27) = (6 : 5 : 9)$
</p>
<p>However, with the same three mixtures, it is impossible to form the ratio $(3 : 2 : 1)$, since the amount of <b>B</b> is always less than the amount of <b>C</b>.</p>
<p>Let $n$ be a positive integer. Suppose that for every triple of integers $(a, b, c)$ with $0 \le a, b, c \le n$ and $\gcd(a, b, c) = 1$, we have a mixture with ratio $(a : b : c)$. Let $M(n)$ be the set of all such mixtures.</p>
<p>For example, $M(2)$ contains the $19$ mixtures with the following ratios:</p>
\begin{align}
\{&(0 : 0 : 1), (0 : 1 : 0), (0 : 1 : 1), (0 : 1 : 2), (0 : 2 : 1),\\
&(1 : 0 : 0), (1 : 0 : 1), (1 : 0 : 2), (1 : 1 : 0), (1 : 1 : 1),\\
&(1 : 1 : 2), (1 : 2 : 0), (1 : 2 : 1), (1 : 2 : 2), (2 : 0 : 1),\\
&(2 : 1 : 0), (2 : 1 : 1), (2 : 1 : 2), (2 : 2 : 1)\}.
\end{align}
<p>Let $E(n)$ be the number of subsets of $M(n)$ which can produce the mixture with ratio $(1 : 1 : 1)$, i.e., the mixture with equal parts <b>A</b>, <b>B</b> and <b>C</b>.<br/>
We can verify that $E(1) = 103$, $E(2) = 520447$, $E(10) \bmod 11^8 = 82608406$ and $E(500) \bmod 11^8 = 13801403$.<br/>
Find $E(10\,000\,000) \bmod 11^8$.</p> | 59510340 | Saturday, 30th August 2014, 07:00 pm | 220 | 100% | hard |
266 | Pseudo Square Root | The divisors of $12$ are: $1,2,3,4,6$ and $12$.
The largest divisor of $12$ that does not exceed the square root of $12$ is $3$.
We shall call the largest divisor of an integer $n$ that does not exceed the square root of $n$ the pseudo square root ($\operatorname{PSR}$) of $n$.
It can be seen that $\operatorname{PSR}(3102)=47$.
Let $p$ be the product of the primes below $190$.
Find $\operatorname{PSR}(p) \bmod 10^{16}$. | The divisors of $12$ are: $1,2,3,4,6$ and $12$.
The largest divisor of $12$ that does not exceed the square root of $12$ is $3$.
We shall call the largest divisor of an integer $n$ that does not exceed the square root of $n$ the pseudo square root ($\operatorname{PSR}$) of $n$.
It can be seen that $\operatorname{PSR}(3102)=47$.
Let $p$ be the product of the primes below $190$.
Find $\operatorname{PSR}(p) \bmod 10^{16}$. | <p>
The divisors of $12$ are: $1,2,3,4,6$ and $12$.<br/>
The largest divisor of $12$ that does not exceed the square root of $12$ is $3$.<br/>
We shall call the largest divisor of an integer $n$ that does not exceed the square root of $n$ the pseudo square root ($\operatorname{PSR}$) of $n$.<br/>
It can be seen that $\operatorname{PSR}(3102)=47$.
</p>
<p>
Let $p$ be the product of the primes below $190$.<br/>
Find $\operatorname{PSR}(p) \bmod 10^{16}$.
</p> | 1096883702440585 | Saturday, 28th November 2009, 01:00 pm | 1891 | 65% | hard |
748 | Upside Down Diophantine Equation | Upside Down is a modification of the famous Pythagorean equation:
\begin{align}
\frac{1}{x^2}+\frac{1}{y^2}=\frac{13}{z^2}.
\end{align}
A solution $(x,y,z)$ to this equation with $x,y$ and $z$ positive integers is a primitive solution if $\gcd(x,y,z)=1$.
Let $S(N)$ be the sum of $x+y+z$ over primitive Upside Down solutions such that $1 \leq x,y,z \leq N$ and $x \le y$.
For $N=100$ the primitive solutions are $(2,3,6)$ and $(5,90,18)$, thus $S(10^2)=124$.
It can be checked that $S(10^3)=1470$ and $S(10^5)=2340084$.
Find $S(10^{16})$ and give the last $9$ digits as your answer. | Upside Down is a modification of the famous Pythagorean equation:
\begin{align}
\frac{1}{x^2}+\frac{1}{y^2}=\frac{13}{z^2}.
\end{align}
A solution $(x,y,z)$ to this equation with $x,y$ and $z$ positive integers is a primitive solution if $\gcd(x,y,z)=1$.
Let $S(N)$ be the sum of $x+y+z$ over primitive Upside Down solutions such that $1 \leq x,y,z \leq N$ and $x \le y$.
For $N=100$ the primitive solutions are $(2,3,6)$ and $(5,90,18)$, thus $S(10^2)=124$.
It can be checked that $S(10^3)=1470$ and $S(10^5)=2340084$.
Find $S(10^{16})$ and give the last $9$ digits as your answer. | <p>
Upside Down is a modification of the famous Pythagorean equation:
\begin{align}
\frac{1}{x^2}+\frac{1}{y^2}=\frac{13}{z^2}.
\end{align}
</p>
<p>
A solution $(x,y,z)$ to this equation with $x,y$ and $z$ positive integers is a primitive solution if $\gcd(x,y,z)=1$.
</p>
<p>
Let $S(N)$ be the sum of $x+y+z$ over primitive Upside Down solutions such that $1 \leq x,y,z \leq N$ and $x \le y$.<br/>
For $N=100$ the primitive solutions are $(2,3,6)$ and $(5,90,18)$, thus $S(10^2)=124$.<br/>
It can be checked that $S(10^3)=1470$ and $S(10^5)=2340084$.
</p>
<p>
Find $S(10^{16})$ and give the last $9$ digits as your answer.
</p> | 276402862 | Saturday, 20th February 2021, 01:00 pm | 327 | 40% | medium |
248 | Euler's Totient Function Equals 13! | The first number $n$ for which $\phi(n)=13!$ is $6227180929$.
Find the $150\,000$th such number. | The first number $n$ for which $\phi(n)=13!$ is $6227180929$.
Find the $150\,000$th such number. | <p>The first number $n$ for which $\phi(n)=13!$ is $6227180929$.</p>
<p>Find the $150\,000$<sup>th</sup> such number.</p> | 23507044290 | Saturday, 6th June 2009, 01:00 am | 1470 | 70% | hard |
667 | Moving Pentagon | After buying a Gerver Sofa from the Moving Sofa Company, Jack wants to buy a matching cocktail table from the same company. Most important for him is that the table can be pushed through his L-shaped corridor into the living room without having to be lifted from its table legs.
Unfortunately, the simple square model offered to him is too small for him, so he asks for a bigger model.
He is offered the new pentagonal model illustrated below:
Note, while the shape and size can be ordered individually, due to the production process, all edges of the pentagonal table have to have the same length.
Given optimal form and size, what is the biggest pentagonal cocktail table (in terms of area) that Jack can buy that still fits through his unit wide L-shaped corridor?
Give your answer rounded to 10 digits after the decimal point (if Jack had choosen the square model instead the answer would have been 1.0000000000). | After buying a Gerver Sofa from the Moving Sofa Company, Jack wants to buy a matching cocktail table from the same company. Most important for him is that the table can be pushed through his L-shaped corridor into the living room without having to be lifted from its table legs.
Unfortunately, the simple square model offered to him is too small for him, so he asks for a bigger model.
He is offered the new pentagonal model illustrated below:
Note, while the shape and size can be ordered individually, due to the production process, all edges of the pentagonal table have to have the same length.
Given optimal form and size, what is the biggest pentagonal cocktail table (in terms of area) that Jack can buy that still fits through his unit wide L-shaped corridor?
Give your answer rounded to 10 digits after the decimal point (if Jack had choosen the square model instead the answer would have been 1.0000000000). | <p>
After buying a <i>Gerver Sofa</i> from the <i>Moving Sofa Company</i>, Jack wants to buy a matching cocktail table from the same company. Most important for him is that the table can be pushed through his L-shaped corridor into the living room without having to be lifted from its table legs. <br>
Unfortunately, the simple square model offered to him is too small for him, so he asks for a bigger model.<br/>
He is offered the new pentagonal model illustrated below:</br></p>
<img alt="p667.png" src="project/images/p667_MovingPentagon.png"><p>
Note, while the shape and size can be ordered individually, due to the production process,<b> all edges of the pentagonal table have to have the same length.</b></p>
<p>
Given optimal form and size, what is the biggest pentagonal cocktail table (in terms of area) that Jack can buy that still fits through his unit wide L-shaped corridor?</p>
<p>
Give your answer rounded to 10 digits after the decimal point (if Jack had choosen the square model instead the answer would have been 1.0000000000).</p>
</img> | 1.5276527928 | Saturday, 27th April 2019, 04:00 pm | 222 | 80% | hard |
229 | Four Representations Using Squares | Consider the number $3600$. It is very special, because
\begin{alignat}{2}
3600 &= 48^2 + &&36^2\\
3600 &= 20^2 + 2 \times &&40^2\\
3600 &= 30^2 + 3 \times &&30^2\\
3600 &= 45^2 + 7 \times &&15^2
\end{alignat}
Similarly, we find that $88201 = 99^2 + 280^2 = 287^2 + 2 \times 54^2 = 283^2 + 3 \times 52^2 = 197^2 + 7 \times 84^2$.
In 1747, Euler proved which numbers are representable as a sum of two squares.
We are interested in the numbers $n$ which admit representations of all of the following four types:
\begin{alignat}{2}
n &= a_1^2 + && b_1^2\\
n &= a_2^2 + 2 && b_2^2\\
n &= a_3^2 + 3 && b_3^2\\
n &= a_7^2 + 7 && b_7^2,
\end{alignat}
where the $a_k$ and $b_k$ are positive integers.
There are $75373$ such numbers that do not exceed $10^7$.
How many such numbers are there that do not exceed $2 \times 10^9$? | Consider the number $3600$. It is very special, because
\begin{alignat}{2}
3600 &= 48^2 + &&36^2\\
3600 &= 20^2 + 2 \times &&40^2\\
3600 &= 30^2 + 3 \times &&30^2\\
3600 &= 45^2 + 7 \times &&15^2
\end{alignat}
Similarly, we find that $88201 = 99^2 + 280^2 = 287^2 + 2 \times 54^2 = 283^2 + 3 \times 52^2 = 197^2 + 7 \times 84^2$.
In 1747, Euler proved which numbers are representable as a sum of two squares.
We are interested in the numbers $n$ which admit representations of all of the following four types:
\begin{alignat}{2}
n &= a_1^2 + && b_1^2\\
n &= a_2^2 + 2 && b_2^2\\
n &= a_3^2 + 3 && b_3^2\\
n &= a_7^2 + 7 && b_7^2,
\end{alignat}
where the $a_k$ and $b_k$ are positive integers.
There are $75373$ such numbers that do not exceed $10^7$.
How many such numbers are there that do not exceed $2 \times 10^9$? | <p>Consider the number $3600$. It is very special, because</p>
\begin{alignat}{2}
3600 &= 48^2 + &&36^2\\
3600 &= 20^2 + 2 \times &&40^2\\
3600 &= 30^2 + 3 \times &&30^2\\
3600 &= 45^2 + 7 \times &&15^2
\end{alignat}
<p>Similarly, we find that $88201 = 99^2 + 280^2 = 287^2 + 2 \times 54^2 = 283^2 + 3 \times 52^2 = 197^2 + 7 \times 84^2$.</p>
<p>In 1747, Euler proved which numbers are representable as a sum of two squares.
We are interested in the numbers $n$ which admit representations of all of the following four types:</p>
\begin{alignat}{2}
n &= a_1^2 + && b_1^2\\
n &= a_2^2 + 2 && b_2^2\\
n &= a_3^2 + 3 && b_3^2\\
n &= a_7^2 + 7 && b_7^2,
\end{alignat}
<p>where the $a_k$ and $b_k$ are positive integers.</p>
<p>There are $75373$ such numbers that do not exceed $10^7$.<br/>
How many such numbers are there that do not exceed $2 \times 10^9$?</p> | 11325263 | Saturday, 24th January 2009, 09:00 am | 1628 | 70% | hard |
631 | Constrained Permutations | Let $(p_1 p_2 \ldots p_k)$ denote the permutation of the set ${1, ..., k}$ that maps $p_i\mapsto i$. Define the length of the permutation to be $k$; note that the empty permutation $()$ has length zero.
Define an occurrence of a permutation $p=(p_1 p_2 \cdots p_k)$ in a permutation $P=(P_1 P_2 \cdots P_n)$ to be a sequence $1\leq t_1 \lt t_2 \lt \cdots \lt t_k \leq n$ such that $p_i \lt p_j$ if and only if $P_{t_i} \lt P_{t_j}$ for all $i,j \in \{1, \dots, k\}$.
For example, $(1243)$ occurs twice in the permutation $(314625)$: once as the 1st, 3rd, 4th and 6th elements $(3\,\,46\,\,5)$, and once as the 2nd, 3rd, 4th and 6th elements $(\,\,146\,\,5)$.
Let $f(n, m)$ be the number of permutations $P$ of length at most $n$ such that there is no occurrence of the permutation $1243$ in $P$ and there are at most $m$ occurrences of the permutation $21$ in $P$.
For example, $f(2,0) = 3$, with the permutations $()$, $(1)$, $(1,2)$ but not $(2,1)$.
You are also given that $f(4, 5) = 32$ and $f(10, 25) = 294\,400$.
Find $f(10^{18}, 40)$ modulo $1\,000\,000\,007$. | Let $(p_1 p_2 \ldots p_k)$ denote the permutation of the set ${1, ..., k}$ that maps $p_i\mapsto i$. Define the length of the permutation to be $k$; note that the empty permutation $()$ has length zero.
Define an occurrence of a permutation $p=(p_1 p_2 \cdots p_k)$ in a permutation $P=(P_1 P_2 \cdots P_n)$ to be a sequence $1\leq t_1 \lt t_2 \lt \cdots \lt t_k \leq n$ such that $p_i \lt p_j$ if and only if $P_{t_i} \lt P_{t_j}$ for all $i,j \in \{1, \dots, k\}$.
For example, $(1243)$ occurs twice in the permutation $(314625)$: once as the 1st, 3rd, 4th and 6th elements $(3\,\,46\,\,5)$, and once as the 2nd, 3rd, 4th and 6th elements $(\,\,146\,\,5)$.
Let $f(n, m)$ be the number of permutations $P$ of length at most $n$ such that there is no occurrence of the permutation $1243$ in $P$ and there are at most $m$ occurrences of the permutation $21$ in $P$.
For example, $f(2,0) = 3$, with the permutations $()$, $(1)$, $(1,2)$ but not $(2,1)$.
You are also given that $f(4, 5) = 32$ and $f(10, 25) = 294\,400$.
Find $f(10^{18}, 40)$ modulo $1\,000\,000\,007$. | <p>Let $(p_1 p_2 \ldots p_k)$ denote the permutation of the set ${1, ..., k}$ that maps $p_i\mapsto i$. Define the length of the permutation to be $k$; note that the empty permutation $()$ has length zero.</p>
<p>Define an <dfn>occurrence</dfn> of a permutation $p=(p_1 p_2 \cdots p_k)$ in a permutation $P=(P_1 P_2 \cdots P_n)$ to be a sequence $1\leq t_1 \lt t_2 \lt \cdots \lt t_k \leq n$ such that $p_i \lt p_j$ if and only if $P_{t_i} \lt P_{t_j}$ for all $i,j \in \{1, \dots, k\}$.</p>
<p>For example, $(1243)$ occurs twice in the permutation $(314625)$: once as the 1st, 3rd, 4th and 6th elements $(3\,\,46\,\,5)$, and once as the 2nd, 3rd, 4th and 6th elements $(\,\,146\,\,5)$.</p>
<p>Let $f(n, m)$ be the number of permutations $P$ of length at most $n$ such that there is no occurrence of the permutation $1243$ in $P$ and there are at most $m$ occurrences of the permutation $21$ in $P$.</p>
<p>For example, $f(2,0) = 3$, with the permutations $()$, $(1)$, $(1,2)$ but not $(2,1)$.</p>
<p>You are also given that $f(4, 5) = 32$ and $f(10, 25) = 294\,400$.</p>
<p>Find $f(10^{18}, 40)$ modulo $1\,000\,000\,007$.</p> | 869588692 | Sunday, 15th July 2018, 10:00 am | 208 | 65% | hard |
802 | Iterated Composition | Let $\Bbb R^2$ be the set of pairs of real numbers $(x, y)$. Let $\pi = 3.14159\cdots\ $.
Consider the function $f$ from $\Bbb R^2$ to $\Bbb R^2$ defined by $f(x, y) = (x^2 - x - y^2, 2xy - y + \pi)$, and its $n$-th iterated composition $f^{(n)}(x, y) = f(f(\cdots f(x, y)\cdots))$. For example $f^{(3)}(x, y) = f(f(f(x, y)))$. A pair $(x, y)$ is said to have period $n$ if $n$ is the smallest positive integer such that $f^{(n)}(x, y) = (x, y)$.
Let $P(n)$ denote the sum of $x$-coordinates of all points having period not exceeding $n$.
Interestingly, $P(n)$ is always an integer. For example, $P(1) = 2$, $P(2) = 2$, $P(3) = 4$.
Find $P(10^7)$ and give your answer modulo $1\,020\,340\,567$. | Let $\Bbb R^2$ be the set of pairs of real numbers $(x, y)$. Let $\pi = 3.14159\cdots\ $.
Consider the function $f$ from $\Bbb R^2$ to $\Bbb R^2$ defined by $f(x, y) = (x^2 - x - y^2, 2xy - y + \pi)$, and its $n$-th iterated composition $f^{(n)}(x, y) = f(f(\cdots f(x, y)\cdots))$. For example $f^{(3)}(x, y) = f(f(f(x, y)))$. A pair $(x, y)$ is said to have period $n$ if $n$ is the smallest positive integer such that $f^{(n)}(x, y) = (x, y)$.
Let $P(n)$ denote the sum of $x$-coordinates of all points having period not exceeding $n$.
Interestingly, $P(n)$ is always an integer. For example, $P(1) = 2$, $P(2) = 2$, $P(3) = 4$.
Find $P(10^7)$ and give your answer modulo $1\,020\,340\,567$. | <p>Let $\Bbb R^2$ be the set of pairs of real numbers $(x, y)$. Let $\pi = 3.14159\cdots\ $.</p>
<p>Consider the function $f$ from $\Bbb R^2$ to $\Bbb R^2$ defined by $f(x, y) = (x^2 - x - y^2, 2xy - y + \pi)$, and its $n$-th iterated composition $f^{(n)}(x, y) = f(f(\cdots f(x, y)\cdots))$. For example $f^{(3)}(x, y) = f(f(f(x, y)))$. A pair $(x, y)$ is said to have period $n$ if $n$ is the smallest positive integer such that $f^{(n)}(x, y) = (x, y)$.</p>
<p>Let $P(n)$ denote the sum of $x$-coordinates of all points having period not exceeding $n$.
Interestingly, $P(n)$ is always an integer. For example, $P(1) = 2$, $P(2) = 2$, $P(3) = 4$.</p>
<p>Find $P(10^7)$ and give your answer modulo $1\,020\,340\,567$.</p> | 973873727 | Sunday, 12th June 2022, 11:00 am | 278 | 35% | medium |
295 | Lenticular Holes | We call the convex area enclosed by two circles a lenticular hole if:
The centres of both circles are on lattice points.
The two circles intersect at two distinct lattice points.
The interior of the convex area enclosed by both circles does not contain any lattice points.
Consider the circles:
$C_0$: $x^2 + y^2 = 25$
$C_1$: $(x + 4)^2 + (y - 4)^2 = 1$
$C_2$: $(x - 12)^2 + (y - 4)^2 = 65$
The circles $C_0$, $C_1$ and $C_2$ are drawn in the picture below.
$C_0$ and $C_1$ form a lenticular hole, as well as $C_0$ and $C_2$.
We call an ordered pair of positive real numbers $(r_1, r_2)$ a lenticular pair if there exist two circles with radii $r_1$ and $r_2$ that form a lenticular hole.
We can verify that $(1, 5)$ and $(5, \sqrt{65})$ are the lenticular pairs of the example above.
Let $L(N)$ be the number of distinct lenticular pairs $(r_1, r_2)$ for which $0 \lt r_1 \le r_2 \le N$.
We can verify that $L(10) = 30$ and $L(100) = 3442$.
Find $L(100\,000)$. | We call the convex area enclosed by two circles a lenticular hole if:
The centres of both circles are on lattice points.
The two circles intersect at two distinct lattice points.
The interior of the convex area enclosed by both circles does not contain any lattice points.
Consider the circles:
$C_0$: $x^2 + y^2 = 25$
$C_1$: $(x + 4)^2 + (y - 4)^2 = 1$
$C_2$: $(x - 12)^2 + (y - 4)^2 = 65$
The circles $C_0$, $C_1$ and $C_2$ are drawn in the picture below.
$C_0$ and $C_1$ form a lenticular hole, as well as $C_0$ and $C_2$.
We call an ordered pair of positive real numbers $(r_1, r_2)$ a lenticular pair if there exist two circles with radii $r_1$ and $r_2$ that form a lenticular hole.
We can verify that $(1, 5)$ and $(5, \sqrt{65})$ are the lenticular pairs of the example above.
Let $L(N)$ be the number of distinct lenticular pairs $(r_1, r_2)$ for which $0 \lt r_1 \le r_2 \le N$.
We can verify that $L(10) = 30$ and $L(100) = 3442$.
Find $L(100\,000)$. | <p>We call the convex area enclosed by two circles a <dfn>lenticular hole</dfn> if:
</p><ul><li>The centres of both circles are on lattice points.</li>
<li>The two circles intersect at two distinct lattice points.</li>
<li>The interior of the convex area enclosed by both circles does not contain any lattice points.
</li>
</ul><p>Consider the circles:<br/>
$C_0$: $x^2 + y^2 = 25$<br/>
$C_1$: $(x + 4)^2 + (y - 4)^2 = 1$<br/>
$C_2$: $(x - 12)^2 + (y - 4)^2 = 65$
</p>
<p>
The circles $C_0$, $C_1$ and $C_2$ are drawn in the picture below.</p>
<div align="center"><img alt="0295_lenticular.gif" src="resources/images/0295_lenticular.gif?1678992056"/></div>
<p>
$C_0$ and $C_1$ form a lenticular hole, as well as $C_0$ and $C_2$.</p>
<p>
We call an ordered pair of positive real numbers $(r_1, r_2)$ a <dfn>lenticular pair</dfn> if there exist two circles with radii $r_1$ and $r_2$ that form a lenticular hole.
We can verify that $(1, 5)$ and $(5, \sqrt{65})$ are the lenticular pairs of the example above.</p>
<p>
Let $L(N)$ be the number of <b>distinct</b> lenticular pairs $(r_1, r_2)$ for which $0 \lt r_1 \le r_2 \le N$.<br/>
We can verify that $L(10) = 30$ and $L(100) = 3442$.</p>
<p>
Find $L(100\,000)$.
</p> | 4884650818 | Saturday, 5th June 2010, 01:00 pm | 512 | 75% | hard |
23 | Non-Abundant Sums | A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of $28$ would be $1 + 2 + 4 + 7 + 14 = 28$, which means that $28$ is a perfect number.
A number $n$ is called deficient if the sum of its proper divisors is less than $n$ and it is called abundant if this sum exceeds $n$.
As $12$ is the smallest abundant number, $1 + 2 + 3 + 4 + 6 = 16$, the smallest number that can be written as the sum of two abundant numbers is $24$. By mathematical analysis, it can be shown that all integers greater than $28123$ can be written as the sum of two abundant numbers. However, this upper limit cannot be reduced any further by analysis even though it is known that the greatest number that cannot be expressed as the sum of two abundant numbers is less than this limit.
Find the sum of all the positive integers which cannot be written as the sum of two abundant numbers. | A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of $28$ would be $1 + 2 + 4 + 7 + 14 = 28$, which means that $28$ is a perfect number.
A number $n$ is called deficient if the sum of its proper divisors is less than $n$ and it is called abundant if this sum exceeds $n$.
As $12$ is the smallest abundant number, $1 + 2 + 3 + 4 + 6 = 16$, the smallest number that can be written as the sum of two abundant numbers is $24$. By mathematical analysis, it can be shown that all integers greater than $28123$ can be written as the sum of two abundant numbers. However, this upper limit cannot be reduced any further by analysis even though it is known that the greatest number that cannot be expressed as the sum of two abundant numbers is less than this limit.
Find the sum of all the positive integers which cannot be written as the sum of two abundant numbers. | <p>A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of $28$ would be $1 + 2 + 4 + 7 + 14 = 28$, which means that $28$ is a perfect number.</p>
<p>A number $n$ is called deficient if the sum of its proper divisors is less than $n$ and it is called abundant if this sum exceeds $n$.</p>
<p>As $12$ is the smallest abundant number, $1 + 2 + 3 + 4 + 6 = 16$, the smallest number that can be written as the sum of two abundant numbers is $24$. By mathematical analysis, it can be shown that all integers greater than $28123$ can be written as the sum of two abundant numbers. However, this upper limit cannot be reduced any further by analysis even though it is known that the greatest number that cannot be expressed as the sum of two abundant numbers is less than this limit.</p>
<p>Find the sum of all the positive integers which cannot be written as the sum of two abundant numbers.</p> | 4179871 | Friday, 2nd August 2002, 06:00 pm | 113788 | 5% | easy |
211 | Divisor Square Sum | For a positive integer $n$, let $\sigma_2(n)$ be the sum of the squares of its divisors. For example,
$$\sigma_2(10) = 1 + 4 + 25 + 100 = 130.$$
Find the sum of all $n$, $0 \lt n \lt 64\,000\,000$ such that $\sigma_2(n)$ is a perfect square. | For a positive integer $n$, let $\sigma_2(n)$ be the sum of the squares of its divisors. For example,
$$\sigma_2(10) = 1 + 4 + 25 + 100 = 130.$$
Find the sum of all $n$, $0 \lt n \lt 64\,000\,000$ such that $\sigma_2(n)$ is a perfect square. | <p>For a positive integer $n$, let $\sigma_2(n)$ be the sum of the squares of its divisors. For example,
$$\sigma_2(10) = 1 + 4 + 25 + 100 = 130.$$</p>
<p>Find the sum of all $n$, $0 \lt n \lt 64\,000\,000$ such that $\sigma_2(n)$ is a perfect square.</p> | 1922364685 | Saturday, 4th October 2008, 02:00 am | 4638 | 50% | medium |
90 | Cube Digit Pairs | Each of the six faces on a cube has a different digit ($0$ to $9$) written on it; the same is done to a second cube. By placing the two cubes side-by-side in different positions we can form a variety of $2$-digit numbers.
For example, the square number $64$ could be formed:
In fact, by carefully choosing the digits on both cubes it is possible to display all of the square numbers below one-hundred: $01$, $04$, $09$, $16$, $25$, $36$, $49$, $64$, and $81$.
For example, one way this can be achieved is by placing $\{0, 5, 6, 7, 8, 9\}$ on one cube and $\{1, 2, 3, 4, 8, 9\}$ on the other cube.
However, for this problem we shall allow the $6$ or $9$ to be turned upside-down so that an arrangement like $\{0, 5, 6, 7, 8, 9\}$ and $\{1, 2, 3, 4, 6, 7\}$ allows for all nine square numbers to be displayed; otherwise it would be impossible to obtain $09$.
In determining a distinct arrangement we are interested in the digits on each cube, not the order.
$\{1, 2, 3, 4, 5, 6\}$ is equivalent to $\{3, 6, 4, 1, 2, 5\}$
$\{1, 2, 3, 4, 5, 6\}$ is distinct from $\{1, 2, 3, 4, 5, 9\}$
But because we are allowing $6$ and $9$ to be reversed, the two distinct sets in the last example both represent the extended set $\{1, 2, 3, 4, 5, 6, 9\}$ for the purpose of forming $2$-digit numbers.
How many distinct arrangements of the two cubes allow for all of the square numbers to be displayed? | Each of the six faces on a cube has a different digit ($0$ to $9$) written on it; the same is done to a second cube. By placing the two cubes side-by-side in different positions we can form a variety of $2$-digit numbers.
For example, the square number $64$ could be formed:
In fact, by carefully choosing the digits on both cubes it is possible to display all of the square numbers below one-hundred: $01$, $04$, $09$, $16$, $25$, $36$, $49$, $64$, and $81$.
For example, one way this can be achieved is by placing $\{0, 5, 6, 7, 8, 9\}$ on one cube and $\{1, 2, 3, 4, 8, 9\}$ on the other cube.
However, for this problem we shall allow the $6$ or $9$ to be turned upside-down so that an arrangement like $\{0, 5, 6, 7, 8, 9\}$ and $\{1, 2, 3, 4, 6, 7\}$ allows for all nine square numbers to be displayed; otherwise it would be impossible to obtain $09$.
In determining a distinct arrangement we are interested in the digits on each cube, not the order.
$\{1, 2, 3, 4, 5, 6\}$ is equivalent to $\{3, 6, 4, 1, 2, 5\}$
$\{1, 2, 3, 4, 5, 6\}$ is distinct from $\{1, 2, 3, 4, 5, 9\}$
But because we are allowing $6$ and $9$ to be reversed, the two distinct sets in the last example both represent the extended set $\{1, 2, 3, 4, 5, 6, 9\}$ for the purpose of forming $2$-digit numbers.
How many distinct arrangements of the two cubes allow for all of the square numbers to be displayed? | <p>Each of the six faces on a cube has a different digit ($0$ to $9$) written on it; the same is done to a second cube. By placing the two cubes side-by-side in different positions we can form a variety of $2$-digit numbers.</p>
<p>For example, the square number $64$ could be formed:</p>
<div class="center">
<img alt="" class="dark_img" src="resources/images/0090.png?1678992052"/><br/></div>
<p>In fact, by carefully choosing the digits on both cubes it is possible to display all of the square numbers below one-hundred: $01$, $04$, $09$, $16$, $25$, $36$, $49$, $64$, and $81$.</p>
<p>For example, one way this can be achieved is by placing $\{0, 5, 6, 7, 8, 9\}$ on one cube and $\{1, 2, 3, 4, 8, 9\}$ on the other cube.</p>
<p>However, for this problem we shall allow the $6$ or $9$ to be turned upside-down so that an arrangement like $\{0, 5, 6, 7, 8, 9\}$ and $\{1, 2, 3, 4, 6, 7\}$ allows for all nine square numbers to be displayed; otherwise it would be impossible to obtain $09$.</p>
<p>In determining a distinct arrangement we are interested in the digits on each cube, not the order.</p>
<ul style="list-style-type:none;"><li>$\{1, 2, 3, 4, 5, 6\}$ is equivalent to $\{3, 6, 4, 1, 2, 5\}$</li>
<li>$\{1, 2, 3, 4, 5, 6\}$ is distinct from $\{1, 2, 3, 4, 5, 9\}$</li></ul>
<p>But because we are allowing $6$ and $9$ to be reversed, the two distinct sets in the last example both represent the extended set $\{1, 2, 3, 4, 5, 6, 9\}$ for the purpose of forming $2$-digit numbers.</p>
<p>How many distinct arrangements of the two cubes allow for all of the square numbers to be displayed?</p> | 1217 | Friday, 4th March 2005, 06:00 pm | 12879 | 40% | medium |
149 | Maximum-sum Subsequence | Looking at the table below, it is easy to verify that the maximum possible sum of adjacent numbers in any direction (horizontal, vertical, diagonal or anti-diagonal) is $16$ ($= 8 + 7 + 1$).
$-2$$5$$3$$2$$9$$-6$$5$$1$$3$$2$$7$$3$$-1$$8$$-4$$8$
Now, let us repeat the search, but on a much larger scale:
First, generate four million pseudo-random numbers using a specific form of what is known as a "Lagged Fibonacci Generator":
For $1 \le k \le 55$, $s_k = [100003 - 200003 k + 300007 k^3] \pmod{1000000} - 500000$.
For $56 \le k \le 4000000$, $s_k = [s_{k-24} + s_{k - 55} + 1000000] \pmod{1000000} - 500000$.
Thus, $s_{10} = -393027$ and $s_{100} = 86613$.
The terms of $s$ are then arranged in a $2000 \times 2000$ table, using the first $2000$ numbers to fill the first row (sequentially), the next $2000$ numbers to fill the second row, and so on.
Finally, find the greatest sum of (any number of) adjacent entries in any direction (horizontal, vertical, diagonal or anti-diagonal). | Looking at the table below, it is easy to verify that the maximum possible sum of adjacent numbers in any direction (horizontal, vertical, diagonal or anti-diagonal) is $16$ ($= 8 + 7 + 1$).
$-2$$5$$3$$2$$9$$-6$$5$$1$$3$$2$$7$$3$$-1$$8$$-4$$8$
Now, let us repeat the search, but on a much larger scale:
First, generate four million pseudo-random numbers using a specific form of what is known as a "Lagged Fibonacci Generator":
For $1 \le k \le 55$, $s_k = [100003 - 200003 k + 300007 k^3] \pmod{1000000} - 500000$.
For $56 \le k \le 4000000$, $s_k = [s_{k-24} + s_{k - 55} + 1000000] \pmod{1000000} - 500000$.
Thus, $s_{10} = -393027$ and $s_{100} = 86613$.
The terms of $s$ are then arranged in a $2000 \times 2000$ table, using the first $2000$ numbers to fill the first row (sequentially), the next $2000$ numbers to fill the second row, and so on.
Finally, find the greatest sum of (any number of) adjacent entries in any direction (horizontal, vertical, diagonal or anti-diagonal). | <p>Looking at the table below, it is easy to verify that the maximum possible sum of adjacent numbers in any direction (horizontal, vertical, diagonal or anti-diagonal) <span style="white-space:nowrap;">is $16$ ($= 8 + 7 + 1$).</span></p>
<div class="center">
<table border="1" cellpadding="6" cellspacing="0" style="margin:auto;"><tbody align="right"><tr><td width="25">$-2$</td><td width="25">$5$</td><td width="25">$3$</td><td width="25">$2$</td></tr><tr><td>$9$</td><td>$-6$</td><td>$5$</td><td>$1$</td></tr><tr><td>$3$</td><td>$2$</td><td>$7$</td><td>$3$</td></tr><tr><td>$-1$</td><td>$8$</td><td>$-4$</td><td>$8$</td></tr></tbody></table></div>
<p>Now, let us repeat the search, but on a much larger scale:</p>
<p>First, generate four million pseudo-random numbers using a specific form of what is known as a "Lagged Fibonacci Generator":</p>
<p>For $1 \le k \le 55$, $s_k = [100003 - 200003 k + 300007 k^3] \pmod{1000000} - 500000$.<br/>
For $56 \le k \le 4000000$, $s_k = [s_{k-24} + s_{k - 55} + 1000000] \pmod{1000000} - 500000$.</p>
<p>Thus, $s_{10} = -393027$ and $s_{100} = 86613$.</p>
<p>The terms of $s$ are then arranged in a $2000 \times 2000$ table, using the first $2000$ numbers to fill the first row (sequentially), the next $2000$ numbers to fill the second row, and so on.</p>
<p>Finally, find the greatest sum of (any number of) adjacent entries in any direction (horizontal, vertical, diagonal or anti-diagonal).</p> | 52852124 | Friday, 13th April 2007, 10:00 pm | 5408 | 50% | medium |
486 | Palindrome-containing Strings | Let $F_5(n)$ be the number of strings $s$ such that:
$s$ consists only of '0's and '1's,
$s$ has length at most $n$, and
$s$ contains a palindromic substring of length at least $5$.
For example, $F_5(4) = 0$, $F_5(5) = 8$,
$F_5(6) = 42$ and $F_5(11) = 3844$.
Let $D(L)$ be the number of integers $n$ such that $5 \le n \le L$ and $F_5(n)$ is divisible by $87654321$.
For example, $D(10^7) = 0$ and $D(5 \cdot 10^9) = 51$.
Find $D(10^{18})$. | Let $F_5(n)$ be the number of strings $s$ such that:
$s$ consists only of '0's and '1's,
$s$ has length at most $n$, and
$s$ contains a palindromic substring of length at least $5$.
For example, $F_5(4) = 0$, $F_5(5) = 8$,
$F_5(6) = 42$ and $F_5(11) = 3844$.
Let $D(L)$ be the number of integers $n$ such that $5 \le n \le L$ and $F_5(n)$ is divisible by $87654321$.
For example, $D(10^7) = 0$ and $D(5 \cdot 10^9) = 51$.
Find $D(10^{18})$. | <p>Let $F_5(n)$ be the number of strings $s$ such that:</p>
<ul><li>$s$ consists only of '0's and '1's,
</li><li>$s$ has length at most $n$, and
</li><li>$s$ contains a palindromic substring of length at least $5$.
</li></ul><p>For example, $F_5(4) = 0$, $F_5(5) = 8$,
$F_5(6) = 42$ and $F_5(11) = 3844$.</p>
<p>Let $D(L)$ be the number of integers $n$ such that $5 \le n \le L$ and $F_5(n)$ is divisible by $87654321$.</p>
<p>For example, $D(10^7) = 0$ and $D(5 \cdot 10^9) = 51$.</p>
<p>Find $D(10^{18})$.</p> | 11408450515 | Saturday, 25th October 2014, 07:00 pm | 291 | 70% | hard |
197 | A Recursively Defined Sequence | Given is the function $f(x) = \lfloor 2^{30.403243784 - x^2}\rfloor \times 10^{-9}$ ($\lfloor \, \rfloor$ is the floor-function),
the sequence $u_n$ is defined by $u_0 = -1$ and $u_{n + 1} = f(u_n)$.
Find $u_n + u_{n + 1}$ for $n = 10^{12}$.
Give your answer with $9$ digits after the decimal point. | Given is the function $f(x) = \lfloor 2^{30.403243784 - x^2}\rfloor \times 10^{-9}$ ($\lfloor \, \rfloor$ is the floor-function),
the sequence $u_n$ is defined by $u_0 = -1$ and $u_{n + 1} = f(u_n)$.
Find $u_n + u_{n + 1}$ for $n = 10^{12}$.
Give your answer with $9$ digits after the decimal point. | <p>Given is the function $f(x) = \lfloor 2^{30.403243784 - x^2}\rfloor \times 10^{-9}$ ($\lfloor \, \rfloor$ is the floor-function),<br/>
the sequence $u_n$ is defined by $u_0 = -1$ and $u_{n + 1} = f(u_n)$.</p>
<p>Find $u_n + u_{n + 1}$ for $n = 10^{12}$.<br/>
Give your answer with $9$ digits after the decimal point.</p> | 1.710637717 | Friday, 6th June 2008, 10:00 pm | 5402 | 45% | medium |
135 | Same Differences | Given the positive integers, $x$, $y$, and $z$, are consecutive terms of an arithmetic progression, the least value of the positive integer, $n$, for which the equation, $x^2 - y^2 - z^2 = n$, has exactly two solutions is $n = 27$:
$$34^2 - 27^2 - 20^2 = 12^2 - 9^2 - 6^2 = 27.$$
It turns out that $n = 1155$ is the least value which has exactly ten solutions.
How many values of $n$ less than one million have exactly ten distinct solutions? | Given the positive integers, $x$, $y$, and $z$, are consecutive terms of an arithmetic progression, the least value of the positive integer, $n$, for which the equation, $x^2 - y^2 - z^2 = n$, has exactly two solutions is $n = 27$:
$$34^2 - 27^2 - 20^2 = 12^2 - 9^2 - 6^2 = 27.$$
It turns out that $n = 1155$ is the least value which has exactly ten solutions.
How many values of $n$ less than one million have exactly ten distinct solutions? | <p>Given the positive integers, $x$, $y$, and $z$, are consecutive terms of an arithmetic progression, the least value of the positive integer, $n$, for which the equation, $x^2 - y^2 - z^2 = n$, has exactly two solutions is $n = 27$:
$$34^2 - 27^2 - 20^2 = 12^2 - 9^2 - 6^2 = 27.$$</p>
<p>It turns out that $n = 1155$ is the least value which has exactly ten solutions.</p>
<p>How many values of $n$ less than one million have exactly ten distinct solutions?</p> | 4989 | Friday, 29th December 2006, 06:00 pm | 7211 | 45% | medium |
525 | Rolling Ellipse | An ellipse $E(a, b)$ is given at its initial position by equation:
$\frac {x^2} {a^2} + \frac {(y - b)^2} {b^2} = 1$
The ellipse rolls without slipping along the $x$ axis for one complete turn. Interestingly, the length of the curve generated by a focus is independent from the size of the minor axis:
$F(a,b) = 2 \pi \max(a,b)$
This is not true for the curve generated by the ellipse center. Let $C(a, b)$ be the length of the curve generated by the center of the ellipse as it rolls without slipping for one turn.
You are given $C(2, 4) \approx 21.38816906$.
Find $C(1, 4) + C(3, 4)$. Give your answer rounded to $8$ digits behind the decimal point in the form ab.cdefghij. | An ellipse $E(a, b)$ is given at its initial position by equation:
$\frac {x^2} {a^2} + \frac {(y - b)^2} {b^2} = 1$
The ellipse rolls without slipping along the $x$ axis for one complete turn. Interestingly, the length of the curve generated by a focus is independent from the size of the minor axis:
$F(a,b) = 2 \pi \max(a,b)$
This is not true for the curve generated by the ellipse center. Let $C(a, b)$ be the length of the curve generated by the center of the ellipse as it rolls without slipping for one turn.
You are given $C(2, 4) \approx 21.38816906$.
Find $C(1, 4) + C(3, 4)$. Give your answer rounded to $8$ digits behind the decimal point in the form ab.cdefghij. | <p>An ellipse $E(a, b)$ is given at its initial position by equation:<br/>
$\frac {x^2} {a^2} + \frac {(y - b)^2} {b^2} = 1$</p>
<p>The ellipse rolls without slipping along the $x$ axis for one complete turn. Interestingly, the length of the curve generated by a focus is independent from the size of the minor axis:<br/>
$F(a,b) = 2 \pi \max(a,b)$</p>
<div align="center"><img alt="0525-rolling-ellipse-1.gif" src="resources/images/0525-rolling-ellipse-1.gif?1678992057"/></div>
<p>This is not true for the curve generated by the ellipse center. Let $C(a, b)$ be the length of the curve generated by the center of the ellipse as it rolls without slipping for one turn.</p>
<div align="center"><img alt="0525-rolling-ellipse-2.gif" src="resources/images/0525-rolling-ellipse-2.gif?1678992057"/></div>
<p>You are given $C(2, 4) \approx 21.38816906$.</p>
<p>Find $C(1, 4) + C(3, 4)$. Give your answer rounded to $8$ digits behind the decimal point in the form <i>ab.cdefghij</i>.</p> | 44.69921807 | Sunday, 13th September 2015, 10:00 am | 547 | 45% | medium |
646 | Bounded Divisors | Let $n$ be a natural number and $p_1^{\alpha_1}\cdot p_2^{\alpha_2}\cdots p_k^{\alpha_k}$ its prime factorisation.
Define the Liouville function $\lambda(n)$ as $\lambda(n) = (-1)^{\sum\limits_{i=1}^{k}\alpha_i}$.
(i.e. $-1$ if the sum of the exponents $\alpha_i$ is odd and $1$ if the sum of the exponents is even. )
Let $S(n,L,H)$ be the sum $\lambda(d) \cdot d$ over all divisors $d$ of $n$ for which $L \leq d \leq H$.
You are given:
$S(10! , 100, 1000) = 1457$
$S(15!, 10^3, 10^5) = -107974$
$S(30!,10^8, 10^{12}) = 9766732243224$.
Find $S(70!,10^{20}, 10^{60})$ and give your answer modulo $1\,000\,000\,007$. | Let $n$ be a natural number and $p_1^{\alpha_1}\cdot p_2^{\alpha_2}\cdots p_k^{\alpha_k}$ its prime factorisation.
Define the Liouville function $\lambda(n)$ as $\lambda(n) = (-1)^{\sum\limits_{i=1}^{k}\alpha_i}$.
(i.e. $-1$ if the sum of the exponents $\alpha_i$ is odd and $1$ if the sum of the exponents is even. )
Let $S(n,L,H)$ be the sum $\lambda(d) \cdot d$ over all divisors $d$ of $n$ for which $L \leq d \leq H$.
You are given:
$S(10! , 100, 1000) = 1457$
$S(15!, 10^3, 10^5) = -107974$
$S(30!,10^8, 10^{12}) = 9766732243224$.
Find $S(70!,10^{20}, 10^{60})$ and give your answer modulo $1\,000\,000\,007$. | <p>
Let $n$ be a natural number and $p_1^{\alpha_1}\cdot p_2^{\alpha_2}\cdots p_k^{\alpha_k}$ its prime factorisation.<br/>
Define the <b>Liouville function</b> $\lambda(n)$ as $\lambda(n) = (-1)^{\sum\limits_{i=1}^{k}\alpha_i}$.<br/>
(i.e. $-1$ if the sum of the exponents $\alpha_i$ is odd and $1$ if the sum of the exponents is even. )<br/>
Let $S(n,L,H)$ be the sum $\lambda(d) \cdot d$ over all divisors $d$ of $n$ for which $L \leq d \leq H$.
</p>
<p>
You are given:</p>
<ul>
<li>$S(10! , 100, 1000) = 1457$</li>
<li>$S(15!, 10^3, 10^5) = -107974$</li>
<li>$S(30!,10^8, 10^{12}) = 9766732243224$.</li></ul>
<p>
Find $S(70!,10^{20}, 10^{60})$ and give your answer modulo $1\,000\,000\,007$.
</p> | 845218467 | Sunday, 9th December 2018, 04:00 am | 313 | 40% | medium |
68 | Magic 5-gon Ring | Consider the following "magic" 3-gon ring, filled with the numbers 1 to 6, and each line adding to nine.
Working clockwise, and starting from the group of three with the numerically lowest external node (4,3,2 in this example), each solution can be described uniquely. For example, the above solution can be described by the set: 4,3,2; 6,2,1; 5,1,3.
It is possible to complete the ring with four different totals: 9, 10, 11, and 12. There are eight solutions in total.
TotalSolution Set
94,2,3; 5,3,1; 6,1,2
94,3,2; 6,2,1; 5,1,3
102,3,5; 4,5,1; 6,1,3
102,5,3; 6,3,1; 4,1,5
111,4,6; 3,6,2; 5,2,4
111,6,4; 5,4,2; 3,2,6
121,5,6; 2,6,4; 3,4,5
121,6,5; 3,5,4; 2,4,6
By concatenating each group it is possible to form 9-digit strings; the maximum string for a 3-gon ring is 432621513.
Using the numbers 1 to 10, and depending on arrangements, it is possible to form 16- and 17-digit strings. What is the maximum 16-digit string for a "magic" 5-gon ring? | Consider the following "magic" 3-gon ring, filled with the numbers 1 to 6, and each line adding to nine.
Working clockwise, and starting from the group of three with the numerically lowest external node (4,3,2 in this example), each solution can be described uniquely. For example, the above solution can be described by the set: 4,3,2; 6,2,1; 5,1,3.
It is possible to complete the ring with four different totals: 9, 10, 11, and 12. There are eight solutions in total.
TotalSolution Set
94,2,3; 5,3,1; 6,1,2
94,3,2; 6,2,1; 5,1,3
102,3,5; 4,5,1; 6,1,3
102,5,3; 6,3,1; 4,1,5
111,4,6; 3,6,2; 5,2,4
111,6,4; 5,4,2; 3,2,6
121,5,6; 2,6,4; 3,4,5
121,6,5; 3,5,4; 2,4,6
By concatenating each group it is possible to form 9-digit strings; the maximum string for a 3-gon ring is 432621513.
Using the numbers 1 to 10, and depending on arrangements, it is possible to form 16- and 17-digit strings. What is the maximum 16-digit string for a "magic" 5-gon ring? | <p>Consider the following "magic" 3-gon ring, filled with the numbers 1 to 6, and each line adding to nine.</p>
<div class="center">
<img alt="" class="dark_img" src="resources/images/0068_1.png?1678992052"/><br/></div>
<p>Working <b>clockwise</b>, and starting from the group of three with the numerically lowest external node (4,3,2 in this example), each solution can be described uniquely. For example, the above solution can be described by the set: 4,3,2; 6,2,1; 5,1,3.</p>
<p>It is possible to complete the ring with four different totals: 9, 10, 11, and 12. There are eight solutions in total.</p>
<div class="center">
<table cellpadding="0" cellspacing="0" width="400"><tr><td width="100"><b>Total</b></td><td width="300"><b>Solution Set</b></td>
</tr><tr><td>9</td><td>4,2,3; 5,3,1; 6,1,2</td>
</tr><tr><td>9</td><td>4,3,2; 6,2,1; 5,1,3</td>
</tr><tr><td>10</td><td>2,3,5; 4,5,1; 6,1,3</td>
</tr><tr><td>10</td><td>2,5,3; 6,3,1; 4,1,5</td>
</tr><tr><td>11</td><td>1,4,6; 3,6,2; 5,2,4</td>
</tr><tr><td>11</td><td>1,6,4; 5,4,2; 3,2,6</td>
</tr><tr><td>12</td><td>1,5,6; 2,6,4; 3,4,5</td>
</tr><tr><td>12</td><td>1,6,5; 3,5,4; 2,4,6</td>
</tr></table></div>
<p>By concatenating each group it is possible to form 9-digit strings; the maximum string for a 3-gon ring is 432621513.</p>
<p>Using the numbers 1 to 10, and depending on arrangements, it is possible to form 16- and 17-digit strings. What is the maximum <b>16-digit</b> string for a "magic" 5-gon ring?</p>
<div class="center">
<img alt="" class="dark_img" src="resources/images/0068_2.png?1678992052"/><br/></div> | 6531031914842725 | Friday, 23rd April 2004, 06:00 pm | 23263 | 25% | easy |
495 | Writing $n$ as the Product of $k$ Distinct Positive Integers | Let $W(n,k)$ be the number of ways in which $n$ can be written as the product of $k$ distinct positive integers.
For example, $W(144,4) = 7$. There are $7$ ways in which $144$ can be written as a product of $4$ distinct positive integers:
$144 = 1 \times 2 \times 4 \times 18$
$144 = 1 \times 2 \times 8 \times 9$
$144 = 1 \times 2 \times 3 \times 24$
$144 = 1 \times 2 \times 6 \times 12$
$144 = 1 \times 3 \times 4 \times 12$
$144 = 1 \times 3 \times 6 \times 8$
$144 = 2 \times 3 \times 4 \times 6$
Note that permutations of the integers themselves are not considered distinct.
Furthermore, $W(100!,10)$ modulo $1\,000\,000\,007 = 287549200$.
Find $W(10000!,30)$ modulo $1\,000\,000\,007$. | Let $W(n,k)$ be the number of ways in which $n$ can be written as the product of $k$ distinct positive integers.
For example, $W(144,4) = 7$. There are $7$ ways in which $144$ can be written as a product of $4$ distinct positive integers:
$144 = 1 \times 2 \times 4 \times 18$
$144 = 1 \times 2 \times 8 \times 9$
$144 = 1 \times 2 \times 3 \times 24$
$144 = 1 \times 2 \times 6 \times 12$
$144 = 1 \times 3 \times 4 \times 12$
$144 = 1 \times 3 \times 6 \times 8$
$144 = 2 \times 3 \times 4 \times 6$
Note that permutations of the integers themselves are not considered distinct.
Furthermore, $W(100!,10)$ modulo $1\,000\,000\,007 = 287549200$.
Find $W(10000!,30)$ modulo $1\,000\,000\,007$. | <p>Let $W(n,k)$ be the number of ways in which $n$ can be written as the product of $k$ distinct positive integers.</p>
<p>For example, $W(144,4) = 7$. There are $7$ ways in which $144$ can be written as a product of $4$ distinct positive integers:</p>
<p></p><ul><li>$144 = 1 \times 2 \times 4 \times 18$</li>
<li>$144 = 1 \times 2 \times 8 \times 9$</li>
<li>$144 = 1 \times 2 \times 3 \times 24$</li>
<li>$144 = 1 \times 2 \times 6 \times 12$</li>
<li>$144 = 1 \times 3 \times 4 \times 12$</li>
<li>$144 = 1 \times 3 \times 6 \times 8$</li>
<li>$144 = 2 \times 3 \times 4 \times 6$</li>
</ul><p>Note that permutations of the integers themselves are not considered distinct.</p>
<p>Furthermore, $W(100!,10)$ modulo $1\,000\,000\,007 = 287549200$.</p>
<p>Find $W(10000!,30)$ modulo $1\,000\,000\,007$.</p> | 789107601 | Saturday, 27th December 2014, 10:00 pm | 357 | 100% | hard |
788 | Dominating Numbers | A dominating number is a positive integer that has more than half of its digits equal.
For example, $2022$ is a dominating number because three of its four digits are equal to $2$. But $2021$ is not a dominating number.
Let $D(N)$ be how many dominating numbers are less than $10^N$.
For example, $D(4) = 603$ and $D(10) = 21893256$.
Find $D(2022)$. Give your answer modulo $1\,000\,000\,007$. | A dominating number is a positive integer that has more than half of its digits equal.
For example, $2022$ is a dominating number because three of its four digits are equal to $2$. But $2021$ is not a dominating number.
Let $D(N)$ be how many dominating numbers are less than $10^N$.
For example, $D(4) = 603$ and $D(10) = 21893256$.
Find $D(2022)$. Give your answer modulo $1\,000\,000\,007$. | <p>
A <dfn>dominating number</dfn> is a positive integer that has more than half of its digits equal.
</p>
<p>
For example, $2022$ is a dominating number because three of its four digits are equal to $2$. But $2021$ is not a dominating number.
</p>
<p>
Let $D(N)$ be how many dominating numbers are less than $10^N$.
For example, $D(4) = 603$ and $D(10) = 21893256$.
</p>
<p>
Find $D(2022)$. Give your answer modulo $1\,000\,000\,007$.
</p> | 471745499 | Saturday, 5th March 2022, 04:00 pm | 1298 | 10% | easy |
498 | Remainder of Polynomial Division | For positive integers $n$ and $m$, we define two polynomials $F_n(x) = x^n$ and $G_m(x) = (x-1)^m$.
We also define a polynomial $R_{n,m}(x)$ as the remainder of the division of $F_n(x)$ by $G_m(x)$.
For example, $R_{6,3}(x) = 15x^2 - 24x + 10$.
Let $C(n, m, d)$ be the absolute value of the coefficient of the $d$-th degree term of $R_{n,m}(x)$.
We can verify that $C(6, 3, 1) = 24$ and $C(100, 10, 4) = 227197811615775$.
Find $C(10^{13}, 10^{12}, 10^4) \bmod 999999937$. | For positive integers $n$ and $m$, we define two polynomials $F_n(x) = x^n$ and $G_m(x) = (x-1)^m$.
We also define a polynomial $R_{n,m}(x)$ as the remainder of the division of $F_n(x)$ by $G_m(x)$.
For example, $R_{6,3}(x) = 15x^2 - 24x + 10$.
Let $C(n, m, d)$ be the absolute value of the coefficient of the $d$-th degree term of $R_{n,m}(x)$.
We can verify that $C(6, 3, 1) = 24$ and $C(100, 10, 4) = 227197811615775$.
Find $C(10^{13}, 10^{12}, 10^4) \bmod 999999937$. | <p>For positive integers $n$ and $m$, we define two polynomials $F_n(x) = x^n$ and $G_m(x) = (x-1)^m$.<br/>
We also define a polynomial $R_{n,m}(x)$ as the remainder of the division of $F_n(x)$ by $G_m(x)$.<br/>
For example, $R_{6,3}(x) = 15x^2 - 24x + 10$.</p>
<p>Let $C(n, m, d)$ be the absolute value of the coefficient of the $d$-th degree term of $R_{n,m}(x)$.<br/>
We can verify that $C(6, 3, 1) = 24$ and $C(100, 10, 4) = 227197811615775$.</p>
<p>Find $C(10^{13}, 10^{12}, 10^4) \bmod 999999937$.</p> | 472294837 | Sunday, 18th January 2015, 07:00 am | 578 | 40% | medium |
915 | Giant GCDs | The function $s(n)$ is defined recursively for positive integers by
$s(1) = 1$ and $s(n+1) = \big(s(n) - 1\big)^3 +2$ for $n\geq 1$.
The sequence begins: $s(1) = 1, s(2) = 2, s(3) = 3, s(4) = 10, \ldots$.
For positive integers $N$, define $$T(N) = \sum_{a=1}^N \sum_{b=1}^N \gcd\Big(s\big(s(a)\big), s\big(s(b)\big)\Big).$$ You are given $T(3) = 12$, $T(4) \equiv 24881925$ and $T(100)\equiv 14416749$ both modulo $123456789$.
Find $T(10^8)$. Give your answer modulo $123456789$. | The function $s(n)$ is defined recursively for positive integers by
$s(1) = 1$ and $s(n+1) = \big(s(n) - 1\big)^3 +2$ for $n\geq 1$.
The sequence begins: $s(1) = 1, s(2) = 2, s(3) = 3, s(4) = 10, \ldots$.
For positive integers $N$, define $$T(N) = \sum_{a=1}^N \sum_{b=1}^N \gcd\Big(s\big(s(a)\big), s\big(s(b)\big)\Big).$$ You are given $T(3) = 12$, $T(4) \equiv 24881925$ and $T(100)\equiv 14416749$ both modulo $123456789$.
Find $T(10^8)$. Give your answer modulo $123456789$. | <p>
The function $s(n)$ is defined recursively for positive integers by
$s(1) = 1$ and $s(n+1) = \big(s(n) - 1\big)^3 +2$ for $n\geq 1$.<br/>
The sequence begins: $s(1) = 1, s(2) = 2, s(3) = 3, s(4) = 10, \ldots$.</p>
<p>
For positive integers $N$, define $$T(N) = \sum_{a=1}^N \sum_{b=1}^N \gcd\Big(s\big(s(a)\big), s\big(s(b)\big)\Big).$$ You are given $T(3) = 12$, $T(4) \equiv 24881925$ and $T(100)\equiv 14416749$ both modulo $123456789$.</p>
<p>
Find $T(10^8)$. Give your answer modulo $123456789$.</p> | 55601924 | Saturday, 2nd November 2024, 07:00 pm | 193 | 45% | medium |
520 | Simbers | We define a simber to be a positive integer in which any odd digit, if present, occurs an odd number of times, and any even digit, if present, occurs an even number of times.
For example, $141221242$ is a $9$-digit simber because it has three $1$'s, four $2$'s and two $4$'s.
Let $Q(n)$ be the count of all simbers with at most $n$ digits.
You are given $Q(7) = 287975$ and $Q(100) \bmod 1\,000\,000\,123 = 123864868$.
Find $(\sum_{1 \le u \le 39} Q(2^u)) \bmod 1\,000\,000\,123$. | We define a simber to be a positive integer in which any odd digit, if present, occurs an odd number of times, and any even digit, if present, occurs an even number of times.
For example, $141221242$ is a $9$-digit simber because it has three $1$'s, four $2$'s and two $4$'s.
Let $Q(n)$ be the count of all simbers with at most $n$ digits.
You are given $Q(7) = 287975$ and $Q(100) \bmod 1\,000\,000\,123 = 123864868$.
Find $(\sum_{1 \le u \le 39} Q(2^u)) \bmod 1\,000\,000\,123$. | <p>We define a <dfn>simber</dfn> to be a positive integer in which any odd digit, if present, occurs an odd number of times, and any even digit, if present, occurs an even number of times.</p>
<p>For example, $141221242$ is a $9$-digit simber because it has three $1$'s, four $2$'s and two $4$'s. </p>
<p>Let $Q(n)$ be the count of all simbers with at most $n$ digits.</p>
<p>You are given $Q(7) = 287975$ and $Q(100) \bmod 1\,000\,000\,123 = 123864868$.</p>
<p>Find $(\sum_{1 \le u \le 39} Q(2^u)) \bmod 1\,000\,000\,123$.</p> | 238413705 | Saturday, 13th June 2015, 10:00 pm | 460 | 45% | medium |
691 | Long Substring with Many Repetitions | Given a character string $s$, we define $L(k,s)$ to be the length of the longest substring of $s$ which appears at least $k$ times in $s$, or $0$ if such a substring does not exist. For example, $L(3,\text{“bbabcabcabcacba”})=4$ because of the three occurrences of the substring $\text{“abca”}$, and $L(2,\text{“bbabcabcabcacba”})=7$ because of the repeated substring $\text{“abcabca”}$. Note that the occurrences can overlap.
Let $a_n$, $b_n$ and $c_n$ be the $0/1$ sequences defined by:
$a_0 = 0$
$a_{2n} = a_{n}$
$a_{2n+1} = 1-a_{n}$
$b_n = \lfloor\frac{n+1}{\varphi}\rfloor - \lfloor\frac{n}{\varphi}\rfloor$ (where $\varphi$ is the golden ratio)
$c_n = a_n + b_n - 2a_nb_n$
and $S_n$ the character string $c_0\ldots c_{n-1}$. You are given that $L(2,S_{10})=5$, $L(3,S_{10})=2$, $L(2,S_{100})=14$, $L(4,S_{100})=6$, $L(2,S_{1000})=86$, $L(3,S_{1000}) = 45$, $L(5,S_{1000}) = 31$, and that the sum of non-zero $L(k,S_{1000})$ for $k\ge 1$ is $2460$.
Find the sum of non-zero $L(k,S_{5000000})$ for $k\ge 1$. | Given a character string $s$, we define $L(k,s)$ to be the length of the longest substring of $s$ which appears at least $k$ times in $s$, or $0$ if such a substring does not exist. For example, $L(3,\text{“bbabcabcabcacba”})=4$ because of the three occurrences of the substring $\text{“abca”}$, and $L(2,\text{“bbabcabcabcacba”})=7$ because of the repeated substring $\text{“abcabca”}$. Note that the occurrences can overlap.
Let $a_n$, $b_n$ and $c_n$ be the $0/1$ sequences defined by:
$a_0 = 0$
$a_{2n} = a_{n}$
$a_{2n+1} = 1-a_{n}$
$b_n = \lfloor\frac{n+1}{\varphi}\rfloor - \lfloor\frac{n}{\varphi}\rfloor$ (where $\varphi$ is the golden ratio)
$c_n = a_n + b_n - 2a_nb_n$
and $S_n$ the character string $c_0\ldots c_{n-1}$. You are given that $L(2,S_{10})=5$, $L(3,S_{10})=2$, $L(2,S_{100})=14$, $L(4,S_{100})=6$, $L(2,S_{1000})=86$, $L(3,S_{1000}) = 45$, $L(5,S_{1000}) = 31$, and that the sum of non-zero $L(k,S_{1000})$ for $k\ge 1$ is $2460$.
Find the sum of non-zero $L(k,S_{5000000})$ for $k\ge 1$. | <p>Given a character string $s$, we define $L(k,s)$ to be the length of the longest substring of $s$ which appears at least $k$ times in $s$, or $0$ if such a substring does not exist. For example, $L(3,\text{“bbabcabcabcacba”})=4$ because of the three occurrences of the substring $\text{“abca”}$, and $L(2,\text{“bbabcabcabcacba”})=7$ because of the repeated substring $\text{“abcabca”}$. Note that the occurrences can overlap.</p>
<p>Let $a_n$, $b_n$ and $c_n$ be the $0/1$ sequences defined by:</p>
<ul><li>$a_0 = 0$</li>
<li>$a_{2n} = a_{n}$</li>
<li>$a_{2n+1} = 1-a_{n}$</li>
<li>$b_n = \lfloor\frac{n+1}{\varphi}\rfloor - \lfloor\frac{n}{\varphi}\rfloor$ (where $\varphi$ is the golden ratio)</li>
<li>$c_n = a_n + b_n - 2a_nb_n$</li>
</ul><p>and $S_n$ the character string $c_0\ldots c_{n-1}$. You are given that $L(2,S_{10})=5$, $L(3,S_{10})=2$, $L(2,S_{100})=14$, $L(4,S_{100})=6$, $L(2,S_{1000})=86$, $L(3,S_{1000}) = 45$, $L(5,S_{1000}) = 31$, and that the sum of non-zero $L(k,S_{1000})$ for $k\ge 1$ is $2460$.</p>
<p>Find the sum of non-zero $L(k,S_{5000000})$ for $k\ge 1$.</p> | 11570761 | Sunday, 1st December 2019, 10:00 am | 297 | 40% | medium |
626 | Counting Binary Matrices | A binary matrix is a matrix consisting entirely of $0$s and $1$s. Consider the following transformations that can be performed on a binary matrix:
Swap any two rows
Swap any two columns
Flip all elements in a single row ($1$s become $0$s, $0$s become $1$s)
Flip all elements in a single column
Two binary matrices $A$ and $B$ will be considered equivalent if there is a sequence of such transformations that when applied to $A$ yields $B$. For example, the following two matrices are equivalent:
$A=\begin{pmatrix}
1 & 0 & 1 \\
0 & 0 & 1 \\
0 & 0 & 0 \\
\end{pmatrix} \quad B=\begin{pmatrix}
0 & 0 & 0 \\
1 & 0 & 0 \\
0 & 0 & 1 \\
\end{pmatrix}$
via the sequence of two transformations "Flip all elements in column 3" followed by "Swap rows 1 and 2".
Define $c(n)$ to be the maximum number of $n\times n$ binary matrices that can be found such that no two are equivalent. For example, $c(3)=3$. You are also given that $c(5)=39$ and $c(8)=656108$.
Find $c(20)$, and give your answer modulo $1\,001\,001\,011$. | A binary matrix is a matrix consisting entirely of $0$s and $1$s. Consider the following transformations that can be performed on a binary matrix:
Swap any two rows
Swap any two columns
Flip all elements in a single row ($1$s become $0$s, $0$s become $1$s)
Flip all elements in a single column
Two binary matrices $A$ and $B$ will be considered equivalent if there is a sequence of such transformations that when applied to $A$ yields $B$. For example, the following two matrices are equivalent:
$A=\begin{pmatrix}
1 & 0 & 1 \\
0 & 0 & 1 \\
0 & 0 & 0 \\
\end{pmatrix} \quad B=\begin{pmatrix}
0 & 0 & 0 \\
1 & 0 & 0 \\
0 & 0 & 1 \\
\end{pmatrix}$
via the sequence of two transformations "Flip all elements in column 3" followed by "Swap rows 1 and 2".
Define $c(n)$ to be the maximum number of $n\times n$ binary matrices that can be found such that no two are equivalent. For example, $c(3)=3$. You are also given that $c(5)=39$ and $c(8)=656108$.
Find $c(20)$, and give your answer modulo $1\,001\,001\,011$. | <p>A binary matrix is a matrix consisting entirely of $0$s and $1$s. Consider the following transformations that can be performed on a binary matrix:</p>
<ul>
<li>Swap any two rows</li>
<li>Swap any two columns</li>
<li>Flip all elements in a single row ($1$s become $0$s, $0$s become $1$s)</li>
<li>Flip all elements in a single column</li>
</ul>
<p>Two binary matrices $A$ and $B$ will be considered <dfn>equivalent</dfn> if there is a sequence of such transformations that when applied to $A$ yields $B$. For example, the following two matrices are equivalent:</p>
$A=\begin{pmatrix}
1 & 0 & 1 \\
0 & 0 & 1 \\
0 & 0 & 0 \\
\end{pmatrix} \quad B=\begin{pmatrix}
0 & 0 & 0 \\
1 & 0 & 0 \\
0 & 0 & 1 \\
\end{pmatrix}$
<p>via the sequence of two transformations "Flip all elements in column 3" followed by "Swap rows 1 and 2".</p>
<p>Define $c(n)$ to be the maximum number of $n\times n$ binary matrices that can be found such that no two are equivalent. For example, $c(3)=3$. You are also given that $c(5)=39$ and $c(8)=656108$.</p>
<p>Find $c(20)$, and give your answer modulo $1\,001\,001\,011$.</p> | 695577663 | Saturday, 5th May 2018, 07:00 pm | 253 | 70% | hard |
885 | Sorted Digits | For a positive integer $d$, let $f(d)$ be the number created by sorting the digits of $d$ in ascending order, removing any zeros. For example, $f(3403) = 334$.
Let $S(n)$ be the sum of $f(d)$ for all positive integers $d$ of $n$ digits or less. You are given $S(1) = 45$ and $S(5) = 1543545675$.
Find $S(18)$. Give your answer modulo $1123455689$. | For a positive integer $d$, let $f(d)$ be the number created by sorting the digits of $d$ in ascending order, removing any zeros. For example, $f(3403) = 334$.
Let $S(n)$ be the sum of $f(d)$ for all positive integers $d$ of $n$ digits or less. You are given $S(1) = 45$ and $S(5) = 1543545675$.
Find $S(18)$. Give your answer modulo $1123455689$. | <p>
For a positive integer $d$, let $f(d)$ be the number created by sorting the digits of $d$ in ascending order, removing any zeros. For example, $f(3403) = 334$.</p>
<p>
Let $S(n)$ be the sum of $f(d)$ for all positive integers $d$ of $n$ digits or less. You are given $S(1) = 45$ and $S(5) = 1543545675$.</p>
<p>
Find $S(18)$. Give your answer modulo $1123455689$.</p> | 827850196 | Sunday, 7th April 2024, 11:00 am | 899 | 10% | easy |
538 | Maximum Quadrilaterals | Consider a positive integer sequence $S = (s_1, s_2, \dots, s_n)$.
Let $f(S)$ be the perimeter of the maximum-area quadrilateral whose side lengths are $4$ elements $(s_i, s_j, s_k, s_l)$ of $S$ (all $i, j, k, l$ distinct). If there are many quadrilaterals with the same maximum area, then choose the one with the largest perimeter.
For example, if $S = (8, 9, 14, 9, 27)$, then we can take the elements $(9, 14, 9, 27)$ and form an isosceles trapeziumAn isosceles trapezium (US: trapezoid) is a quadrilateral where one pair of opposite sides are parallel and of different lengths, and the other pair has the same length. with parallel side lengths $14$ and $27$ and both leg lengths $9$. The area of this quadrilateral is $127.611470879\cdots$ It can be shown that this is the largest area for any quadrilateral that can be formed using side lengths from $S$. Therefore, $f(S) = 9 + 14 + 9 + 27 = 59$.
Let $u_n = 2^{B(3n)} + 3^{B(2n)} + B(n + 1)$, where $B(k)$ is the number of $1$ bits of $k$ in base $2$.
For example, $B(6) = 2$, $B(10) = 2$ and $B(15) = 4$, and $u_5 = 2^4 + 3^2 + 2 = 27$.
Also, let $U_n$ be the sequence $(u_1, u_2, \dots, u_n)$.
For example, $U_{10} = (8, 9, 14, 9, 27, 16, 36, 9, 27, 28)$.
It can be shown that $f(U_5) = 59$, $f(U_{10}) = 118$, $f(U_{150}) = 3223$.
It can also be shown that $\sum f(U_n) = 234761$ for $4 \le n \le 150$.
Find $\sum f(U_n)$ for $4 \le n \le 3\,000\,000$. | Consider a positive integer sequence $S = (s_1, s_2, \dots, s_n)$.
Let $f(S)$ be the perimeter of the maximum-area quadrilateral whose side lengths are $4$ elements $(s_i, s_j, s_k, s_l)$ of $S$ (all $i, j, k, l$ distinct). If there are many quadrilaterals with the same maximum area, then choose the one with the largest perimeter.
For example, if $S = (8, 9, 14, 9, 27)$, then we can take the elements $(9, 14, 9, 27)$ and form an isosceles trapeziumAn isosceles trapezium (US: trapezoid) is a quadrilateral where one pair of opposite sides are parallel and of different lengths, and the other pair has the same length. with parallel side lengths $14$ and $27$ and both leg lengths $9$. The area of this quadrilateral is $127.611470879\cdots$ It can be shown that this is the largest area for any quadrilateral that can be formed using side lengths from $S$. Therefore, $f(S) = 9 + 14 + 9 + 27 = 59$.
Let $u_n = 2^{B(3n)} + 3^{B(2n)} + B(n + 1)$, where $B(k)$ is the number of $1$ bits of $k$ in base $2$.
For example, $B(6) = 2$, $B(10) = 2$ and $B(15) = 4$, and $u_5 = 2^4 + 3^2 + 2 = 27$.
Also, let $U_n$ be the sequence $(u_1, u_2, \dots, u_n)$.
For example, $U_{10} = (8, 9, 14, 9, 27, 16, 36, 9, 27, 28)$.
It can be shown that $f(U_5) = 59$, $f(U_{10}) = 118$, $f(U_{150}) = 3223$.
It can also be shown that $\sum f(U_n) = 234761$ for $4 \le n \le 150$.
Find $\sum f(U_n)$ for $4 \le n \le 3\,000\,000$. | <p>Consider a positive integer sequence $S = (s_1, s_2, \dots, s_n)$.</p>
<p>Let $f(S)$ be the perimeter of the maximum-area quadrilateral whose side lengths are $4$ elements $(s_i, s_j, s_k, s_l)$ of $S$ (all $i, j, k, l$ distinct). If there are many quadrilaterals with the same maximum area, then choose the one with the largest perimeter.</p>
<p>For example, if $S = (8, 9, 14, 9, 27)$, then we can take the elements $(9, 14, 9, 27)$ and form an <strong class="tooltip">isosceles trapezium<span class="tooltiptext">An isosceles trapezium (US: trapezoid) is a quadrilateral where one pair of opposite sides are parallel and of different lengths, and the other pair has the same length.</span></strong> with parallel side lengths $14$ and $27$ and both leg lengths $9$. The area of this quadrilateral is $127.611470879\cdots$ It can be shown that this is the largest area for any quadrilateral that can be formed using side lengths from $S$. Therefore, $f(S) = 9 + 14 + 9 + 27 = 59$.</p>
<p>Let $u_n = 2^{B(3n)} + 3^{B(2n)} + B(n + 1)$, where $B(k)$ is the number of $1$ bits of $k$ in base $2$.<br/>
For example, $B(6) = 2$, $B(10) = 2$ and $B(15) = 4$, and $u_5 = 2^4 + 3^2 + 2 = 27$.</p>
<p>Also, let $U_n$ be the sequence $(u_1, u_2, \dots, u_n)$.<br/>
For example, $U_{10} = (8, 9, 14, 9, 27, 16, 36, 9, 27, 28)$.</p>
<p>It can be shown that $f(U_5) = 59$, $f(U_{10}) = 118$, $f(U_{150}) = 3223$.<br/>
It can also be shown that $\sum f(U_n) = 234761$ for $4 \le n \le 150$.<br/>
Find $\sum f(U_n)$ for $4 \le n \le 3\,000\,000$.</p> | 22472871503401097 | Sunday, 13th December 2015, 01:00 am | 360 | 40% | medium |
605 | Pairwise Coin-Tossing Game | Consider an $n$-player game played in consecutive pairs: Round $1$ takes place between players $1$ and $2$, round $2$ takes place between players $2$ and $3$, and so on and so forth, all the way up to round $n$, which takes place between players $n$ and $1$. Then round $n+1$ takes place between players $1$ and $2$ as the entire cycle starts again.
In other words, during round $r$, player $((r-1) \bmod n) + 1$ faces off against player $(r \bmod n) + 1$.
During each round, a fair coin is tossed to decide which of the two players wins that round. If any given player wins both rounds $r$ and $r+1$, then that player wins the entire game.
Let $P_n(k)$ be the probability that player $k$ wins in an $n$-player game, in the form of a reduced fraction. For example, $P_3(1) = 12/49$ and $P_6(2) = 368/1323$.
Let $M_n(k)$ be the product of the reduced numerator and denominator of $P_n(k)$. For example, $M_3(1) = 588$ and $M_6(2) = 486864$.
Find the last $8$ digits of $M_{10^8+7}(10^4+7)$. | Consider an $n$-player game played in consecutive pairs: Round $1$ takes place between players $1$ and $2$, round $2$ takes place between players $2$ and $3$, and so on and so forth, all the way up to round $n$, which takes place between players $n$ and $1$. Then round $n+1$ takes place between players $1$ and $2$ as the entire cycle starts again.
In other words, during round $r$, player $((r-1) \bmod n) + 1$ faces off against player $(r \bmod n) + 1$.
During each round, a fair coin is tossed to decide which of the two players wins that round. If any given player wins both rounds $r$ and $r+1$, then that player wins the entire game.
Let $P_n(k)$ be the probability that player $k$ wins in an $n$-player game, in the form of a reduced fraction. For example, $P_3(1) = 12/49$ and $P_6(2) = 368/1323$.
Let $M_n(k)$ be the product of the reduced numerator and denominator of $P_n(k)$. For example, $M_3(1) = 588$ and $M_6(2) = 486864$.
Find the last $8$ digits of $M_{10^8+7}(10^4+7)$. | <p>Consider an $n$-player game played in consecutive pairs: Round $1$ takes place between players $1$ and $2$, round $2$ takes place between players $2$ and $3$, and so on and so forth, all the way up to round $n$, which takes place between players $n$ and $1$. Then round $n+1$ takes place between players $1$ and $2$ as the entire cycle starts again.</p>
<p>In other words, during round $r$, player $((r-1) \bmod n) + 1$ faces off against player $(r \bmod n) + 1$.</p>
<p>During each round, a fair coin is tossed to decide which of the two players wins that round. If any given player wins both rounds $r$ and $r+1$, then that player wins the entire game.</p>
<p>Let $P_n(k)$ be the probability that player $k$ wins in an $n$-player game, in the form of a reduced fraction. For example, $P_3(1) = 12/49$ and $P_6(2) = 368/1323$.</p>
<p>Let $M_n(k)$ be the product of the reduced numerator and denominator of $P_n(k)$. For example, $M_3(1) = 588$ and $M_6(2) = 486864$.</p>
<p>Find the last $8$ digits of $M_{10^8+7}(10^4+7)$.</p> | 59992576 | Sunday, 28th May 2017, 07:00 am | 938 | 25% | easy |
359 | Hilbert's New Hotel | An infinite number of people (numbered $1$, $2$, $3$, etc.) are lined up to get a room at Hilbert's newest infinite hotel. The hotel contains an infinite number of floors (numbered $1$, $2$, $3$, etc.), and each floor contains an infinite number of rooms (numbered $1$, $2$, $3$, etc.).
Initially the hotel is empty. Hilbert declares a rule on how the $n$th person is assigned a room: person $n$ gets the first vacant room in the lowest numbered floor satisfying either of the following:
the floor is empty
the floor is not empty, and if the latest person taking a room in that floor is person $m$, then $m + n$ is a perfect square
Person $1$ gets room $1$ in floor $1$ since floor $1$ is empty.
Person $2$ does not get room $2$ in floor $1$ since $1 + 2 = 3$ is not a perfect square.
Person $2$ instead gets room $1$ in floor $2$ since floor $2$ is empty.
Person $3$ gets room $2$ in floor $1$ since $1 + 3 = 4$ is a perfect square.
Eventually, every person in the line gets a room in the hotel.
Define $P(f, r)$ to be $n$ if person $n$ occupies room $r$ in floor $f$, and $0$ if no person occupies the room. Here are a few examples:
$P(1, 1) = 1$
$P(1, 2) = 3$
$P(2, 1) = 2$
$P(10, 20) = 440$
$P(25, 75) = 4863$
$P(99, 100) = 19454$
Find the sum of all $P(f, r)$ for all positive $f$ and $r$ such that $f \times r = 71328803586048$ and give the last $8$ digits as your answer. | An infinite number of people (numbered $1$, $2$, $3$, etc.) are lined up to get a room at Hilbert's newest infinite hotel. The hotel contains an infinite number of floors (numbered $1$, $2$, $3$, etc.), and each floor contains an infinite number of rooms (numbered $1$, $2$, $3$, etc.).
Initially the hotel is empty. Hilbert declares a rule on how the $n$th person is assigned a room: person $n$ gets the first vacant room in the lowest numbered floor satisfying either of the following:
the floor is empty
the floor is not empty, and if the latest person taking a room in that floor is person $m$, then $m + n$ is a perfect square
Person $1$ gets room $1$ in floor $1$ since floor $1$ is empty.
Person $2$ does not get room $2$ in floor $1$ since $1 + 2 = 3$ is not a perfect square.
Person $2$ instead gets room $1$ in floor $2$ since floor $2$ is empty.
Person $3$ gets room $2$ in floor $1$ since $1 + 3 = 4$ is a perfect square.
Eventually, every person in the line gets a room in the hotel.
Define $P(f, r)$ to be $n$ if person $n$ occupies room $r$ in floor $f$, and $0$ if no person occupies the room. Here are a few examples:
$P(1, 1) = 1$
$P(1, 2) = 3$
$P(2, 1) = 2$
$P(10, 20) = 440$
$P(25, 75) = 4863$
$P(99, 100) = 19454$
Find the sum of all $P(f, r)$ for all positive $f$ and $r$ such that $f \times r = 71328803586048$ and give the last $8$ digits as your answer. | <p>
An infinite number of people (numbered $1$, $2$, $3$, etc.) are lined up to get a room at Hilbert's newest infinite hotel. The hotel contains an infinite number of floors (numbered $1$, $2$, $3$, etc.), and each floor contains an infinite number of rooms (numbered $1$, $2$, $3$, etc.).
</p>
<p>
Initially the hotel is empty. Hilbert declares a rule on how the $n$<sup>th</sup> person is assigned a room: person $n$ gets the first vacant room in the lowest numbered floor satisfying either of the following:
</p><ul><li>the floor is empty</li>
<li>the floor is not empty, and if the latest person taking a room in that floor is person $m$, then $m + n$ is a perfect square</li>
</ul><p>
Person $1$ gets room $1$ in floor $1$ since floor $1$ is empty.
<br/>Person $2$ does not get room $2$ in floor $1$ since $1 + 2 = 3$ is not a perfect square.
<br/>Person $2$ instead gets room $1$ in floor $2$ since floor $2$ is empty.
<br/>Person $3$ gets room $2$ in floor $1$ since $1 + 3 = 4$ is a perfect square.
</p>
<p>
Eventually, every person in the line gets a room in the hotel.
</p>
<p>
Define $P(f, r)$ to be $n$ if person $n$ occupies room $r$ in floor $f$, and $0$ if no person occupies the room. Here are a few examples:
<br/>$P(1, 1) = 1$
<br/>$P(1, 2) = 3$
<br/>$P(2, 1) = 2$
<br/>$P(10, 20) = 440$
<br/>$P(25, 75) = 4863$
<br/>$P(99, 100) = 19454$
</p>
<p>
Find the sum of all $P(f, r)$ for all positive $f$ and $r$ such that $f \times r = 71328803586048$ and give the last $8$ digits as your answer.
</p> | 40632119 | Saturday, 19th November 2011, 10:00 pm | 1694 | 25% | easy |
657 | Incomplete Words | In the context of formal languages, any finite sequence of letters of a given alphabet $\Sigma$ is called a word over $\Sigma$. We call a word incomplete if it does not contain every letter of $\Sigma$.
For example, using the alphabet $\Sigma=\{ a, b, c\}$, '$ab$', '$abab$' and '$\,$' (the empty word) are incomplete words over $\Sigma$, while '$abac$' is a complete word over $\Sigma$.
Given an alphabet $\Sigma$ of $\alpha$ letters, we define $I(\alpha,n)$ to be the number of incomplete words over $\Sigma$ with a length not exceeding $n$.
For example, $I(3,0)=1$, $I(3,2)=13$ and $I(3,4)=79$.
Find $I(10^7,10^{12})$. Give your answer modulo $1\,000\,000\,007$. | In the context of formal languages, any finite sequence of letters of a given alphabet $\Sigma$ is called a word over $\Sigma$. We call a word incomplete if it does not contain every letter of $\Sigma$.
For example, using the alphabet $\Sigma=\{ a, b, c\}$, '$ab$', '$abab$' and '$\,$' (the empty word) are incomplete words over $\Sigma$, while '$abac$' is a complete word over $\Sigma$.
Given an alphabet $\Sigma$ of $\alpha$ letters, we define $I(\alpha,n)$ to be the number of incomplete words over $\Sigma$ with a length not exceeding $n$.
For example, $I(3,0)=1$, $I(3,2)=13$ and $I(3,4)=79$.
Find $I(10^7,10^{12})$. Give your answer modulo $1\,000\,000\,007$. | <p>In the context of <strong>formal languages</strong>, any finite sequence of letters of a given <strong>alphabet</strong> $\Sigma$ is called a <strong>word</strong> over $\Sigma$. We call a word <dfn>incomplete</dfn> if it does not contain every letter of $\Sigma$.</p>
<p>
For example, using the alphabet $\Sigma=\{ a, b, c\}$, '$ab$', '$abab$' and '$\,$' (the empty word) are incomplete words over $\Sigma$, while '$abac$' is a complete word over $\Sigma$.</p>
<p>
Given an alphabet $\Sigma$ of $\alpha$ letters, we define $I(\alpha,n)$ to be the number of incomplete words over $\Sigma$ with a length not exceeding $n$. <br/>
For example, $I(3,0)=1$, $I(3,2)=13$ and $I(3,4)=79$.</p>
<p>
Find $I(10^7,10^{12})$. Give your answer modulo $1\,000\,000\,007$.</p> | 219493139 | Saturday, 23rd February 2019, 01:00 pm | 618 | 30% | easy |
490 | Jumping Frog | There are $n$ stones in a pond, numbered $1$ to $n$. Consecutive stones are spaced one unit apart.
A frog sits on stone $1$. He wishes to visit each stone exactly once, stopping on stone $n$. However, he can only jump from one stone to another if they are at most $3$ units apart. In other words, from stone $i$, he can reach a stone $j$ if $1 \le j \le n$ and $j$ is in the set $\{i-3, i-2, i-1, i+1, i+2, i+3\}$.
Let $f(n)$ be the number of ways he can do this. For example, $f(6) = 14$, as shown below:
$1 \to 2 \to 3 \to 4 \to 5 \to 6$
$1 \to 2 \to 3 \to 5 \to 4 \to 6$
$1 \to 2 \to 4 \to 3 \to 5 \to 6$
$1 \to 2 \to 4 \to 5 \to 3 \to 6$
$1 \to 2 \to 5 \to 3 \to 4 \to 6$
$1 \to 2 \to 5 \to 4 \to 3 \to 6$
$1 \to 3 \to 2 \to 4 \to 5 \to 6$
$1 \to 3 \to 2 \to 5 \to 4 \to 6$
$1 \to 3 \to 4 \to 2 \to 5 \to 6$
$1 \to 3 \to 5 \to 2 \to 4 \to 6$
$1 \to 4 \to 2 \to 3 \to 5 \to 6$
$1 \to 4 \to 2 \to 5 \to 3 \to 6$
$1 \to 4 \to 3 \to 2 \to 5 \to 6$
$1 \to 4 \to 5 \to 2 \to 3 \to 6$
Other examples are $f(10) = 254$ and $f(40) = 1439682432976$.
Let $S(L) = \sum f(n)^3$ for $1 \le n \le L$.
Examples:
$S(10) = 18230635$
$S(20) = 104207881192114219$
$S(1\,000) \bmod 10^9 = 225031475$
$S(1\,000\,000) \bmod 10^9 = 363486179$
Find $S(10^{14}) \bmod 10^9$. | There are $n$ stones in a pond, numbered $1$ to $n$. Consecutive stones are spaced one unit apart.
A frog sits on stone $1$. He wishes to visit each stone exactly once, stopping on stone $n$. However, he can only jump from one stone to another if they are at most $3$ units apart. In other words, from stone $i$, he can reach a stone $j$ if $1 \le j \le n$ and $j$ is in the set $\{i-3, i-2, i-1, i+1, i+2, i+3\}$.
Let $f(n)$ be the number of ways he can do this. For example, $f(6) = 14$, as shown below:
$1 \to 2 \to 3 \to 4 \to 5 \to 6$
$1 \to 2 \to 3 \to 5 \to 4 \to 6$
$1 \to 2 \to 4 \to 3 \to 5 \to 6$
$1 \to 2 \to 4 \to 5 \to 3 \to 6$
$1 \to 2 \to 5 \to 3 \to 4 \to 6$
$1 \to 2 \to 5 \to 4 \to 3 \to 6$
$1 \to 3 \to 2 \to 4 \to 5 \to 6$
$1 \to 3 \to 2 \to 5 \to 4 \to 6$
$1 \to 3 \to 4 \to 2 \to 5 \to 6$
$1 \to 3 \to 5 \to 2 \to 4 \to 6$
$1 \to 4 \to 2 \to 3 \to 5 \to 6$
$1 \to 4 \to 2 \to 5 \to 3 \to 6$
$1 \to 4 \to 3 \to 2 \to 5 \to 6$
$1 \to 4 \to 5 \to 2 \to 3 \to 6$
Other examples are $f(10) = 254$ and $f(40) = 1439682432976$.
Let $S(L) = \sum f(n)^3$ for $1 \le n \le L$.
Examples:
$S(10) = 18230635$
$S(20) = 104207881192114219$
$S(1\,000) \bmod 10^9 = 225031475$
$S(1\,000\,000) \bmod 10^9 = 363486179$
Find $S(10^{14}) \bmod 10^9$. | <p>There are $n$ stones in a pond, numbered $1$ to $n$. Consecutive stones are spaced one unit apart.</p>
<p>A frog sits on stone $1$. He wishes to visit each stone exactly once, stopping on stone $n$. However, he can only jump from one stone to another if they are at most $3$ units apart. In other words, from stone $i$, he can reach a stone $j$ if $1 \le j \le n$ and $j$ is in the set $\{i-3, i-2, i-1, i+1, i+2, i+3\}$.</p>
<p>Let $f(n)$ be the number of ways he can do this. For example, $f(6) = 14$, as shown below:<br/>
$1 \to 2 \to 3 \to 4 \to 5 \to 6$ <br/>
$1 \to 2 \to 3 \to 5 \to 4 \to 6$ <br/>
$1 \to 2 \to 4 \to 3 \to 5 \to 6$ <br/>
$1 \to 2 \to 4 \to 5 \to 3 \to 6$ <br/>
$1 \to 2 \to 5 \to 3 \to 4 \to 6$ <br/>
$1 \to 2 \to 5 \to 4 \to 3 \to 6$ <br/>
$1 \to 3 \to 2 \to 4 \to 5 \to 6$ <br/>
$1 \to 3 \to 2 \to 5 \to 4 \to 6$ <br/>
$1 \to 3 \to 4 \to 2 \to 5 \to 6$ <br/>
$1 \to 3 \to 5 \to 2 \to 4 \to 6$ <br/>
$1 \to 4 \to 2 \to 3 \to 5 \to 6$ <br/>
$1 \to 4 \to 2 \to 5 \to 3 \to 6$ <br/>
$1 \to 4 \to 3 \to 2 \to 5 \to 6$ <br/>
$1 \to 4 \to 5 \to 2 \to 3 \to 6$</p>
<p>Other examples are $f(10) = 254$ and $f(40) = 1439682432976$.</p>
<p>Let $S(L) = \sum f(n)^3$ for $1 \le n \le L$.<br/>
Examples:<br/>
$S(10) = 18230635$<br/>
$S(20) = 104207881192114219$<br/>
$S(1\,000) \bmod 10^9 = 225031475$<br/>
$S(1\,000\,000) \bmod 10^9 = 363486179$</p>
<p>Find $S(10^{14}) \bmod 10^9$.</p> | 777577686 | Sunday, 23rd November 2014, 07:00 am | 351 | 95% | hard |
234 | Semidivisible Numbers | For an integer $n \ge 4$, we define the lower prime square root of $n$, denoted by $\operatorname{lps}(n)$, as the largest prime $\le \sqrt n$ and the upper prime square root of $n$, $\operatorname{ups}(n)$, as the smallest prime $\ge \sqrt n$.
So, for example, $\operatorname{lps}(4) = 2 = \operatorname{ups}(4)$, $\operatorname{lps}(1000) = 31$, $\operatorname{ups}(1000) = 37$.
Let us call an integer $n \ge 4$ semidivisible, if one of $\operatorname{lps}(n)$ and $\operatorname{ups}(n)$ divides $n$, but not both.
The sum of the semidivisible numbers not exceeding $15$ is $30$, the numbers are $8$, $10$ and $12$. $15$ is not semidivisible because it is a multiple of both $\operatorname{lps}(15) = 3$ and $\operatorname{ups}(15) = 5$.
As a further example, the sum of the $92$ semidivisible numbers up to $1000$ is $34825$.
What is the sum of all semidivisible numbers not exceeding $999966663333$? | For an integer $n \ge 4$, we define the lower prime square root of $n$, denoted by $\operatorname{lps}(n)$, as the largest prime $\le \sqrt n$ and the upper prime square root of $n$, $\operatorname{ups}(n)$, as the smallest prime $\ge \sqrt n$.
So, for example, $\operatorname{lps}(4) = 2 = \operatorname{ups}(4)$, $\operatorname{lps}(1000) = 31$, $\operatorname{ups}(1000) = 37$.
Let us call an integer $n \ge 4$ semidivisible, if one of $\operatorname{lps}(n)$ and $\operatorname{ups}(n)$ divides $n$, but not both.
The sum of the semidivisible numbers not exceeding $15$ is $30$, the numbers are $8$, $10$ and $12$. $15$ is not semidivisible because it is a multiple of both $\operatorname{lps}(15) = 3$ and $\operatorname{ups}(15) = 5$.
As a further example, the sum of the $92$ semidivisible numbers up to $1000$ is $34825$.
What is the sum of all semidivisible numbers not exceeding $999966663333$? | <p>For an integer $n \ge 4$, we define the <dfn>lower prime square root</dfn> of $n$, denoted by $\operatorname{lps}(n)$, as the largest prime $\le \sqrt n$ and the <dfn>upper prime square root</dfn> of $n$, $\operatorname{ups}(n)$, as the smallest prime $\ge \sqrt n$.</p>
<p>So, for example, $\operatorname{lps}(4) = 2 = \operatorname{ups}(4)$, $\operatorname{lps}(1000) = 31$, $\operatorname{ups}(1000) = 37$.<br/>
Let us call an integer $n \ge 4$ <dfn>semidivisible</dfn>, if one of $\operatorname{lps}(n)$ and $\operatorname{ups}(n)$ divides $n$, but not both.</p>
<p>The sum of the semidivisible numbers not exceeding $15$ is $30$, the numbers are $8$, $10$ and $12$.<br/> $15$ is not semidivisible because it is a multiple of both $\operatorname{lps}(15) = 3$ and $\operatorname{ups}(15) = 5$.<br/>
As a further example, the sum of the $92$ semidivisible numbers up to $1000$ is $34825$.</p>
<p>What is the sum of all semidivisible numbers not exceeding $999966663333$?</p> | 1259187438574927161 | Saturday, 28th February 2009, 01:00 am | 3538 | 50% | medium |
110 | Diophantine Reciprocals II | In the following equation $x$, $y$, and $n$ are positive integers.
$$\dfrac{1}{x} + \dfrac{1}{y} = \dfrac{1}{n}$$
It can be verified that when $n = 1260$ there are $113$ distinct solutions and this is the least value of $n$ for which the total number of distinct solutions exceeds one hundred.
What is the least value of $n$ for which the number of distinct solutions exceeds four million?
NOTE: This problem is a much more difficult version of Problem 108 and as it is well beyond the limitations of a brute force approach it requires a clever implementation. | In the following equation $x$, $y$, and $n$ are positive integers.
$$\dfrac{1}{x} + \dfrac{1}{y} = \dfrac{1}{n}$$
It can be verified that when $n = 1260$ there are $113$ distinct solutions and this is the least value of $n$ for which the total number of distinct solutions exceeds one hundred.
What is the least value of $n$ for which the number of distinct solutions exceeds four million?
NOTE: This problem is a much more difficult version of Problem 108 and as it is well beyond the limitations of a brute force approach it requires a clever implementation. | <p>In the following equation $x$, $y$, and $n$ are positive integers.</p>
<p>$$\dfrac{1}{x} + \dfrac{1}{y} = \dfrac{1}{n}$$</p>
<p>It can be verified that when $n = 1260$ there are $113$ distinct solutions and this is the least value of $n$ for which the total number of distinct solutions exceeds one hundred.</p>
<p>What is the least value of $n$ for which the number of distinct solutions exceeds four million?</p>
<p class="smaller">NOTE: This problem is a much more difficult version of <a href="problem=108">Problem 108</a> and as it is well beyond the limitations of a brute force approach it requires a clever implementation.</p> | 9350130049860600 | Friday, 2nd December 2005, 06:00 pm | 9144 | 40% | medium |
857 | Beautiful Graphs | A graph is made up of vertices and coloured edges.
Between every two distinct vertices there must be exactly one of the following:
A red directed edge one way, and a blue directed edge the other way
A green undirected edge
A brown undirected edge
Such a graph is called beautiful if
A cycle of edges contains a red edge if and only if it also contains a blue edge
No triangle of edges is made up of entirely green or entirely brown edges
Below are four distinct examples of beautiful graphs on three vertices:
Below are four examples of graphs that are not beautiful:
Let $G(n)$ be the number of beautiful graphs on the labelled vertices: $1,2,\ldots,n$.
You are given $G(3)=24$, $G(4)=186$ and $G(15)=12472315010483328$.
Find $G(10^7)$. Give your answer modulo $10^9+7$. | A graph is made up of vertices and coloured edges.
Between every two distinct vertices there must be exactly one of the following:
A red directed edge one way, and a blue directed edge the other way
A green undirected edge
A brown undirected edge
Such a graph is called beautiful if
A cycle of edges contains a red edge if and only if it also contains a blue edge
No triangle of edges is made up of entirely green or entirely brown edges
Below are four distinct examples of beautiful graphs on three vertices:
Below are four examples of graphs that are not beautiful:
Let $G(n)$ be the number of beautiful graphs on the labelled vertices: $1,2,\ldots,n$.
You are given $G(3)=24$, $G(4)=186$ and $G(15)=12472315010483328$.
Find $G(10^7)$. Give your answer modulo $10^9+7$. | <p>
A graph is made up of vertices and coloured edges.
Between every two distinct vertices there must be exactly one of the following:</p>
<ul>
<li>A red directed edge one way, and a blue directed edge the other way</li>
<li>A green undirected edge</li>
<li>A brown undirected edge</li>
</ul>
Such a graph is called <i>beautiful</i> if
<ul>
<li>A cycle of edges contains a red edge <b>if and only if</b> it also contains a blue edge</li>
<li>No triangle of edges is made up of entirely green or entirely brown edges</li>
</ul>
<p>
Below are four distinct examples of beautiful graphs on three vertices:
</p>
<img alt="0857_GoodGraphs.jpg" src="resources/images/0857_GoodGraphs.jpg?1692412187"/>
<p>
Below are four examples of graphs that are not beautiful:</p>
<img alt="0857_BadGraphs.jpg" src="resources/images/0857_BadGraphs.jpg?1692412205"/>
<p>
Let $G(n)$ be the number of beautiful graphs on the labelled vertices: $1,2,\ldots,n$.
You are given $G(3)=24$, $G(4)=186$ and $G(15)=12472315010483328$.</p>
<p>
Find $G(10^7)$. Give your answer modulo $10^9+7$.</p> | 966332096 | Sunday, 1st October 2023, 02:00 am | 188 | 60% | hard |
413 | One-child Numbers | We say that a $d$-digit positive number (no leading zeros) is a one-child number if exactly one of its sub-strings is divisible by $d$.
For example, $5671$ is a $4$-digit one-child number. Among all its sub-strings $5$, $6$, $7$, $1$, $56$, $67$, $71$, $567$, $671$ and $5671$, only $56$ is divisible by $4$.
Similarly, $104$ is a $3$-digit one-child number because only $0$ is divisible by $3$.
$1132451$ is a $7$-digit one-child number because only $245$ is divisible by $7$.
Let $F(N)$ be the number of the one-child numbers less than $N$.
We can verify that $F(10) = 9$, $F(10^3) = 389$ and $F(10^7) = 277674$.
Find $F(10^{19})$. | We say that a $d$-digit positive number (no leading zeros) is a one-child number if exactly one of its sub-strings is divisible by $d$.
For example, $5671$ is a $4$-digit one-child number. Among all its sub-strings $5$, $6$, $7$, $1$, $56$, $67$, $71$, $567$, $671$ and $5671$, only $56$ is divisible by $4$.
Similarly, $104$ is a $3$-digit one-child number because only $0$ is divisible by $3$.
$1132451$ is a $7$-digit one-child number because only $245$ is divisible by $7$.
Let $F(N)$ be the number of the one-child numbers less than $N$.
We can verify that $F(10) = 9$, $F(10^3) = 389$ and $F(10^7) = 277674$.
Find $F(10^{19})$. | <p>We say that a $d$-digit positive number (no leading zeros) is a one-child number if exactly one of its sub-strings is divisible by $d$.</p>
<p>For example, $5671$ is a $4$-digit one-child number. Among all its sub-strings $5$, $6$, $7$, $1$, $56$, $67$, $71$, $567$, $671$ and $5671$, only $56$ is divisible by $4$.<br/>
Similarly, $104$ is a $3$-digit one-child number because only $0$ is divisible by $3$.<br/>
$1132451$ is a $7$-digit one-child number because only $245$ is divisible by $7$.</p>
<p>Let $F(N)$ be the number of the one-child numbers less than $N$.<br/>
We can verify that $F(10) = 9$, $F(10^3) = 389$ and $F(10^7) = 277674$.</p>
<p>Find $F(10^{19})$.</p> | 3079418648040719 | Sunday, 3rd February 2013, 04:00 am | 440 | 75% | hard |
292 | Pythagorean Polygons | We shall define a pythagorean polygon to be a convex polygon with the following properties:there are at least three vertices,
no three vertices are aligned,
each vertex has integer coordinates,
each edge has integer length.For a given integer $n$, define $P(n)$ as the number of distinct pythagorean polygons for which the perimeter is $\le n$.
Pythagorean polygons should be considered distinct as long as none is a translation of another.
You are given that $P(4) = 1$, $P(30) = 3655$ and $P(60) = 891045$.
Find $P(120)$. | We shall define a pythagorean polygon to be a convex polygon with the following properties:there are at least three vertices,
no three vertices are aligned,
each vertex has integer coordinates,
each edge has integer length.For a given integer $n$, define $P(n)$ as the number of distinct pythagorean polygons for which the perimeter is $\le n$.
Pythagorean polygons should be considered distinct as long as none is a translation of another.
You are given that $P(4) = 1$, $P(30) = 3655$ and $P(60) = 891045$.
Find $P(120)$. | <p>We shall define a <dfn>pythagorean polygon</dfn> to be a <strong>convex polygon</strong> with the following properties:<br/></p><ul><li>there are at least three vertices,</li>
<li>no three vertices are aligned,</li>
<li>each vertex has <b>integer coordinates</b>,</li>
<li>each edge has <b>integer length</b>.</li></ul><p>For a given integer $n$, define $P(n)$ as the number of distinct pythagorean polygons for which the perimeter is $\le n$.<br/>
Pythagorean polygons should be considered distinct as long as none is a translation of another.</p>
<p>You are given that $P(4) = 1$, $P(30) = 3655$ and $P(60) = 891045$.<br/>
Find $P(120)$.</p> | 3600060866 | Saturday, 15th May 2010, 01:00 am | 640 | 65% | hard |
182 | RSA Encryption | The RSA encryption is based on the following procedure:
Generate two distinct primes $p$ and $q$.Compute $n = pq$ and $\phi = (p - 1)(q - 1)$.
Find an integer $e$, $1 \lt e \lt \phi$, such that $\gcd(e, \phi) = 1$.
A message in this system is a number in the interval $[0, n - 1]$.
A text to be encrypted is then somehow converted to messages (numbers in the interval $[0, n - 1]$).
To encrypt the text, for each message, $m$, $c = m^e \bmod n$ is calculated.
To decrypt the text, the following procedure is needed: calculate $d$ such that $ed = 1 \bmod \phi$, then for each encrypted message, $c$, calculate $m = c^d \bmod n$.
There exist values of $e$ and $m$ such that $m^e \bmod n = m$.We call messages $m$ for which $m^e \bmod n = m$ unconcealed messages.
An issue when choosing $e$ is that there should not be too many unconcealed messages.For instance, let $p = 19$ and $q = 37$.
Then $n = 19 \cdot 37 = 703$ and $\phi = 18 \cdot 36 = 648$.
If we choose $e = 181$, then, although $\gcd(181,648) = 1$ it turns out that all possible messages $m$ ($0 \le m \le n - 1$) are unconcealed when calculating $m^e \bmod n$.
For any valid choice of $e$ there exist some unconcealed messages.
It's important that the number of unconcealed messages is at a minimum.
Choose $p = 1009$ and $q = 3643$.
Find the sum of all values of $e$, $1 \lt e \lt \phi(1009,3643)$ and $\gcd(e, \phi) = 1$, so that the number of unconcealed messages for this value of $e$ is at a minimum. | The RSA encryption is based on the following procedure:
Generate two distinct primes $p$ and $q$.Compute $n = pq$ and $\phi = (p - 1)(q - 1)$.
Find an integer $e$, $1 \lt e \lt \phi$, such that $\gcd(e, \phi) = 1$.
A message in this system is a number in the interval $[0, n - 1]$.
A text to be encrypted is then somehow converted to messages (numbers in the interval $[0, n - 1]$).
To encrypt the text, for each message, $m$, $c = m^e \bmod n$ is calculated.
To decrypt the text, the following procedure is needed: calculate $d$ such that $ed = 1 \bmod \phi$, then for each encrypted message, $c$, calculate $m = c^d \bmod n$.
There exist values of $e$ and $m$ such that $m^e \bmod n = m$.We call messages $m$ for which $m^e \bmod n = m$ unconcealed messages.
An issue when choosing $e$ is that there should not be too many unconcealed messages.For instance, let $p = 19$ and $q = 37$.
Then $n = 19 \cdot 37 = 703$ and $\phi = 18 \cdot 36 = 648$.
If we choose $e = 181$, then, although $\gcd(181,648) = 1$ it turns out that all possible messages $m$ ($0 \le m \le n - 1$) are unconcealed when calculating $m^e \bmod n$.
For any valid choice of $e$ there exist some unconcealed messages.
It's important that the number of unconcealed messages is at a minimum.
Choose $p = 1009$ and $q = 3643$.
Find the sum of all values of $e$, $1 \lt e \lt \phi(1009,3643)$ and $\gcd(e, \phi) = 1$, so that the number of unconcealed messages for this value of $e$ is at a minimum. | <p>The RSA encryption is based on the following procedure:</p>
<p>Generate two distinct primes $p$ and $q$.<br/>Compute $n = pq$ and $\phi = (p - 1)(q - 1)$.<br/>
Find an integer $e$, $1 \lt e \lt \phi$, such that $\gcd(e, \phi) = 1$.</p>
<p>A message in this system is a number in the interval $[0, n - 1]$.<br/>
A text to be encrypted is then somehow converted to messages (numbers in the interval $[0, n - 1]$).<br/>
To encrypt the text, for each message, $m$, $c = m^e \bmod n$ is calculated.</p>
<p>To decrypt the text, the following procedure is needed: calculate $d$ such that $ed = 1 \bmod \phi$, then for each encrypted message, $c$, calculate $m = c^d \bmod n$.</p>
<p>There exist values of $e$ and $m$ such that $m^e \bmod n = m$.<br/>We call messages $m$ for which $m^e \bmod n = m$ unconcealed messages.</p>
<p>An issue when choosing $e$ is that there should not be too many unconcealed messages.<br/>For instance, let $p = 19$ and $q = 37$.<br/>
Then $n = 19 \cdot 37 = 703$ and $\phi = 18 \cdot 36 = 648$.<br/>
If we choose $e = 181$, then, although $\gcd(181,648) = 1$ it turns out that all possible messages $m$ ($0 \le m \le n - 1$) are unconcealed when calculating $m^e \bmod n$.<br/>
For any valid choice of $e$ there exist some unconcealed messages.<br/>
It's important that the number of unconcealed messages is at a minimum.</p>
<p>Choose $p = 1009$ and $q = 3643$.<br/>
Find the sum of all values of $e$, $1 \lt e \lt \phi(1009,3643)$ and $\gcd(e, \phi) = 1$, so that the number of unconcealed messages for this value of $e$ is at a minimum.</p> | 399788195976 | Friday, 15th February 2008, 01:00 pm | 2923 | 60% | hard |
588 | Quintinomial Coefficients | The coefficients in the expansion of $(x+1)^k$ are called binomial coefficients.
Analoguously the coefficients in the expansion of $(x^4+x^3+x^2+x+1)^k$ are called quintinomial coefficients. (quintus= Latin for fifth).
Consider the expansion of $(x^4+x^3+x^2+x+1)^3$:
$x^{12}+3x^{11}+6x^{10}+10x^9+15x^8+18x^7+19x^6+18x^5+15x^4+10x^3+6x^2+3x+1$
As we can see $7$ out of the $13$ quintinomial coefficients for $k=3$ are odd.
Let $Q(k)$ be the number of odd coefficients in the expansion of $(x^4+x^3+x^2+x+1)^k$.
So $Q(3)=7$.
You are given $Q(10)=17$ and $Q(100)=35$.
Find $\sum_{k=1}^{18}Q(10^k)$. | The coefficients in the expansion of $(x+1)^k$ are called binomial coefficients.
Analoguously the coefficients in the expansion of $(x^4+x^3+x^2+x+1)^k$ are called quintinomial coefficients. (quintus= Latin for fifth).
Consider the expansion of $(x^4+x^3+x^2+x+1)^3$:
$x^{12}+3x^{11}+6x^{10}+10x^9+15x^8+18x^7+19x^6+18x^5+15x^4+10x^3+6x^2+3x+1$
As we can see $7$ out of the $13$ quintinomial coefficients for $k=3$ are odd.
Let $Q(k)$ be the number of odd coefficients in the expansion of $(x^4+x^3+x^2+x+1)^k$.
So $Q(3)=7$.
You are given $Q(10)=17$ and $Q(100)=35$.
Find $\sum_{k=1}^{18}Q(10^k)$. | <p>
The coefficients in the expansion of $(x+1)^k$ are called <strong>binomial coefficients</strong>.<br/>
Analoguously the coefficients in the expansion of $(x^4+x^3+x^2+x+1)^k$ are called <strong>quintinomial coefficients</strong>.<br/> (quintus= Latin for fifth).
</p>
<p>
Consider the expansion of $(x^4+x^3+x^2+x+1)^3$:<br/>
$x^{12}+3x^{11}+6x^{10}+10x^9+15x^8+18x^7+19x^6+18x^5+15x^4+10x^3+6x^2+3x+1$<br/>
As we can see $7$ out of the $13$ quintinomial coefficients for $k=3$ are odd.
</p>
<p>
Let $Q(k)$ be the number of odd coefficients in the expansion of $(x^4+x^3+x^2+x+1)^k$.<br/>
So $Q(3)=7$.
</p>
<p>
You are given $Q(10)=17$ and $Q(100)=35$.
</p>
<p>Find $\sum_{k=1}^{18}Q(10^k)$.
</p> | 11651930052 | Sunday, 29th January 2017, 04:00 am | 494 | 40% | medium |
766 | Sliding Block Puzzle | A sliding block puzzle is a puzzle where pieces are confined to a grid and by sliding the pieces a final configuration is reached. In this problem the pieces can only be slid in multiples of one unit in the directions up, down, left, right.
A reachable configuration is any arrangement of the pieces that can be achieved by sliding the pieces from the initial configuration.
Two configurations are identical if the same shape pieces occupy the same position in the grid. So in the case below the red squares are indistinguishable. For this example the number of reachable configurations is $208$.
Find the number of reachable configurations for the puzzle below. Note that the red L-shaped pieces are considered different from the green L-shaped pieces. | A sliding block puzzle is a puzzle where pieces are confined to a grid and by sliding the pieces a final configuration is reached. In this problem the pieces can only be slid in multiples of one unit in the directions up, down, left, right.
A reachable configuration is any arrangement of the pieces that can be achieved by sliding the pieces from the initial configuration.
Two configurations are identical if the same shape pieces occupy the same position in the grid. So in the case below the red squares are indistinguishable. For this example the number of reachable configurations is $208$.
Find the number of reachable configurations for the puzzle below. Note that the red L-shaped pieces are considered different from the green L-shaped pieces. | <p>A <strong>sliding block puzzle</strong> is a puzzle where pieces are confined to a grid and by sliding the pieces a final configuration is reached. In this problem the pieces can only be slid in multiples of one unit in the directions up, down, left, right.</p>
<p>A <dfn>reachable configuration</dfn> is any arrangement of the pieces that can be achieved by sliding the pieces from the initial configuration.</p>
<p>Two configurations are identical if the same shape pieces occupy the same position in the grid. So in the case below the red squares are indistinguishable. For this example the number of reachable configurations is $208$.</p>
<div style="text-align:center;">
<img alt="" class="dark_img" src="resources/images/0766_SlidingBlock1.jpg?1678992055" style="height:130px;"/></div>
<p>Find the number of reachable configurations for the puzzle below. Note that the red L-shaped pieces are considered different from the green L-shaped pieces.
</p><div style="text-align:center;">
<img alt="" class="dark_img" src="resources/images/0766_SlidingBlock2.jpg?1678992055" style="height:216px;"/></div> | 2613742 | Saturday, 2nd October 2021, 11:00 pm | 350 | 35% | medium |
406 | Guessing Game | We are trying to find a hidden number selected from the set of integers $\{1, 2, \dots, n\}$ by asking questions.
Each number (question) we ask, we get one of three possible answers: "Your guess is lower than the hidden number" (and you incur a cost of $a$), or
"Your guess is higher than the hidden number" (and you incur a cost of $b$), or
"Yes, that's it!" (and the game ends).
Given the value of $n$, $a$, and $b$, an optimal strategy minimizes the total cost for the worst possible case.
For example, if $n = 5$, $a = 2$, and $b = 3$, then we may begin by asking "2" as our first question.
If we are told that 2 is higher than the hidden number (for a cost of b=3), then we are sure that "1" is the hidden number (for a total cost of 3).
If we are told that 2 is lower than the hidden number (for a cost of a=2), then our next question will be "4".
If we are told that 4 is higher than the hidden number (for a cost of b=3), then we are sure that "3" is the hidden number (for a total cost of 2+3=5).
If we are told that 4 is lower than the hidden number (for a cost of a=2), then we are sure that "5" is the hidden number (for a total cost of 2+2=4).
Thus, the worst-case cost achieved by this strategy is 5. It can also be shown that this is the lowest worst-case cost that can be achieved.
So, in fact, we have just described an optimal strategy for the given values of $n$, $a$, and $b$.
Let $C(n, a, b)$ be the worst-case cost achieved by an optimal strategy for the given values of $n$, $a$ and $b$.
Here are a few examples:
$C(5, 2, 3) = 5$
$C(500, \sqrt 2, \sqrt 3) = 13.22073197\dots$
$C(20000, 5, 7) = 82$
$C(2000000, \sqrt 5, \sqrt 7) = 49.63755955\dots$
Let $F_k$ be the Fibonacci numbers: $F_k=F_{k-1}+F_{k-2}$ with base cases $F_1=F_2= 1$.Find $\displaystyle \sum \limits_{k = 1}^{30} {C \left (10^{12}, \sqrt{k}, \sqrt{F_k} \right )}$, and give your answer rounded to 8 decimal places behind the decimal point. | We are trying to find a hidden number selected from the set of integers $\{1, 2, \dots, n\}$ by asking questions.
Each number (question) we ask, we get one of three possible answers: "Your guess is lower than the hidden number" (and you incur a cost of $a$), or
"Your guess is higher than the hidden number" (and you incur a cost of $b$), or
"Yes, that's it!" (and the game ends).
Given the value of $n$, $a$, and $b$, an optimal strategy minimizes the total cost for the worst possible case.
For example, if $n = 5$, $a = 2$, and $b = 3$, then we may begin by asking "2" as our first question.
If we are told that 2 is higher than the hidden number (for a cost of b=3), then we are sure that "1" is the hidden number (for a total cost of 3).
If we are told that 2 is lower than the hidden number (for a cost of a=2), then our next question will be "4".
If we are told that 4 is higher than the hidden number (for a cost of b=3), then we are sure that "3" is the hidden number (for a total cost of 2+3=5).
If we are told that 4 is lower than the hidden number (for a cost of a=2), then we are sure that "5" is the hidden number (for a total cost of 2+2=4).
Thus, the worst-case cost achieved by this strategy is 5. It can also be shown that this is the lowest worst-case cost that can be achieved.
So, in fact, we have just described an optimal strategy for the given values of $n$, $a$, and $b$.
Let $C(n, a, b)$ be the worst-case cost achieved by an optimal strategy for the given values of $n$, $a$ and $b$.
Here are a few examples:
$C(5, 2, 3) = 5$
$C(500, \sqrt 2, \sqrt 3) = 13.22073197\dots$
$C(20000, 5, 7) = 82$
$C(2000000, \sqrt 5, \sqrt 7) = 49.63755955\dots$
Let $F_k$ be the Fibonacci numbers: $F_k=F_{k-1}+F_{k-2}$ with base cases $F_1=F_2= 1$.Find $\displaystyle \sum \limits_{k = 1}^{30} {C \left (10^{12}, \sqrt{k}, \sqrt{F_k} \right )}$, and give your answer rounded to 8 decimal places behind the decimal point. | <p>We are trying to find a hidden number selected from the set of integers $\{1, 2, \dots, n\}$ by asking questions.
Each number (question) we ask, we get one of three possible answers:<br/></p><ul><li> "Your guess is lower than the hidden number" (and you incur a cost of $a$), or</li>
<li> "Your guess is higher than the hidden number" (and you incur a cost of $b$), or</li>
<li> "Yes, that's it!" (and the game ends).</li>
</ul><p>Given the value of $n$, $a$, and $b$, an <dfn>optimal strategy</dfn> minimizes the total cost <u>for the worst possible case</u>.</p>
<p>For example, if $n = 5$, $a = 2$, and $b = 3$, then we may begin by asking "<b>2</b>" as our first question.</p>
<p>If we are told that 2 is higher than the hidden number (for a cost of <var>b</var>=3), then we are sure that "<b>1</b>" is the hidden number (for a total cost of <span style="color:#3333ff;"><b>3</b></span>).<br/>
If we are told that 2 is lower than the hidden number (for a cost of <var>a</var>=2), then our next question will be "<b>4</b>".<br/>
If we are told that 4 is higher than the hidden number (for a cost of <var>b</var>=3), then we are sure that "<b>3</b>" is the hidden number (for a total cost of 2+3=<span style="color:#3333ff;"><b>5</b></span>).<br/>
If we are told that 4 is lower than the hidden number (for a cost of <var>a</var>=2), then we are sure that "<b>5</b>" is the hidden number (for a total cost of 2+2=<span style="color:#3333ff;"><b>4</b></span>).<br/>
Thus, the worst-case cost achieved by this strategy is <span style="color:#FF0000;"><b>5</b></span>. It can also be shown that this is the lowest worst-case cost that can be achieved.
So, in fact, we have just described an optimal strategy for the given values of $n$, $a$, and $b$.</p>
<p>Let $C(n, a, b)$ be the worst-case cost achieved by an optimal strategy for the given values of $n$, $a$ and $b$.</p>
<p>Here are a few examples:<br/>
$C(5, 2, 3) = 5$<br/>
$C(500, \sqrt 2, \sqrt 3) = 13.22073197\dots$<br/>
$C(20000, 5, 7) = 82$<br/>
$C(2000000, \sqrt 5, \sqrt 7) = 49.63755955\dots$</p>
<p>Let $F_k$ be the Fibonacci numbers: $F_k=F_{k-1}+F_{k-2}$ with base cases $F_1=F_2= 1$.<br/>Find $\displaystyle \sum \limits_{k = 1}^{30} {C \left (10^{12}, \sqrt{k}, \sqrt{F_k} \right )}$, and give your answer rounded to 8 decimal places behind the decimal point.</p> | 36813.12757207 | Sunday, 16th December 2012, 07:00 am | 430 | 50% | medium |
392 | Enmeshed Unit Circle | A rectilinear grid is an orthogonal grid where the spacing between the gridlines does not have to be equidistant.
An example of such grid is logarithmic graph paper.
Consider rectilinear grids in the Cartesian coordinate system with the following properties:The gridlines are parallel to the axes of the Cartesian coordinate system.There are $N+2$ vertical and $N+2$ horizontal gridlines. Hence there are $(N+1) \times (N+1)$ rectangular cells.The equations of the two outer vertical gridlines are $x = -1$ and $x = 1$.The equations of the two outer horizontal gridlines are $y = -1$ and $y = 1$.The grid cells are colored red if they overlap with the unit circleThe unit circle is the circle that has radius $1$ and is centered at the origin, black otherwise.For this problem we would like you to find the positions of the remaining $N$ inner horizontal and $N$ inner vertical gridlines so that the area occupied by the red cells is minimized.
E.g. here is a picture of the solution for $N = 10$:
The area occupied by the red cells for $N = 10$ rounded to $10$ digits behind the decimal point is $3.3469640797$.
Find the positions for $N = 400$.
Give as your answer the area occupied by the red cells rounded to $10$ digits behind the decimal point. | A rectilinear grid is an orthogonal grid where the spacing between the gridlines does not have to be equidistant.
An example of such grid is logarithmic graph paper.
Consider rectilinear grids in the Cartesian coordinate system with the following properties:The gridlines are parallel to the axes of the Cartesian coordinate system.There are $N+2$ vertical and $N+2$ horizontal gridlines. Hence there are $(N+1) \times (N+1)$ rectangular cells.The equations of the two outer vertical gridlines are $x = -1$ and $x = 1$.The equations of the two outer horizontal gridlines are $y = -1$ and $y = 1$.The grid cells are colored red if they overlap with the unit circleThe unit circle is the circle that has radius $1$ and is centered at the origin, black otherwise.For this problem we would like you to find the positions of the remaining $N$ inner horizontal and $N$ inner vertical gridlines so that the area occupied by the red cells is minimized.
E.g. here is a picture of the solution for $N = 10$:
The area occupied by the red cells for $N = 10$ rounded to $10$ digits behind the decimal point is $3.3469640797$.
Find the positions for $N = 400$.
Give as your answer the area occupied by the red cells rounded to $10$ digits behind the decimal point. | <p>
A rectilinear grid is an orthogonal grid where the spacing between the gridlines does not have to be equidistant.<br/>
An example of such grid is logarithmic graph paper.
</p>
<p>
Consider rectilinear grids in the Cartesian coordinate system with the following properties:<br/></p><ul><li>The gridlines are parallel to the axes of the Cartesian coordinate system.</li><li>There are $N+2$ vertical and $N+2$ horizontal gridlines. Hence there are $(N+1) \times (N+1)$ rectangular cells.</li><li>The equations of the two outer vertical gridlines are $x = -1$ and $x = 1$.</li><li>The equations of the two outer horizontal gridlines are $y = -1$ and $y = 1$.</li><li>The grid cells are colored red if they overlap with the <strong class="tooltip">unit circle<span class="tooltiptext">The unit circle is the circle that has radius $1$ and is centered at the origin</span></strong>, black otherwise.</li></ul>For this problem we would like you to find the positions of the remaining $N$ inner horizontal and $N$ inner vertical gridlines so that the area occupied by the red cells is minimized.
<p>
E.g. here is a picture of the solution for $N = 10$:
</p><p align="center">
<img alt="0392_gridlines.png" src="resources/images/0392_gridlines.png?1678992053"/></p>
The area occupied by the red cells for $N = 10$ rounded to $10$ digits behind the decimal point is $3.3469640797$.
<p>
Find the positions for $N = 400$.<br/>
Give as your answer the area occupied by the red cells rounded to $10$ digits behind the decimal point.
</p> | 3.1486734435 | Saturday, 1st September 2012, 02:00 pm | 878 | 35% | medium |
166 | Criss Cross | A $4 \times 4$ grid is filled with digits $d$, $0 \le d \le 9$.
It can be seen that in the grid
\begin{matrix}
6 & 3 & 3 & 0\\
5 & 0 & 4 & 3\\
0 & 7 & 1 & 4\\
1 & 2 & 4 & 5
\end{matrix}
the sum of each row and each column has the value $12$. Moreover the sum of each diagonal is also $12$.
In how many ways can you fill a $4 \times 4$ grid with the digits $d$, $0 \le d \le 9$ so that each row, each column, and both diagonals have the same sum? | A $4 \times 4$ grid is filled with digits $d$, $0 \le d \le 9$.
It can be seen that in the grid
\begin{matrix}
6 & 3 & 3 & 0\\
5 & 0 & 4 & 3\\
0 & 7 & 1 & 4\\
1 & 2 & 4 & 5
\end{matrix}
the sum of each row and each column has the value $12$. Moreover the sum of each diagonal is also $12$.
In how many ways can you fill a $4 \times 4$ grid with the digits $d$, $0 \le d \le 9$ so that each row, each column, and both diagonals have the same sum? | <p>A $4 \times 4$ grid is filled with digits $d$, $0 \le d \le 9$.</p>
<p>It can be seen that in the grid
\begin{matrix}
6 & 3 & 3 & 0\\
5 & 0 & 4 & 3\\
0 & 7 & 1 & 4\\
1 & 2 & 4 & 5
\end{matrix}
the sum of each row and each column has the value $12$. Moreover the sum of each diagonal is also $12$.</p>
<p>In how many ways can you fill a $4 \times 4$ grid with the digits $d$, $0 \le d \le 9$ so that each row, each column, and both diagonals have the same sum?</p> | 7130034 | Saturday, 3rd November 2007, 01:00 pm | 4570 | 50% | medium |
450 | Hypocycloid and Lattice Points | A hypocycloid is the curve drawn by a point on a small circle rolling inside a larger circle. The parametric equations of a hypocycloid centered at the origin, and starting at the right most point is given by:
$$x(t) = (R - r) \cos(t) + r \cos(\frac {R - r} r t)$$
$$y(t) = (R - r) \sin(t) - r \sin(\frac {R - r} r t)$$
Where $R$ is the radius of the large circle and $r$ the radius of the small circle.
Let $C(R, r)$ be the set of distinct points with integer coordinates on the hypocycloid with radius R and r and for which there is a corresponding value of t such that $\sin(t)$ and $\cos(t)$ are rational numbers.
Let $S(R, r) = \sum_{(x,y) \in C(R, r)} |x| + |y|$ be the sum of the absolute values of the $x$ and $y$ coordinates of the points in $C(R, r)$.
Let $T(N) = \sum_{R = 3}^N \sum_{r=1}^{\lfloor \frac {R - 1} 2 \rfloor} S(R, r)$ be the sum of $S(R, r)$ for R and r positive integers, $R\leq N$ and $2r < R$.
You are given:
$C(3, 1)$=$\{(3, 0), (-1, 2), (-1,0), (-1,-2)\}$
$C(2500, 1000)$=$\{(2500, 0), (772, 2376), (772, -2376), (516, 1792), (516, -1792), (500, 0), (68, 504), (68, -504),$
$(-1356, 1088), (-1356, -1088), (-1500, 1000), (-1500, -1000)\}$
Note: $(-625, 0)$ is not an element of $C(2500, 1000)$ because $\sin(t)$ is not a rational number for the corresponding values of $t$.
$S(3, 1) = (|3| + |0|) + (|-1| + |2|) + (|-1| + |0|) + (|-1| + |-2|) = 10$
$T(3) = 10; T(10) = 524; T(100) = 580442; T(10^3) = 583108600$.
Find $T(10^6)$. | A hypocycloid is the curve drawn by a point on a small circle rolling inside a larger circle. The parametric equations of a hypocycloid centered at the origin, and starting at the right most point is given by:
$$x(t) = (R - r) \cos(t) + r \cos(\frac {R - r} r t)$$
$$y(t) = (R - r) \sin(t) - r \sin(\frac {R - r} r t)$$
Where $R$ is the radius of the large circle and $r$ the radius of the small circle.
Let $C(R, r)$ be the set of distinct points with integer coordinates on the hypocycloid with radius R and r and for which there is a corresponding value of t such that $\sin(t)$ and $\cos(t)$ are rational numbers.
Let $S(R, r) = \sum_{(x,y) \in C(R, r)} |x| + |y|$ be the sum of the absolute values of the $x$ and $y$ coordinates of the points in $C(R, r)$.
Let $T(N) = \sum_{R = 3}^N \sum_{r=1}^{\lfloor \frac {R - 1} 2 \rfloor} S(R, r)$ be the sum of $S(R, r)$ for R and r positive integers, $R\leq N$ and $2r < R$.
You are given:
$C(3, 1)$=$\{(3, 0), (-1, 2), (-1,0), (-1,-2)\}$
$C(2500, 1000)$=$\{(2500, 0), (772, 2376), (772, -2376), (516, 1792), (516, -1792), (500, 0), (68, 504), (68, -504),$
$(-1356, 1088), (-1356, -1088), (-1500, 1000), (-1500, -1000)\}$
Note: $(-625, 0)$ is not an element of $C(2500, 1000)$ because $\sin(t)$ is not a rational number for the corresponding values of $t$.
$S(3, 1) = (|3| + |0|) + (|-1| + |2|) + (|-1| + |0|) + (|-1| + |-2|) = 10$
$T(3) = 10; T(10) = 524; T(100) = 580442; T(10^3) = 583108600$.
Find $T(10^6)$. | <p>A hypocycloid is the curve drawn by a point on a small circle rolling inside a larger circle. The parametric equations of a hypocycloid centered at the origin, and starting at the right most point is given by:</p>
<p>$$x(t) = (R - r) \cos(t) + r \cos(\frac {R - r} r t)$$
$$y(t) = (R - r) \sin(t) - r \sin(\frac {R - r} r t)$$</p>
<p>Where $R$ is the radius of the large circle and $r$ the radius of the small circle.</p>
<p>Let $C(R, r)$ be the set of distinct points with integer coordinates on the hypocycloid with radius <var>R</var> and <var>r</var> and for which there is a corresponding value of <var>t</var> such that $\sin(t)$ and $\cos(t)$ are rational numbers.</p>
<p>
Let $S(R, r) = \sum_{(x,y) \in C(R, r)} |x| + |y|$ be the sum of the absolute values of the $x$ and $y$ coordinates of the points in $C(R, r)$.</p>
<p>Let $T(N) = \sum_{R = 3}^N \sum_{r=1}^{\lfloor \frac {R - 1} 2 \rfloor} S(R, r)$ be the sum of $S(R, r)$ for <var>R</var> and <var>r</var> positive integers, $R\leq N$ and $2r < R$.</p>
<p>You are given:</p>
<table>
<tr>
<td class="right">$C(3, 1)$</td><td>=</td><td>$\{(3, 0), (-1, 2), (-1,0), (-1,-2)\}$</td>
</tr>
<tr>
<td>$C(2500, 1000)$</td><td>=</td><td>$\{(2500, 0), (772, 2376), (772, -2376), (516, 1792), (516, -1792), (500, 0), (68, 504), (68, -504),$</td>
</tr>
<tr>
<td colspan="2"> </td><td>$(-1356, 1088), (-1356, -1088), (-1500, 1000), (-1500, -1000)\}$</td>
</tr>
</table>
<p><i>Note:</i> $(-625, 0)$ is not an element of $C(2500, 1000)$ because $\sin(t)$ is not a rational number for the corresponding values of $t$.</p>
<p>$S(3, 1) = (|3| + |0|) + (|-1| + |2|) + (|-1| + |0|) + (|-1| + |-2|) = 10$</p>
<p>$T(3) = 10; T(10) = 524; T(100) = 580442; T(10^3) = 583108600$.</p>
<p>Find $T(10^6)$.</p> | 583333163984220940 | Sunday, 15th December 2013, 07:00 am | 217 | 100% | hard |
774 | Conjunctive Sequences | Let '$\&$' denote the bitwise AND operation.
For example, $10\,\&\, 12 = 1010_2\,\&\, 1100_2 = 1000_2 = 8$.
We shall call a finite sequence of non-negative integers $(a_1, a_2, \ldots, a_n)$ conjunctive if $a_i\,\&\, a_{i+1} \neq 0$ for all $i=1\ldots n-1$.
Define $c(n,b)$ to be the number of conjunctive sequences of length $n$ in which all terms are $\le b$.
You are given that $c(3,4)=18$, $c(10,6)=2496120$, and $c(100,200) \equiv 268159379 \pmod {998244353}$.
Find $c(123,123456789)$. Give your answer modulo $998244353$. | Let '$\&$' denote the bitwise AND operation.
For example, $10\,\&\, 12 = 1010_2\,\&\, 1100_2 = 1000_2 = 8$.
We shall call a finite sequence of non-negative integers $(a_1, a_2, \ldots, a_n)$ conjunctive if $a_i\,\&\, a_{i+1} \neq 0$ for all $i=1\ldots n-1$.
Define $c(n,b)$ to be the number of conjunctive sequences of length $n$ in which all terms are $\le b$.
You are given that $c(3,4)=18$, $c(10,6)=2496120$, and $c(100,200) \equiv 268159379 \pmod {998244353}$.
Find $c(123,123456789)$. Give your answer modulo $998244353$. | <p>Let '$\&$' denote the bitwise AND operation.<br/>
For example, $10\,\&\, 12 = 1010_2\,\&\, 1100_2 = 1000_2 = 8$.</p>
<p>We shall call a finite sequence of non-negative integers $(a_1, a_2, \ldots, a_n)$ <dfn>conjunctive</dfn> if $a_i\,\&\, a_{i+1} \neq 0$ for all $i=1\ldots n-1$.</p>
<p>Define $c(n,b)$ to be the number of conjunctive sequences of length $n$ in which all terms are $\le b$.</p>
<p>You are given that $c(3,4)=18$, $c(10,6)=2496120$, and $c(100,200) \equiv 268159379 \pmod {998244353}$.</p>
<p>Find $c(123,123456789)$. Give your answer modulo $998244353$.</p> | 459155763 | Saturday, 27th November 2021, 10:00 pm | 154 | 90% | hard |
210 | Obtuse Angled Triangles | Consider the set $S(r)$ of points $(x,y)$ with integer coordinates satisfying $|x| + |y| \le r$.
Let $O$ be the point $(0,0)$ and $C$ the point $(r/4,r/4)$.
Let $N(r)$ be the number of points $B$ in $S(r)$, so that the triangle $OBC$ has an obtuse angle, i.e. the largest angle $\alpha$ satisfies $90^\circ \lt \alpha \lt 180^\circ$.
So, for example, $N(4)=24$ and $N(8)=100$.
What is $N(1\,000\,000\,000)$? | Consider the set $S(r)$ of points $(x,y)$ with integer coordinates satisfying $|x| + |y| \le r$.
Let $O$ be the point $(0,0)$ and $C$ the point $(r/4,r/4)$.
Let $N(r)$ be the number of points $B$ in $S(r)$, so that the triangle $OBC$ has an obtuse angle, i.e. the largest angle $\alpha$ satisfies $90^\circ \lt \alpha \lt 180^\circ$.
So, for example, $N(4)=24$ and $N(8)=100$.
What is $N(1\,000\,000\,000)$? | Consider the set $S(r)$ of points $(x,y)$ with integer coordinates satisfying $|x| + |y| \le r$.<br/>
Let $O$ be the point $(0,0)$ and $C$ the point $(r/4,r/4)$. <br/>
Let $N(r)$ be the number of points $B$ in $S(r)$, so that the triangle $OBC$ has an obtuse angle, i.e. the largest angle $\alpha$ satisfies $90^\circ \lt \alpha \lt 180^\circ$.<br/>
So, for example, $N(4)=24$ and $N(8)=100$.
<p>
What is $N(1\,000\,000\,000)$?
</p> | 1598174770174689458 | Friday, 26th September 2008, 10:00 pm | 1909 | 70% | hard |
402 | Integer-valued Polynomials | It can be shown that the polynomial $n^4 + 4n^3 + 2n^2 + 5n$ is a multiple of $6$ for every integer $n$. It can also be shown that $6$ is the largest integer satisfying this property.
Define $M(a, b, c)$ as the maximum $m$ such that $n^4 + an^3 + bn^2 + cn$ is a multiple of $m$ for all integers $n$. For example, $M(4, 2, 5) = 6$.
Also, define $S(N)$ as the sum of $M(a, b, c)$ for all $0 \lt a, b, c \leq N$.
We can verify that $S(10) = 1972$ and $S(10000) = 2024258331114$.
Let $F_k$ be the Fibonacci sequence:
$F_0 = 0$, $F_1 = 1$ and
$F_k = F_{k-1} + F_{k-2}$ for $k \geq 2$.
Find the last $9$ digits of $\sum S(F_k)$ for $2 \leq k \leq 1234567890123$. | It can be shown that the polynomial $n^4 + 4n^3 + 2n^2 + 5n$ is a multiple of $6$ for every integer $n$. It can also be shown that $6$ is the largest integer satisfying this property.
Define $M(a, b, c)$ as the maximum $m$ such that $n^4 + an^3 + bn^2 + cn$ is a multiple of $m$ for all integers $n$. For example, $M(4, 2, 5) = 6$.
Also, define $S(N)$ as the sum of $M(a, b, c)$ for all $0 \lt a, b, c \leq N$.
We can verify that $S(10) = 1972$ and $S(10000) = 2024258331114$.
Let $F_k$ be the Fibonacci sequence:
$F_0 = 0$, $F_1 = 1$ and
$F_k = F_{k-1} + F_{k-2}$ for $k \geq 2$.
Find the last $9$ digits of $\sum S(F_k)$ for $2 \leq k \leq 1234567890123$. | <p>
It can be shown that the polynomial $n^4 + 4n^3 + 2n^2 + 5n$ is a multiple of $6$ for every integer $n$. It can also be shown that $6$ is the largest integer satisfying this property.
</p>
<p>
Define $M(a, b, c)$ as the maximum $m$ such that $n^4 + an^3 + bn^2 + cn$ is a multiple of $m$ for all integers $n$. For example, $M(4, 2, 5) = 6$.
</p>
<p>
Also, define $S(N)$ as the sum of $M(a, b, c)$ for all $0 \lt a, b, c \leq N$.
</p>
<p>
We can verify that $S(10) = 1972$ and $S(10000) = 2024258331114$.
</p>
<p>
Let $F_k$ be the Fibonacci sequence:<br/>
$F_0 = 0$, $F_1 = 1$ and<br/>
$F_k = F_{k-1} + F_{k-2}$ for $k \geq 2$.
</p>
<p>
Find the last $9$ digits of $\sum S(F_k)$ for $2 \leq k \leq 1234567890123$.
</p> | 356019862 | Saturday, 17th November 2012, 07:00 pm | 467 | 55% | medium |
650 | Divisors of Binomial Product | Let $B(n) = \displaystyle \prod_{k=0}^n {n \choose k}$, a product of binomial coefficients.
For example, $B(5) = {5 \choose 0} \times {5 \choose 1} \times {5 \choose 2} \times {5 \choose 3} \times {5 \choose 4} \times {5 \choose 5} = 1 \times 5 \times 10 \times 10 \times 5 \times 1 = 2500$.
Let $D(n) = \displaystyle \sum_{d|B(n)} d$, the sum of the divisors of $B(n)$.
For example, the divisors of B(5) are 1, 2, 4, 5, 10, 20, 25, 50, 100, 125, 250, 500, 625, 1250 and 2500,
so D(5) = 1 + 2 + 4 + 5 + 10 + 20 + 25 + 50 + 100 + 125 + 250 + 500 + 625 + 1250 + 2500 = 5467.
Let $S(n) = \displaystyle \sum_{k=1}^n D(k)$.
You are given $S(5) = 5736$, $S(10) = 141740594713218418$ and $S(100)$ mod $1\,000\,000\,007 = 332792866$.
Find $S(20\,000)$ mod $1\,000\,000\,007$. | Let $B(n) = \displaystyle \prod_{k=0}^n {n \choose k}$, a product of binomial coefficients.
For example, $B(5) = {5 \choose 0} \times {5 \choose 1} \times {5 \choose 2} \times {5 \choose 3} \times {5 \choose 4} \times {5 \choose 5} = 1 \times 5 \times 10 \times 10 \times 5 \times 1 = 2500$.
Let $D(n) = \displaystyle \sum_{d|B(n)} d$, the sum of the divisors of $B(n)$.
For example, the divisors of B(5) are 1, 2, 4, 5, 10, 20, 25, 50, 100, 125, 250, 500, 625, 1250 and 2500,
so D(5) = 1 + 2 + 4 + 5 + 10 + 20 + 25 + 50 + 100 + 125 + 250 + 500 + 625 + 1250 + 2500 = 5467.
Let $S(n) = \displaystyle \sum_{k=1}^n D(k)$.
You are given $S(5) = 5736$, $S(10) = 141740594713218418$ and $S(100)$ mod $1\,000\,000\,007 = 332792866$.
Find $S(20\,000)$ mod $1\,000\,000\,007$. | <p>
Let $B(n) = \displaystyle \prod_{k=0}^n {n \choose k}$, a product of binomial coefficients.<br>
For example, $B(5) = {5 \choose 0} \times {5 \choose 1} \times {5 \choose 2} \times {5 \choose 3} \times {5 \choose 4} \times {5 \choose 5} = 1 \times 5 \times 10 \times 10 \times 5 \times 1 = 2500$.
</br></p>
<p>
Let $D(n) = \displaystyle \sum_{d|B(n)} d$, the sum of the divisors of $B(n)$.<br/>
For example, the divisors of B(5) are 1, 2, 4, 5, 10, 20, 25, 50, 100, 125, 250, 500, 625, 1250 and 2500,<br/>
so D(5) = 1 + 2 + 4 + 5 + 10 + 20 + 25 + 50 + 100 + 125 + 250 + 500 + 625 + 1250 + 2500 = 5467.
</p>
<p>
Let $S(n) = \displaystyle \sum_{k=1}^n D(k)$.<br/>
You are given $S(5) = 5736$, $S(10) = 141740594713218418$ and $S(100)$ mod $1\,000\,000\,007 = 332792866$.
</p>
<p>
Find $S(20\,000)$ mod $1\,000\,000\,007$.
</p> | 538319652 | Saturday, 5th January 2019, 04:00 pm | 1862 | 10% | easy |
474 | Last Digits of Divisors | For a positive integer $n$ and digits $d$, we define $F(n, d)$ as the number of the divisors of $n$ whose last digits equal $d$.
For example, $F(84, 4) = 3$. Among the divisors of $84$ ($1, 2, 3, 4, 6, 7, 12, 14, 21, 28, 42, 84$), three of them ($4, 14, 84$) have the last digit $4$.
We can also verify that $F(12!, 12) = 11$ and $F(50!, 123) = 17888$.
Find $F(10^6!, 65432)$ modulo ($10^{16} + 61$). | For a positive integer $n$ and digits $d$, we define $F(n, d)$ as the number of the divisors of $n$ whose last digits equal $d$.
For example, $F(84, 4) = 3$. Among the divisors of $84$ ($1, 2, 3, 4, 6, 7, 12, 14, 21, 28, 42, 84$), three of them ($4, 14, 84$) have the last digit $4$.
We can also verify that $F(12!, 12) = 11$ and $F(50!, 123) = 17888$.
Find $F(10^6!, 65432)$ modulo ($10^{16} + 61$). | <p>
For a positive integer $n$ and digits $d$, we define $F(n, d)$ as the number of the divisors of $n$ whose last digits equal $d$.<br/>
For example, $F(84, 4) = 3$. Among the divisors of $84$ ($1, 2, 3, 4, 6, 7, 12, 14, 21, 28, 42, 84$), three of them ($4, 14, 84$) have the last digit $4$.
</p>
<p>
We can also verify that $F(12!, 12) = 11$ and $F(50!, 123) = 17888$.
</p>
<p>
Find $F(10^6!, 65432)$ modulo ($10^{16} + 61$).
</p> | 9690646731515010 | Sunday, 1st June 2014, 07:00 am | 467 | 50% | medium |
150 | Sub-triangle Sums | In a triangular array of positive and negative integers, we wish to find a sub-triangle such that the sum of the numbers it contains is the smallest possible.
In the example below, it can be easily verified that the marked triangle satisfies this condition having a sum of −42.
We wish to make such a triangular array with one thousand rows, so we generate 500500 pseudo-random numbers sk in the range ±219, using a type of random number generator (known as a Linear Congruential Generator) as follows:
t := 0
for k = 1 up to k = 500500:
t := (615949*t + 797807) modulo 220
sk := t−219
Thus: s1 = 273519, s2 = −153582, s3 = 450905 etc
Our triangular array is then formed using the pseudo-random numbers thus:
s1
s2 s3
s4 s5 s6
s7 s8 s9 s10
...
Sub-triangles can start at any element of the array and extend down as far as we like (taking-in the two elements directly below it from the next row, the three elements directly below from the row after that, and so on).
The "sum of a sub-triangle" is defined as the sum of all the elements it contains.
Find the smallest possible sub-triangle sum. | In a triangular array of positive and negative integers, we wish to find a sub-triangle such that the sum of the numbers it contains is the smallest possible.
In the example below, it can be easily verified that the marked triangle satisfies this condition having a sum of −42.
We wish to make such a triangular array with one thousand rows, so we generate 500500 pseudo-random numbers sk in the range ±219, using a type of random number generator (known as a Linear Congruential Generator) as follows:
t := 0
for k = 1 up to k = 500500:
t := (615949*t + 797807) modulo 220
sk := t−219
Thus: s1 = 273519, s2 = −153582, s3 = 450905 etc
Our triangular array is then formed using the pseudo-random numbers thus:
s1
s2 s3
s4 s5 s6
s7 s8 s9 s10
...
Sub-triangles can start at any element of the array and extend down as far as we like (taking-in the two elements directly below it from the next row, the three elements directly below from the row after that, and so on).
The "sum of a sub-triangle" is defined as the sum of all the elements it contains.
Find the smallest possible sub-triangle sum. | <p>In a triangular array of positive and negative integers, we wish to find a sub-triangle such that the sum of the numbers it contains is the smallest possible.</p>
<p>In the example below, it can be easily verified that the marked triangle satisfies this condition having a sum of −42.</p>
<div class="center">
<img alt="" class="dark_img" src="resources/images/0150.gif?1678992055"/></div>
<p>We wish to make such a triangular array with one thousand rows, so we generate 500500 pseudo-random numbers <span style="font-style:italic;">s<sub>k</sub></span> in the range ±2<sup>19</sup>, using a type of random number generator (known as a Linear Congruential Generator) as follows:</p>
<p class="margin_left"><span style="font-style:italic;">t</span> := 0
<br/>
for k = 1 up to k = 500500:
<br/>
<span style="font-style:italic;">t</span> := (615949*<span style="font-style:italic;">t</span> + 797807) modulo 2<sup>20</sup><br/>
<span style="font-style:italic;">s<sub>k</sub></span> := <span style="font-style:italic;">t</span>−2<sup>19</sup></p>
<p>Thus: <span style="font-style:italic;">s<sub>1</sub></span> = 273519, <span style="font-style:italic;">s<sub>2</sub></span> = −153582, <span style="font-style:italic;">s<sub>3</sub></span> = 450905 etc</p>
<p>Our triangular array is then formed using the pseudo-random numbers thus:</p>
<div style="text-align:center;font-style:italic;">
s<sub>1</sub><br/>
s<sub>2</sub> s<sub>3</sub><br/>
s<sub>4</sub> s<sub>5</sub> s<sub>6</sub>
<br/>
s<sub>7</sub> s<sub>8</sub> s<sub>9</sub> s<sub>10</sub><br/>
...
</div>
<p>Sub-triangles can start at any element of the array and extend down as far as we like (taking-in the two elements directly below it from the next row, the three elements directly below from the row after that, and so on).
<br/>
The "sum of a sub-triangle" is defined as the sum of all the elements it contains.
<br/>
Find the smallest possible sub-triangle sum.</p> | -271248680 | Friday, 13th April 2007, 10:00 pm | 4436 | 55% | medium |
887 | Bounded Binary Search | Consider the problem of determining a secret number from a set $\{1, ..., N\}$ by repeatedly choosing a number $y$ and asking "Is the secret number greater than $y$?".
If $N=1$ then no questions need to be asked. If $N=2$ then only one question needs to be asked. If $N=64$ then six questions need to be asked. However, in the latter case if the secret number is $1$ then six questions still need to be asked. We want to restrict the number of questions asked for small values.
Let $Q(N, d)$ be the least number of questions needed for a strategy that can find any secret number from the set $\{1, ..., N\}$ where no more than $x + d$ questions are needed to find the secret value $x$.
It can be proved that $Q(N, 0) = N - 1$. You are also given $Q(7, 1) = 3$ and $Q(777, 2) = 10$.
Find $\displaystyle \sum_{d=0}^7 \sum_{N=1}^{7^{10}} Q(N, d)$. | Consider the problem of determining a secret number from a set $\{1, ..., N\}$ by repeatedly choosing a number $y$ and asking "Is the secret number greater than $y$?".
If $N=1$ then no questions need to be asked. If $N=2$ then only one question needs to be asked. If $N=64$ then six questions need to be asked. However, in the latter case if the secret number is $1$ then six questions still need to be asked. We want to restrict the number of questions asked for small values.
Let $Q(N, d)$ be the least number of questions needed for a strategy that can find any secret number from the set $\{1, ..., N\}$ where no more than $x + d$ questions are needed to find the secret value $x$.
It can be proved that $Q(N, 0) = N - 1$. You are also given $Q(7, 1) = 3$ and $Q(777, 2) = 10$.
Find $\displaystyle \sum_{d=0}^7 \sum_{N=1}^{7^{10}} Q(N, d)$. | <p>Consider the problem of determining a secret number from a set $\{1, ..., N\}$ by repeatedly choosing a number $y$ and asking "Is the secret number greater than $y$?".</p>
<p>If $N=1$ then no questions need to be asked. If $N=2$ then only one question needs to be asked. If $N=64$ then six questions need to be asked. However, in the latter case if the secret number is $1$ then six questions still need to be asked. We want to restrict the number of questions asked for small values.</p>
<p>Let $Q(N, d)$ be the least number of questions needed for a strategy that can find any secret number from the set $\{1, ..., N\}$ where no more than $x + d$ questions are needed to find the secret value $x$.</p>
<p>It can be proved that $Q(N, 0) = N - 1$. You are also given $Q(7, 1) = 3$ and $Q(777, 2) = 10$.</p>
<p>Find $\displaystyle \sum_{d=0}^7 \sum_{N=1}^{7^{10}} Q(N, d)$.</p> | 39896187138661622 | Saturday, 20th April 2024, 05:00 pm | 253 | 30% | easy |
71 | Ordered Fractions | Consider the fraction, $\dfrac n d$, where $n$ and $d$ are positive integers. If $n \lt d$ and $\operatorname{HCF}(n,d)=1$, it is called a reduced proper fraction.
If we list the set of reduced proper fractions for $d \le 8$ in ascending order of size, we get:
$$\frac 1 8, \frac 1 7, \frac 1 6, \frac 1 5, \frac 1 4, \frac 2 7, \frac 1 3, \frac 3 8, \mathbf{\frac 2 5}, \frac 3 7, \frac 1 2, \frac 4 7, \frac 3 5, \frac 5 8, \frac 2 3, \frac 5 7, \frac 3 4, \frac 4 5, \frac 5 6, \frac 6 7, \frac 7 8$$
It can be seen that $\dfrac 2 5$ is the fraction immediately to the left of $\dfrac 3 7$.
By listing the set of reduced proper fractions for $d \le 1\,000\,000$ in ascending order of size, find the numerator of the fraction immediately to the left of $\dfrac 3 7$. | Consider the fraction, $\dfrac n d$, where $n$ and $d$ are positive integers. If $n \lt d$ and $\operatorname{HCF}(n,d)=1$, it is called a reduced proper fraction.
If we list the set of reduced proper fractions for $d \le 8$ in ascending order of size, we get:
$$\frac 1 8, \frac 1 7, \frac 1 6, \frac 1 5, \frac 1 4, \frac 2 7, \frac 1 3, \frac 3 8, \mathbf{\frac 2 5}, \frac 3 7, \frac 1 2, \frac 4 7, \frac 3 5, \frac 5 8, \frac 2 3, \frac 5 7, \frac 3 4, \frac 4 5, \frac 5 6, \frac 6 7, \frac 7 8$$
It can be seen that $\dfrac 2 5$ is the fraction immediately to the left of $\dfrac 3 7$.
By listing the set of reduced proper fractions for $d \le 1\,000\,000$ in ascending order of size, find the numerator of the fraction immediately to the left of $\dfrac 3 7$. | <p>Consider the fraction, $\dfrac n d$, where $n$ and $d$ are positive integers. If $n \lt d$ and $\operatorname{HCF}(n,d)=1$, it is called a reduced proper fraction.</p>
<p>If we list the set of reduced proper fractions for $d \le 8$ in ascending order of size, we get:
$$\frac 1 8, \frac 1 7, \frac 1 6, \frac 1 5, \frac 1 4, \frac 2 7, \frac 1 3, \frac 3 8, \mathbf{\frac 2 5}, \frac 3 7, \frac 1 2, \frac 4 7, \frac 3 5, \frac 5 8, \frac 2 3, \frac 5 7, \frac 3 4, \frac 4 5, \frac 5 6, \frac 6 7, \frac 7 8$$</p>
<p>It can be seen that $\dfrac 2 5$ is the fraction immediately to the left of $\dfrac 3 7$.</p>
<p>By listing the set of reduced proper fractions for $d \le 1\,000\,000$ in ascending order of size, find the numerator of the fraction immediately to the left of $\dfrac 3 7$.</p> | 428570 | Friday, 4th June 2004, 06:00 pm | 32418 | 10% | easy |
256 | Tatami-Free Rooms | Tatami are rectangular mats, used to completely cover the floor of a room, without overlap.
Assuming that the only type of available tatami has dimensions $1 \times 2$, there are obviously some limitations for the shape and size of the rooms that can be covered.
For this problem, we consider only rectangular rooms with integer dimensions $a, b$ and even size $s = a \cdot b$.
We use the term 'size' to denote the floor surface area of the room, and — without loss of generality — we add the condition $a \le b$.
There is one rule to follow when laying out tatami: there must be no points where corners of four different mats meet.
For example, consider the two arrangements below for a $4 \times 4$ room:
The arrangement on the left is acceptable, whereas the one on the right is not: a red "X" in the middle, marks the point where four tatami meet.
Because of this rule, certain even-sized rooms cannot be covered with tatami: we call them tatami-free rooms.
Further, we define $T(s)$ as the number of tatami-free rooms of size $s$.
The smallest tatami-free room has size $s = 70$ and dimensions $7 \times 10$.
All the other rooms of size $s = 70$ can be covered with tatami; they are: $1 \times 70$, $2 \times 35$ and $5 \times 14$.
Hence, $T(70) = 1$.
Similarly, we can verify that $T(1320) = 5$ because there are exactly $5$ tatami-free rooms of size $s = 1320$:
$20 \times 66$, $22 \times 60$, $24 \times 55$, $30 \times 44$ and $33 \times 40$.
In fact, $s = 1320$ is the smallest room-size $s$ for which $T(s) = 5$.
Find the smallest room-size $s$ for which $T(s) = 200$. | Tatami are rectangular mats, used to completely cover the floor of a room, without overlap.
Assuming that the only type of available tatami has dimensions $1 \times 2$, there are obviously some limitations for the shape and size of the rooms that can be covered.
For this problem, we consider only rectangular rooms with integer dimensions $a, b$ and even size $s = a \cdot b$.
We use the term 'size' to denote the floor surface area of the room, and — without loss of generality — we add the condition $a \le b$.
There is one rule to follow when laying out tatami: there must be no points where corners of four different mats meet.
For example, consider the two arrangements below for a $4 \times 4$ room:
The arrangement on the left is acceptable, whereas the one on the right is not: a red "X" in the middle, marks the point where four tatami meet.
Because of this rule, certain even-sized rooms cannot be covered with tatami: we call them tatami-free rooms.
Further, we define $T(s)$ as the number of tatami-free rooms of size $s$.
The smallest tatami-free room has size $s = 70$ and dimensions $7 \times 10$.
All the other rooms of size $s = 70$ can be covered with tatami; they are: $1 \times 70$, $2 \times 35$ and $5 \times 14$.
Hence, $T(70) = 1$.
Similarly, we can verify that $T(1320) = 5$ because there are exactly $5$ tatami-free rooms of size $s = 1320$:
$20 \times 66$, $22 \times 60$, $24 \times 55$, $30 \times 44$ and $33 \times 40$.
In fact, $s = 1320$ is the smallest room-size $s$ for which $T(s) = 5$.
Find the smallest room-size $s$ for which $T(s) = 200$. | <p>Tatami are rectangular mats, used to completely cover the floor of a room, without overlap.</p>
<p>Assuming that the only type of available tatami has dimensions $1 \times 2$, there are obviously some limitations for the shape and size of the rooms that can be covered.</p>
<p>For this problem, we consider only rectangular rooms with integer dimensions $a, b$ and even size $s = a \cdot b$.<br/>
We use the term 'size' to denote the floor surface area of the room, and — without loss of generality — we add the condition $a \le b$.</p>
<p>There is one rule to follow when laying out tatami: there must be no points where corners of four different mats meet.<br/>
For example, consider the two arrangements below for a $4 \times 4$ room:</p>
<div align="center">
<img alt="0256_tatami3.gif" src="resources/images/0256_tatami3.gif?1678992056"/><br/></div>
<p>The arrangement on the left is acceptable, whereas the one on the right is not: a red "<span style="color:#FF0000;"><b>X</b></span>" in the middle, marks the point where four tatami meet.</p>
<p>Because of this rule, certain even-sized rooms cannot be covered with tatami: we call them tatami-free rooms.<br/>
Further, we define $T(s)$ as the number of tatami-free rooms of size $s$.</p>
<p>The smallest tatami-free room has size $s = 70$ and dimensions $7 \times 10$.<br/>
All the other rooms of size $s = 70$ can be covered with tatami; they are: $1 \times 70$, $2 \times 35$ and $5 \times 14$.<br/>
Hence, $T(70) = 1$.</p>
<p>Similarly, we can verify that $T(1320) = 5$ because there are exactly $5$ tatami-free rooms of size $s = 1320$:<br/>
$20 \times 66$, $22 \times 60$, $24 \times 55$, $30 \times 44$ and $33 \times 40$.<br/>
In fact, $s = 1320$ is the smallest room-size $s$ for which $T(s) = 5$.</p>
<p>Find the smallest room-size $s$ for which $T(s) = 200$.</p> | 85765680 | Saturday, 19th September 2009, 01:00 am | 830 | 80% | hard |
38 | Pandigital Multiples | Take the number $192$ and multiply it by each of $1$, $2$, and $3$:
\begin{align}
192 \times 1 &= 192\\
192 \times 2 &= 384\\
192 \times 3 &= 576
\end{align}
By concatenating each product we get the $1$ to $9$ pandigital, $192384576$. We will call $192384576$ the concatenated product of $192$ and $(1,2,3)$.
The same can be achieved by starting with $9$ and multiplying by $1$, $2$, $3$, $4$, and $5$, giving the pandigital, $918273645$, which is the concatenated product of $9$ and $(1,2,3,4,5)$.
What is the largest $1$ to $9$ pandigital $9$-digit number that can be formed as the concatenated product of an integer with $(1,2, \dots, n)$ where $n \gt 1$? | Take the number $192$ and multiply it by each of $1$, $2$, and $3$:
\begin{align}
192 \times 1 &= 192\\
192 \times 2 &= 384\\
192 \times 3 &= 576
\end{align}
By concatenating each product we get the $1$ to $9$ pandigital, $192384576$. We will call $192384576$ the concatenated product of $192$ and $(1,2,3)$.
The same can be achieved by starting with $9$ and multiplying by $1$, $2$, $3$, $4$, and $5$, giving the pandigital, $918273645$, which is the concatenated product of $9$ and $(1,2,3,4,5)$.
What is the largest $1$ to $9$ pandigital $9$-digit number that can be formed as the concatenated product of an integer with $(1,2, \dots, n)$ where $n \gt 1$? | <p>Take the number $192$ and multiply it by each of $1$, $2$, and $3$:</p>
\begin{align}
192 \times 1 &= 192\\
192 \times 2 &= 384\\
192 \times 3 &= 576
\end{align}
<p>By concatenating each product we get the $1$ to $9$ pandigital, $192384576$. We will call $192384576$ the concatenated product of $192$ and $(1,2,3)$.</p>
<p>The same can be achieved by starting with $9$ and multiplying by $1$, $2$, $3$, $4$, and $5$, giving the pandigital, $918273645$, which is the concatenated product of $9$ and $(1,2,3,4,5)$.</p>
<p>What is the largest $1$ to $9$ pandigital $9$-digit number that can be formed as the concatenated product of an integer with $(1,2, \dots, n)$ where $n \gt 1$?</p> | 932718654 | Friday, 28th February 2003, 06:00 pm | 69062 | 5% | easy |
429 | Sum of Squares of Unitary Divisors | A unitary divisor $d$ of a number $n$ is a divisor of $n$ that has the property $\gcd(d, n/d) = 1$.
The unitary divisors of $4! = 24$ are $1, 3, 8$ and $24$.
The sum of their squares is $1^2 + 3^2 + 8^2 + 24^2 = 650$.
Let $S(n)$ represent the sum of the squares of the unitary divisors of $n$. Thus $S(4!)=650$.
Find $S(100\,000\,000!)$ modulo $1\,000\,000\,009$. | A unitary divisor $d$ of a number $n$ is a divisor of $n$ that has the property $\gcd(d, n/d) = 1$.
The unitary divisors of $4! = 24$ are $1, 3, 8$ and $24$.
The sum of their squares is $1^2 + 3^2 + 8^2 + 24^2 = 650$.
Let $S(n)$ represent the sum of the squares of the unitary divisors of $n$. Thus $S(4!)=650$.
Find $S(100\,000\,000!)$ modulo $1\,000\,000\,009$. | <p>
A unitary divisor $d$ of a number $n$ is a divisor of $n$ that has the property $\gcd(d, n/d) = 1$.<br/>
The unitary divisors of $4! = 24$ are $1, 3, 8$ and $24$.<br/>
The sum of their squares is $1^2 + 3^2 + 8^2 + 24^2 = 650$.
</p>
<p>
Let $S(n)$ represent the sum of the squares of the unitary divisors of $n$. Thus $S(4!)=650$.
</p>
<p>
Find $S(100\,000\,000!)$ modulo $1\,000\,000\,009$.
</p> | 98792821 | Sunday, 26th May 2013, 04:00 am | 2796 | 20% | easy |
567 | Reciprocal Games I | Tom has built a random generator that is connected to a row of $n$ light bulbs. Whenever the random generator is activated each of the $n$ lights is turned on with the probability of $\frac 1 2$, independently of its former state or the state of the other light bulbs.
While discussing with his friend Jerry how to use his generator, they invent two different games, they call the reciprocal games:
Both games consist of $n$ turns. Each turn is started by choosing a number $k$ randomly between (and including) $1$ and $n$, with equal probability of $\frac 1 n$ for each number, while the possible win for that turn is the reciprocal of $k$, that is $\frac 1 k$.
In game A, Tom activates his random generator once in each turn. If the number of lights turned on is the same as the previously chosen number $k$, Jerry wins and gets $\frac 1 k$, otherwise he will receive nothing for that turn. Jerry's expected win after playing the total game A consisting of $n$ turns is called $J_A(n)$. For example $J_A(6)=0.39505208$, rounded to $8$ decimal places.
For each turn in game B, after $k$ has been randomly selected, Tom keeps reactivating his random generator until exactly $k$ lights are turned on. After that Jerry takes over and reactivates the random generator until he, too, has generated a pattern with exactly $k$ lights turned on. If this pattern is identical to Tom's last pattern, Jerry wins and gets $\frac 1 k$, otherwise he will receive nothing. Jerry's expected win after the total game B consisting of $n$ turns is called $J_B(n)$. For example $J_B(6)=0.43333333$, rounded to $8$ decimal places.
Let $\displaystyle S(m)=\sum_{n=1}^m (J_A(n)+J_B(n))$. For example $S(6)=7.58932292$, rounded to $8$ decimal places.
Find $S(123456789)$, rounded to $8$ decimal places. | Tom has built a random generator that is connected to a row of $n$ light bulbs. Whenever the random generator is activated each of the $n$ lights is turned on with the probability of $\frac 1 2$, independently of its former state or the state of the other light bulbs.
While discussing with his friend Jerry how to use his generator, they invent two different games, they call the reciprocal games:
Both games consist of $n$ turns. Each turn is started by choosing a number $k$ randomly between (and including) $1$ and $n$, with equal probability of $\frac 1 n$ for each number, while the possible win for that turn is the reciprocal of $k$, that is $\frac 1 k$.
In game A, Tom activates his random generator once in each turn. If the number of lights turned on is the same as the previously chosen number $k$, Jerry wins and gets $\frac 1 k$, otherwise he will receive nothing for that turn. Jerry's expected win after playing the total game A consisting of $n$ turns is called $J_A(n)$. For example $J_A(6)=0.39505208$, rounded to $8$ decimal places.
For each turn in game B, after $k$ has been randomly selected, Tom keeps reactivating his random generator until exactly $k$ lights are turned on. After that Jerry takes over and reactivates the random generator until he, too, has generated a pattern with exactly $k$ lights turned on. If this pattern is identical to Tom's last pattern, Jerry wins and gets $\frac 1 k$, otherwise he will receive nothing. Jerry's expected win after the total game B consisting of $n$ turns is called $J_B(n)$. For example $J_B(6)=0.43333333$, rounded to $8$ decimal places.
Let $\displaystyle S(m)=\sum_{n=1}^m (J_A(n)+J_B(n))$. For example $S(6)=7.58932292$, rounded to $8$ decimal places.
Find $S(123456789)$, rounded to $8$ decimal places. | <p>Tom has built a random generator that is connected to a row of $n$ light bulbs. Whenever the random generator is activated each of the $n$ lights is turned on with the probability of $\frac 1 2$, independently of its former state or the state of the other light bulbs.</p>
<p>While discussing with his friend Jerry how to use his generator, they invent two different games, they call the <dfn>reciprocal games</dfn>:<br/>
Both games consist of $n$ turns. Each turn is started by choosing a number $k$ randomly between (and including) $1$ and $n$, with equal probability of $\frac 1 n$ for each number, while the possible win for that turn is the reciprocal of $k$, that is $\frac 1 k$.</p>
<p>In game A, Tom activates his random generator once in each turn. If the number of lights turned on is the same as the previously chosen number $k$, Jerry wins and gets $\frac 1 k$, otherwise he will receive nothing for that turn. Jerry's expected win after playing the total game A consisting of $n$ turns is called $J_A(n)$. For example $J_A(6)=0.39505208$, rounded to $8$ decimal places.</p>
<p>For each turn in game B, after $k$ has been randomly selected, Tom keeps reactivating his random generator until exactly $k$ lights are turned on. After that Jerry takes over and reactivates the random generator until he, too, has generated a pattern with exactly $k$ lights turned on. If this pattern is identical to Tom's last pattern, Jerry wins and gets $\frac 1 k$, otherwise he will receive nothing. Jerry's expected win after the total game B consisting of $n$ turns is called $J_B(n)$. For example $J_B(6)=0.43333333$, rounded to $8$ decimal places.</p>
<p>Let $\displaystyle S(m)=\sum_{n=1}^m (J_A(n)+J_B(n))$. For example $S(6)=7.58932292$, rounded to $8$ decimal places.</p>
<p>Find $S(123456789)$, rounded to $8$ decimal places.</p> | 75.44817535 | Saturday, 3rd September 2016, 04:00 pm | 331 | 55% | medium |
319 | Bounded Sequences | Let $x_1, x_2, \dots, x_n$ be a sequence of length $n$ such that:
$x_1 = 2$
for all $1 \lt i \le n$: $x_{i - 1} \lt x_i$
for all $i$ and $j$ with $1 \le i, j \le n$: $(x_i)^j \lt (x_j + 1)^i$.
There are only five such sequences of length $2$, namely:
$\{2,4\}$, $\{2,5\}$, $\{2,6\}$, $\{2,7\}$ and $\{2,8\}$.
There are $293$ such sequences of length $5$; three examples are given below:
$\{2,5,11,25,55\}$, $\{2,6,14,36,88\}$, $\{2,8,22,64,181\}$.
Let $t(n)$ denote the number of such sequences of length $n$.
You are given that $t(10) = 86195$ and $t(20) = 5227991891$.
Find $t(10^{10})$ and give your answer modulo $10^9$. | Let $x_1, x_2, \dots, x_n$ be a sequence of length $n$ such that:
$x_1 = 2$
for all $1 \lt i \le n$: $x_{i - 1} \lt x_i$
for all $i$ and $j$ with $1 \le i, j \le n$: $(x_i)^j \lt (x_j + 1)^i$.
There are only five such sequences of length $2$, namely:
$\{2,4\}$, $\{2,5\}$, $\{2,6\}$, $\{2,7\}$ and $\{2,8\}$.
There are $293$ such sequences of length $5$; three examples are given below:
$\{2,5,11,25,55\}$, $\{2,6,14,36,88\}$, $\{2,8,22,64,181\}$.
Let $t(n)$ denote the number of such sequences of length $n$.
You are given that $t(10) = 86195$ and $t(20) = 5227991891$.
Find $t(10^{10})$ and give your answer modulo $10^9$. | <p>
Let $x_1, x_2, \dots, x_n$ be a sequence of length $n$ such that:
</p><ul><li>$x_1 = 2$</li>
<li>for all $1 \lt i \le n$: $x_{i - 1} \lt x_i$</li>
<li>for all $i$ and $j$ with $1 \le i, j \le n$: $(x_i)^j \lt (x_j + 1)^i$.</li>
</ul><p>
There are only five such sequences of length $2$, namely:
$\{2,4\}$, $\{2,5\}$, $\{2,6\}$, $\{2,7\}$ and $\{2,8\}$.<br/>
There are $293$ such sequences of length $5$; three examples are given below:<br/>
$\{2,5,11,25,55\}$, $\{2,6,14,36,88\}$, $\{2,8,22,64,181\}$.
</p>
<p>
Let $t(n)$ denote the number of such sequences of length $n$.<br/>
You are given that $t(10) = 86195$ and $t(20) = 5227991891$.
</p>
<p>
Find $t(10^{10})$ and give your answer modulo $10^9$.
</p> | 268457129 | Saturday, 8th January 2011, 07:00 pm | 453 | 90% | hard |
701 | Random Connected Area | Consider a rectangle made up of $W \times H$ square cells each with area $1$. Each cell is independently coloured black with probability $0.5$ otherwise white. Black cells sharing an edge are assumed to be connected.Consider the maximum area of connected cells.
Define $E(W,H)$ to be the expected value of this maximum area.
For example, $E(2,2)=1.875$, as illustrated below.
You are also given $E(4, 4) = 5.76487732$, rounded to $8$ decimal places.
Find $E(7, 7)$, rounded to $8$ decimal places. | Consider a rectangle made up of $W \times H$ square cells each with area $1$. Each cell is independently coloured black with probability $0.5$ otherwise white. Black cells sharing an edge are assumed to be connected.Consider the maximum area of connected cells.
Define $E(W,H)$ to be the expected value of this maximum area.
For example, $E(2,2)=1.875$, as illustrated below.
You are also given $E(4, 4) = 5.76487732$, rounded to $8$ decimal places.
Find $E(7, 7)$, rounded to $8$ decimal places. | <p>
Consider a rectangle made up of $W \times H$ square cells each with area $1$.<br/> Each cell is independently coloured black with probability $0.5$ otherwise white. Black cells sharing an edge are assumed to be connected.<br/>Consider the maximum area of connected cells.</p>
<p>
Define $E(W,H)$ to be the expected value of this maximum area.
For example, $E(2,2)=1.875$, as illustrated below.
</p>
<div class="center">
<img alt="3 random connected area" src="resources/images/0701_randcon.png?1678992054"/>
</div>
<p>
You are also given $E(4, 4) = 5.76487732$, rounded to $8$ decimal places.
</p>
<p>
Find $E(7, 7)$, rounded to $8$ decimal places.
</p> | 13.51099836 | Saturday, 8th February 2020, 04:00 pm | 388 | 40% | medium |
323 | Bitwise-OR Operations on Random Integers | Let $y_0, y_1, y_2, \dots$ be a sequence of random unsigned $32$-bit integers
(i.e. $0 \le y_i \lt 2^{32}$, every value equally likely).
For the sequence $x_i$ the following recursion is given:$x_0 = 0$ and
$x_i = x_{i - 1} \boldsymbol \mid y_{i - 1}$, for $i \gt 0$. ($\boldsymbol \mid$ is the bitwise-OR operator).
It can be seen that eventually there will be an index $N$ such that $x_i = 2^{32} - 1$ (a bit-pattern of all ones) for all $i \ge N$.
Find the expected value of $N$.
Give your answer rounded to $10$ digits after the decimal point. | Let $y_0, y_1, y_2, \dots$ be a sequence of random unsigned $32$-bit integers
(i.e. $0 \le y_i \lt 2^{32}$, every value equally likely).
For the sequence $x_i$ the following recursion is given:$x_0 = 0$ and
$x_i = x_{i - 1} \boldsymbol \mid y_{i - 1}$, for $i \gt 0$. ($\boldsymbol \mid$ is the bitwise-OR operator).
It can be seen that eventually there will be an index $N$ such that $x_i = 2^{32} - 1$ (a bit-pattern of all ones) for all $i \ge N$.
Find the expected value of $N$.
Give your answer rounded to $10$ digits after the decimal point. | <p>Let $y_0, y_1, y_2, \dots$ be a sequence of random unsigned $32$-bit integers<br/>
(i.e. $0 \le y_i \lt 2^{32}$, every value equally likely).</p>
<p>For the sequence $x_i$ the following recursion is given:<br/></p><ul><li>$x_0 = 0$ and</li>
<li>$x_i = x_{i - 1} \boldsymbol \mid y_{i - 1}$, for $i \gt 0$. ($\boldsymbol \mid$ is the bitwise-OR operator).</li>
</ul><p>It can be seen that eventually there will be an index $N$ such that $x_i = 2^{32} - 1$ (a bit-pattern of all ones) for all $i \ge N$.</p>
<p>Find the expected value of $N$. <br/>
Give your answer rounded to $10$ digits after the decimal point.</p> | 6.3551758451 | Sunday, 6th February 2011, 07:00 am | 4272 | 20% | easy |
869 | Prime Guessing | A prime is drawn uniformly from all primes not exceeding $N$. The prime is written in binary notation, and a player tries to guess it bit-by-bit starting at the least significant bit. The player scores one point for each bit they guess correctly. Immediately after each guess, the player is informed whether their guess was correct, and also whether it was the last bit in the number - in which case the game is over.
Let $E(N)$ be the expected number of points assuming that the player always guesses to maximize their score. For example, $E(10)=2$, achievable by always guessing "1". You are also given $E(30)=2.9$.
Find $E(10^8)$. Give your answer rounded to eight digits after the decimal point. | A prime is drawn uniformly from all primes not exceeding $N$. The prime is written in binary notation, and a player tries to guess it bit-by-bit starting at the least significant bit. The player scores one point for each bit they guess correctly. Immediately after each guess, the player is informed whether their guess was correct, and also whether it was the last bit in the number - in which case the game is over.
Let $E(N)$ be the expected number of points assuming that the player always guesses to maximize their score. For example, $E(10)=2$, achievable by always guessing "1". You are also given $E(30)=2.9$.
Find $E(10^8)$. Give your answer rounded to eight digits after the decimal point. | <p>
A prime is drawn uniformly from all primes not exceeding $N$. The prime is written in binary notation, and a player tries to guess it bit-by-bit starting at the least significant bit. The player scores one point for each bit they guess correctly. Immediately after each guess, the player is informed whether their guess was correct, and also whether it was the last bit in the number - in which case the game is over.</p>
<p>
Let $E(N)$ be the expected number of points assuming that the player always guesses to maximize their score. For example, $E(10)=2$, achievable by always guessing "1". You are also given $E(30)=2.9$.</p>
<p>
Find $E(10^8)$. Give your answer rounded to eight digits after the decimal point.</p> | 14.97696693 | Saturday, 23rd December 2023, 01:00 pm | 758 | 15% | easy |
877 | XOR-Equation A | 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) = 5
\end{align}
For example, $(a, b) = (3, 6)$ is a solution.
Let $X(N)$ be the XOR of the $b$ values for all solutions to this equation satisfying $0 \le a \le b \le N$. You are given $X(10)=5$.
Find $X(10^{18})$. | 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) = 5
\end{align}
For example, $(a, b) = (3, 6)$ is a solution.
Let $X(N)$ be the XOR of the $b$ values for all solutions to this equation satisfying $0 \le a \le b \le N$. You are given $X(10)=5$.
Find $X(10^{18})$. | <p>
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.
</p>
<p>
For example, $7 \otimes 3 = 9$, or in base $2$, $111_2 \otimes 11_2 = 1001_2$:
</p><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) = 5
\end{align}
</center>
For example, $(a, b) = (3, 6)$ is a solution.
<p>
Let $X(N)$ be the XOR of the $b$ values for all solutions to this equation satisfying $0 \le a \le b \le N$.<br/> You are given $X(10)=5$.
</p>
<p>
Find $X(10^{18})$.
</p> | 336785000760344621 | Saturday, 17th February 2024, 01:00 pm | 433 | 20% | easy |
159 | Digital Root Sums of Factorisations | A composite number can be factored many different ways.
For instance, not including multiplication by one, $24$ can be factored in $7$ distinct ways:
\begin{align}
24 &= 2 \times 2 \times 2 \times 3\\
24 &= 2 \times 3 \times 4\\
24 &= 2 \times 2 \times 6\\
24 &= 4 \times 6\\
24 &= 3 \times 8\\
24 &= 2 \times 12\\
24 &= 24
\end{align}
Recall that the digital root of a number, in base $10$, is found by adding together the digits of that number,
and repeating that process until a number is arrived at that is less than $10$.
Thus the digital root of $467$ is $8$.
We shall call a Digital Root Sum (DRS) the sum of the digital roots of the individual factors of our number.
The chart below demonstrates all of the DRS values for $24$.
FactorisationDigital Root Sum
$2 \times 2 \times 2 \times 3$$9$
$2 \times 3 \times 4$$9$
$2 \times 2 \times 6$$10$
$4 \times 6$$10$
$3 \times 8$$11$
$2 \times 12$$5$
$24$$6$
The maximum Digital Root Sum of $24$ is $11$.
The function $\operatorname{mdrs}(n)$ gives the maximum Digital Root Sum of $n$. So $\operatorname{mdrs}(24)=11$.
Find $\sum \operatorname{mdrs}(n)$ for $1 \lt n \lt 1\,000\,000$. | A composite number can be factored many different ways.
For instance, not including multiplication by one, $24$ can be factored in $7$ distinct ways:
\begin{align}
24 &= 2 \times 2 \times 2 \times 3\\
24 &= 2 \times 3 \times 4\\
24 &= 2 \times 2 \times 6\\
24 &= 4 \times 6\\
24 &= 3 \times 8\\
24 &= 2 \times 12\\
24 &= 24
\end{align}
Recall that the digital root of a number, in base $10$, is found by adding together the digits of that number,
and repeating that process until a number is arrived at that is less than $10$.
Thus the digital root of $467$ is $8$.
We shall call a Digital Root Sum (DRS) the sum of the digital roots of the individual factors of our number.
The chart below demonstrates all of the DRS values for $24$.
FactorisationDigital Root Sum
$2 \times 2 \times 2 \times 3$$9$
$2 \times 3 \times 4$$9$
$2 \times 2 \times 6$$10$
$4 \times 6$$10$
$3 \times 8$$11$
$2 \times 12$$5$
$24$$6$
The maximum Digital Root Sum of $24$ is $11$.
The function $\operatorname{mdrs}(n)$ gives the maximum Digital Root Sum of $n$. So $\operatorname{mdrs}(24)=11$.
Find $\sum \operatorname{mdrs}(n)$ for $1 \lt n \lt 1\,000\,000$. | <p>A composite number can be factored many different ways.
For instance, not including multiplication by one, $24$ can be factored in $7$ distinct ways:</p>
\begin{align}
24 &= 2 \times 2 \times 2 \times 3\\
24 &= 2 \times 3 \times 4\\
24 &= 2 \times 2 \times 6\\
24 &= 4 \times 6\\
24 &= 3 \times 8\\
24 &= 2 \times 12\\
24 &= 24
\end{align}
<p>Recall that the digital root of a number, in base $10$, is found by adding together the digits of that number,
and repeating that process until a number is arrived at that is less than $10$.
Thus the digital root of $467$ is $8$.</p>
<p>We shall call a Digital Root Sum (DRS) the sum of the digital roots of the individual factors of our number.<br/>
The chart below demonstrates all of the DRS values for $24$.</p>
<table class="grid center">
<tr><th>Factorisation</th><th>Digital Root Sum</th></tr>
<tr><td>$2 \times 2 \times 2 \times 3$</td><td>$9$</td></tr>
<tr><td>$2 \times 3 \times 4$</td><td>$9$</td></tr>
<tr><td>$2 \times 2 \times 6$</td><td>$10$</td></tr>
<tr><td>$4 \times 6$</td><td>$10$</td></tr>
<tr><td>$3 \times 8$</td><td>$11$</td></tr>
<tr><td>$2 \times 12$</td><td>$5$</td></tr>
<tr><td>$24$</td><td>$6$</td></tr>
</table>
<p>The maximum Digital Root Sum of $24$ is $11$.<br/>
The function $\operatorname{mdrs}(n)$ gives the maximum Digital Root Sum of $n$. So $\operatorname{mdrs}(24)=11$.<br/>
Find $\sum \operatorname{mdrs}(n)$ for $1 \lt n \lt 1\,000\,000$.</p> | 14489159 | Saturday, 30th June 2007, 02:00 pm | 3670 | 60% | hard |
928 | Cribbage | This problem is based on (but not identical to) the scoring for the card game
Cribbage.
Consider a normal pack of $52$ cards. A Hand is a selection of one or more of these cards.
For each Hand the Hand score is the sum of the values of the cards in the Hand where the value of Aces is $1$ and the value of court cards (Jack, Queen, King) is $10$.
The Cribbage score is obtained for a Hand by adding together the scores for:
Pairs. A pair is two cards of the same rank. Every pair is worth $2$ points.
Runs. A run is a set of at least $3$ cards whose ranks are consecutive, e.g. 9, 10, Jack. Note that Ace is never high, so Queen, King, Ace is not a valid run. The number of points for each run is the size of the run. All locally maximum runs are counted. For example, 2, 3, 4, 5, 7, 8, 9 the two runs of 2, 3, 4, 5 and 7, 8, 9 are counted but not 2, 3, 4 or 3, 4, 5.
Fifteens. A fifteen is a combination of cards that has value adding to $15$. Every fifteen is worth $2$ points. For this purpose the value of the cards is the same as in the Hand Score.
For example, $(5 \spadesuit, 5 \clubsuit, 5 \diamondsuit, K \heartsuit)$ has a Cribbage score of $14$ as there are four ways that fifteen can be made and also three pairs can be made.
The example $( A \diamondsuit, A \heartsuit, 2 \clubsuit, 3 \heartsuit, 4 \clubsuit, 5 \spadesuit)$ has a Cribbage score of $16$: two runs of five worth $10$ points, two ways of getting fifteen worth $4$ points and one pair worth $2$ points. In this example the Hand score is equal to the Cribbage score.
Find the number of Hands in a normal pack of cards where the Hand score is equal to the Cribbage score. | This problem is based on (but not identical to) the scoring for the card game
Cribbage.
Consider a normal pack of $52$ cards. A Hand is a selection of one or more of these cards.
For each Hand the Hand score is the sum of the values of the cards in the Hand where the value of Aces is $1$ and the value of court cards (Jack, Queen, King) is $10$.
The Cribbage score is obtained for a Hand by adding together the scores for:
Pairs. A pair is two cards of the same rank. Every pair is worth $2$ points.
Runs. A run is a set of at least $3$ cards whose ranks are consecutive, e.g. 9, 10, Jack. Note that Ace is never high, so Queen, King, Ace is not a valid run. The number of points for each run is the size of the run. All locally maximum runs are counted. For example, 2, 3, 4, 5, 7, 8, 9 the two runs of 2, 3, 4, 5 and 7, 8, 9 are counted but not 2, 3, 4 or 3, 4, 5.
Fifteens. A fifteen is a combination of cards that has value adding to $15$. Every fifteen is worth $2$ points. For this purpose the value of the cards is the same as in the Hand Score.
For example, $(5 \spadesuit, 5 \clubsuit, 5 \diamondsuit, K \heartsuit)$ has a Cribbage score of $14$ as there are four ways that fifteen can be made and also three pairs can be made.
The example $( A \diamondsuit, A \heartsuit, 2 \clubsuit, 3 \heartsuit, 4 \clubsuit, 5 \spadesuit)$ has a Cribbage score of $16$: two runs of five worth $10$ points, two ways of getting fifteen worth $4$ points and one pair worth $2$ points. In this example the Hand score is equal to the Cribbage score.
Find the number of Hands in a normal pack of cards where the Hand score is equal to the Cribbage score. | <p>This problem is based on (but not identical to) the scoring for the card game
<a href="https://en.wikipedia.org/wiki/Cribbage">Cribbage</a>.</p>
<p>
Consider a normal pack of $52$ cards. A Hand is a selection of one or more of these cards.</p>
<p>
For each Hand the <i>Hand score</i> is the sum of the values of the cards in the Hand where the value of Aces is $1$ and the value of court cards (Jack, Queen, King) is $10$.</p>
<p>
The <i>Cribbage score</i> is obtained for a Hand by adding together the scores for:</p>
<ul>
<li>
Pairs. A pair is two cards of the same rank. Every pair is worth $2$ points.</li>
<li>
Runs. A run is a set of at least $3$ cards whose ranks are consecutive, e.g. 9, 10, Jack. Note that Ace is never high, so Queen, King, Ace is <b>not</b> a valid run. The number of points for each run is the size of the run. All locally maximum runs are counted. For example, 2, 3, 4, 5, 7, 8, 9 the two runs of 2, 3, 4, 5 and 7, 8, 9 are counted but not 2, 3, 4 or 3, 4, 5.</li>
<li>
Fifteens. A fifteen is a combination of cards that has value adding to $15$. Every fifteen is worth $2$ points. For this purpose the value of the cards is the same as in the Hand Score.</li></ul>
<p>
For example, $(5 \spadesuit, 5 \clubsuit, 5 \diamondsuit, K \heartsuit)$ has a Cribbage score of $14$ as there are four ways that fifteen can be made and also three pairs can be made.</p>
<p>
The example $( A \diamondsuit, A \heartsuit, 2 \clubsuit, 3 \heartsuit, 4 \clubsuit, 5 \spadesuit)$ has a Cribbage score of $16$: two runs of five worth $10$ points, two ways of getting fifteen worth $4$ points and one pair worth $2$ points. In this example the Hand score is equal to the Cribbage score.</p>
<p>
Find the number of Hands in a normal pack of cards where the Hand score is equal to the Cribbage score.</p> | 81108001093 | Sunday, 19th January 2025, 04:00 am | 198 | 35% | medium |
96 | Su Doku | Su Doku (Japanese meaning number place) is the name given to a popular puzzle concept. Its origin is unclear, but credit must be attributed to Leonhard Euler who invented a similar, and much more difficult, puzzle idea called Latin Squares. The objective of Su Doku puzzles, however, is to replace the blanks (or zeros) in a 9 by 9 grid in such that each row, column, and 3 by 3 box contains each of the digits 1 to 9. Below is an example of a typical starting puzzle grid and its solution grid.
A well constructed Su Doku puzzle has a unique solution and can be solved by logic, although it may be necessary to employ "guess and test" methods in order to eliminate options (there is much contested opinion over this). The complexity of the search determines the difficulty of the puzzle; the example above is considered easy because it can be solved by straight forward direct deduction.
The 6K text file, sudoku.txt (right click and 'Save Link/Target As...'), contains fifty different Su Doku puzzles ranging in difficulty, but all with unique solutions (the first puzzle in the file is the example above).
By solving all fifty puzzles find the sum of the 3-digit numbers found in the top left corner of each solution grid; for example, 483 is the 3-digit number found in the top left corner of the solution grid above. | Su Doku (Japanese meaning number place) is the name given to a popular puzzle concept. Its origin is unclear, but credit must be attributed to Leonhard Euler who invented a similar, and much more difficult, puzzle idea called Latin Squares. The objective of Su Doku puzzles, however, is to replace the blanks (or zeros) in a 9 by 9 grid in such that each row, column, and 3 by 3 box contains each of the digits 1 to 9. Below is an example of a typical starting puzzle grid and its solution grid.
A well constructed Su Doku puzzle has a unique solution and can be solved by logic, although it may be necessary to employ "guess and test" methods in order to eliminate options (there is much contested opinion over this). The complexity of the search determines the difficulty of the puzzle; the example above is considered easy because it can be solved by straight forward direct deduction.
The 6K text file, sudoku.txt (right click and 'Save Link/Target As...'), contains fifty different Su Doku puzzles ranging in difficulty, but all with unique solutions (the first puzzle in the file is the example above).
By solving all fifty puzzles find the sum of the 3-digit numbers found in the top left corner of each solution grid; for example, 483 is the 3-digit number found in the top left corner of the solution grid above. | <p>Su Doku (Japanese meaning <i>number place</i>) is the name given to a popular puzzle concept. Its origin is unclear, but credit must be attributed to Leonhard Euler who invented a similar, and much more difficult, puzzle idea called Latin Squares. The objective of Su Doku puzzles, however, is to replace the blanks (or zeros) in a 9 by 9 grid in such that each row, column, and 3 by 3 box contains each of the digits 1 to 9. Below is an example of a typical starting puzzle grid and its solution grid.</p>
<div class="center">
<img alt="p096_1.png" src="project/images/p096_1.png"> <img alt="p096_2.png" src="project/images/p096_2.png"/></img></div>
<p>A well constructed Su Doku puzzle has a unique solution and can be solved by logic, although it may be necessary to employ "guess and test" methods in order to eliminate options (there is much contested opinion over this). The complexity of the search determines the difficulty of the puzzle; the example above is considered <i>easy</i> because it can be solved by straight forward direct deduction.</p>
<p>The 6K text file, <a href="project/resources/p096_sudoku.txt">sudoku.txt</a> (right click and 'Save Link/Target As...'), contains fifty different Su Doku puzzles ranging in difficulty, but all with unique solutions (the first puzzle in the file is the example above).</p>
<p>By solving all fifty puzzles find the sum of the 3-digit numbers found in the top left corner of each solution grid; for example, 483 is the 3-digit number found in the top left corner of the solution grid above.</p> | 24702 | Friday, 27th May 2005, 06:00 pm | 19168 | 25% | easy |
349 | Langton's Ant | An ant moves on a regular grid of squares that are coloured either black or white.
The ant is always oriented in one of the cardinal directions (left, right, up or down) and moves from square to adjacent square according to the following rules:
- if it is on a black square, it flips the colour of the square to white, rotates $90$ degrees counterclockwise and moves forward one square.
- if it is on a white square, it flips the colour of the square to black, rotates $90$ degrees clockwise and moves forward one square.
Starting with a grid that is entirely white, how many squares are black after $10^{18}$ moves of the ant? | An ant moves on a regular grid of squares that are coloured either black or white.
The ant is always oriented in one of the cardinal directions (left, right, up or down) and moves from square to adjacent square according to the following rules:
- if it is on a black square, it flips the colour of the square to white, rotates $90$ degrees counterclockwise and moves forward one square.
- if it is on a white square, it flips the colour of the square to black, rotates $90$ degrees clockwise and moves forward one square.
Starting with a grid that is entirely white, how many squares are black after $10^{18}$ moves of the ant? | <p>
An ant moves on a regular grid of squares that are coloured either black or white.<br/>
The ant is always oriented in one of the cardinal directions (left, right, up or down) and moves from square to adjacent square according to the following rules:<br/>
- if it is on a black square, it flips the colour of the square to white, rotates $90$ degrees counterclockwise and moves forward one square.<br/>
- if it is on a white square, it flips the colour of the square to black, rotates $90$ degrees clockwise and moves forward one square.<br/></p>
<p>
Starting with a grid that is entirely white, how many squares are black after $10^{18}$ moves of the ant?
</p> | 115384615384614952 | Saturday, 3rd September 2011, 04:00 pm | 2123 | 35% | medium |
488 | Unbalanced Nim | Alice and Bob have enjoyed playing Nim every day. However, they finally got bored of playing ordinary three-heap Nim.
So, they added an extra rule:
- Must not make two heaps of the same size.
The triple $(a, b, c)$ indicates the size of three heaps.
Under this extra rule, $(2,4,5)$ is one of the losing positions for the next player.
To illustrate:
- Alice moves to $(2,4,3)$
- Bob moves to $(0,4,3)$
- Alice moves to $(0,2,3)$
- Bob moves to $(0,2,1)$
Unlike ordinary three-heap Nim, $(0,1,2)$ and its permutations are the end states of this game.
For an integer $N$, we define $F(N)$ as the sum of $a + b + c$ for all the losing positions for the next player, with $0 \lt a \lt b \lt c \lt N$.
For example, $F(8) = 42$, because there are $4$ losing positions for the next player, $(1,3,5)$, $(1,4,6)$, $(2,3,6)$ and $(2,4,5)$.
We can also verify that $F(128) = 496062$.
Find the last $9$ digits of $F(10^{18})$. | Alice and Bob have enjoyed playing Nim every day. However, they finally got bored of playing ordinary three-heap Nim.
So, they added an extra rule:
- Must not make two heaps of the same size.
The triple $(a, b, c)$ indicates the size of three heaps.
Under this extra rule, $(2,4,5)$ is one of the losing positions for the next player.
To illustrate:
- Alice moves to $(2,4,3)$
- Bob moves to $(0,4,3)$
- Alice moves to $(0,2,3)$
- Bob moves to $(0,2,1)$
Unlike ordinary three-heap Nim, $(0,1,2)$ and its permutations are the end states of this game.
For an integer $N$, we define $F(N)$ as the sum of $a + b + c$ for all the losing positions for the next player, with $0 \lt a \lt b \lt c \lt N$.
For example, $F(8) = 42$, because there are $4$ losing positions for the next player, $(1,3,5)$, $(1,4,6)$, $(2,3,6)$ and $(2,4,5)$.
We can also verify that $F(128) = 496062$.
Find the last $9$ digits of $F(10^{18})$. | <p>Alice and Bob have enjoyed playing <strong>Nim</strong> every day. However, they finally got bored of playing ordinary three-heap Nim.<br/>
So, they added an extra rule:</p>
<p>- Must not make two heaps of the same size.</p>
<p>The triple $(a, b, c)$ indicates the size of three heaps.<br/>
Under this extra rule, $(2,4,5)$ is one of the losing positions for the next player.</p>
<p>To illustrate:<br/>
- Alice moves to $(2,4,3)$<br/>
- Bob moves to $(0,4,3)$<br/>
- Alice moves to $(0,2,3)$<br/>
- Bob moves to $(0,2,1)$</p>
<p>Unlike ordinary three-heap Nim, $(0,1,2)$ and its permutations are the end states of this game.</p>
<p>For an integer $N$, we define $F(N)$ as the sum of $a + b + c$ for all the losing positions for the next player, with $0 \lt a \lt b \lt c \lt N$.</p>
<p>For example, $F(8) = 42$, because there are $4$ losing positions for the next player, $(1,3,5)$, $(1,4,6)$, $(2,3,6)$ and $(2,4,5)$.<br/>
We can also verify that $F(128) = 496062$.</p>
<p>Find the last $9$ digits of $F(10^{18})$.</p> | 216737278 | Sunday, 9th November 2014, 01:00 am | 264 | 80% | hard |
176 | Common Cathetus Right-angled Triangles | The four right-angled triangles with sides $(9,12,15)$, $(12,16,20)$, $(5,12,13)$ and $(12,35,37)$ all have one of the shorter sides (catheti) equal to $12$. It can be shown that no other integer sided right-angled triangle exists with one of the catheti equal to $12$.
Find the smallest integer that can be the length of a cathetus of exactly $47547$ different integer sided right-angled triangles. | The four right-angled triangles with sides $(9,12,15)$, $(12,16,20)$, $(5,12,13)$ and $(12,35,37)$ all have one of the shorter sides (catheti) equal to $12$. It can be shown that no other integer sided right-angled triangle exists with one of the catheti equal to $12$.
Find the smallest integer that can be the length of a cathetus of exactly $47547$ different integer sided right-angled triangles. | <p>The four right-angled triangles with sides $(9,12,15)$, $(12,16,20)$, $(5,12,13)$ and $(12,35,37)$ all have one of the shorter sides (catheti) equal to $12$. It can be shown that no other integer sided right-angled triangle exists with one of the catheti equal to $12$.</p>
<p>Find the smallest integer that can be the length of a cathetus of exactly $47547$ different integer sided right-angled triangles.</p> | 96818198400000 | Friday, 4th January 2008, 05:00 pm | 2139 | 70% | hard |
342 | The Totient of a Square Is a Cube | Consider the number $50$.
$50^2 = 2500 = 2^2 \times 5^4$, so $\phi(2500) = 2 \times 4 \times 5^3 = 8 \times 5^3 = 2^3 \times 5^3$. 1
So $2500$ is a square and $\phi(2500)$ is a cube.
Find the sum of all numbers $n$, $1 \lt n \lt 10^{10}$ such that $\phi(n^2)$ is a cube.
1 $\phi$ denotes Euler's totient function. | Consider the number $50$.
$50^2 = 2500 = 2^2 \times 5^4$, so $\phi(2500) = 2 \times 4 \times 5^3 = 8 \times 5^3 = 2^3 \times 5^3$. 1
So $2500$ is a square and $\phi(2500)$ is a cube.
Find the sum of all numbers $n$, $1 \lt n \lt 10^{10}$ such that $\phi(n^2)$ is a cube.
1 $\phi$ denotes Euler's totient function. | <p>
Consider the number $50$.<br/>
$50^2 = 2500 = 2^2 \times 5^4$, so $\phi(2500) = 2 \times 4 \times 5^3 = 8 \times 5^3 = 2^3 \times 5^3$. <sup>1</sup><br/>
So $2500$ is a square and $\phi(2500)$ is a cube.
</p>
<p>
Find the sum of all numbers $n$, $1 \lt n \lt 10^{10}$ such that $\phi(n^2)$ is a cube.
</p>
<p>
<sup>1</sup> $\phi$ denotes <strong>Euler's totient function</strong>.
</p> | 5943040885644 | Saturday, 11th June 2011, 01:00 pm | 897 | 50% | medium |
734 | A Bit of Prime | The logical-OR of two bits is $0$ if both bits are $0$, otherwise it is $1$.
The bitwise-OR of two positive integers performs a logical-OR operation on each pair of corresponding bits in the binary expansion of its inputs.
For example, the bitwise-OR of $10$ and $6$ is $14$ because $10 = 1010_2$, $6 = 0110_2$ and $14 = 1110_2$.
Let $T(n, k)$ be the number of $k$-tuples $(x_1, x_2,\cdots,x_k)$ such that
every $x_i$ is a prime $\leq n$
the bitwise-OR of the tuple is a prime $\leq n$
For example, $T(5, 2)=5$. The five $2$-tuples are $(2, 2)$, $(2, 3)$, $(3, 2)$, $(3, 3)$ and $(5, 5)$.
You are given $T(100, 3) = 3355$ and $T(1000, 10) \equiv 2071632 \pmod{1\,000\,000\,007}$.
Find $T(10^6,999983)$. Give your answer modulo $1\,000\,000\,007$. | The logical-OR of two bits is $0$ if both bits are $0$, otherwise it is $1$.
The bitwise-OR of two positive integers performs a logical-OR operation on each pair of corresponding bits in the binary expansion of its inputs.
For example, the bitwise-OR of $10$ and $6$ is $14$ because $10 = 1010_2$, $6 = 0110_2$ and $14 = 1110_2$.
Let $T(n, k)$ be the number of $k$-tuples $(x_1, x_2,\cdots,x_k)$ such that
every $x_i$ is a prime $\leq n$
the bitwise-OR of the tuple is a prime $\leq n$
For example, $T(5, 2)=5$. The five $2$-tuples are $(2, 2)$, $(2, 3)$, $(3, 2)$, $(3, 3)$ and $(5, 5)$.
You are given $T(100, 3) = 3355$ and $T(1000, 10) \equiv 2071632 \pmod{1\,000\,000\,007}$.
Find $T(10^6,999983)$. Give your answer modulo $1\,000\,000\,007$. | <p>
The <strong>logical-OR</strong> of two bits is $0$ if both bits are $0$, otherwise it is $1$.<br/>
The <strong>bitwise-OR</strong> of two positive integers performs a logical-OR operation on each pair of corresponding bits in the binary expansion of its inputs.
</p>
<p>
For example, the bitwise-OR of $10$ and $6$ is $14$ because $10 = 1010_2$, $6 = 0110_2$ and $14 = 1110_2$.
</p>
<p>
Let $T(n, k)$ be the number of $k$-tuples $(x_1, x_2,\cdots,x_k)$ such that
</p>
<ul>
<li>every $x_i$ is a prime $\leq n$</li>
<li>the bitwise-OR of the tuple is a prime $\leq n$</li>
</ul>
<p>
For example, $T(5, 2)=5$. The five $2$-tuples are $(2, 2)$, $(2, 3)$, $(3, 2)$, $(3, 3)$ and $(5, 5)$.
</p><p>
You are given $T(100, 3) = 3355$ and $T(1000, 10) \equiv 2071632 \pmod{1\,000\,000\,007}$.
</p>
<p>
Find $T(10^6,999983)$. Give your answer modulo $1\,000\,000\,007$.
</p> | 557988060 | Saturday, 14th November 2020, 07:00 pm | 363 | 35% | medium |
187 | Semiprimes | A composite is a number containing at least two prime factors. For example, $15 = 3 \times 5$; $9 = 3 \times 3$; $12 = 2 \times 2 \times 3$.
There are ten composites below thirty containing precisely two, not necessarily distinct, prime factors:
$4, 6, 9, 10, 14, 15, 21, 22, 25, 26$.
How many composite integers, $n \lt 10^8$, have precisely two, not necessarily distinct, prime factors? | A composite is a number containing at least two prime factors. For example, $15 = 3 \times 5$; $9 = 3 \times 3$; $12 = 2 \times 2 \times 3$.
There are ten composites below thirty containing precisely two, not necessarily distinct, prime factors:
$4, 6, 9, 10, 14, 15, 21, 22, 25, 26$.
How many composite integers, $n \lt 10^8$, have precisely two, not necessarily distinct, prime factors? | <p>A composite is a number containing at least two prime factors. For example, $15 = 3 \times 5$; $9 = 3 \times 3$; $12 = 2 \times 2 \times 3$.</p>
<p>There are ten composites below thirty containing precisely two, not necessarily distinct, prime factors:
$4, 6, 9, 10, 14, 15, 21, 22, 25, 26$.</p>
<p>How many composite integers, $n \lt 10^8$, have precisely two, not necessarily distinct, prime factors?</p> | 17427258 | Saturday, 22nd March 2008, 09:00 am | 12184 | 25% | easy |
845 | Prime Digit Sum | Let $D(n)$ be the $n$-th positive integer that has the sum of its digits a prime.
For example, $D(61) = 157$ and $D(10^8) = 403539364$.
Find $D(10^{16})$. | Let $D(n)$ be the $n$-th positive integer that has the sum of its digits a prime.
For example, $D(61) = 157$ and $D(10^8) = 403539364$.
Find $D(10^{16})$. | <p>
Let $D(n)$ be the $n$-th positive integer that has the sum of its digits a prime.<br/>
For example, $D(61) = 157$ and $D(10^8) = 403539364$.</p>
<p>
Find $D(10^{16})$.</p> | 45009328011709400 | Saturday, 27th May 2023, 05:00 pm | 820 | 15% | easy |
264 | Triangle Centres | Consider all the triangles having:
All their vertices on lattice pointsInteger coordinates.
CircumcentreCentre of the circumscribed circle at the origin $O$.
OrthocentrePoint where the three altitudes meet at the point $H(5, 0)$.
There are nine such triangles having a perimeter $\le 50$.
Listed and shown in ascending order of their perimeter, they are:
$A(-4, 3)$, $B(5, 0)$, $C(4, -3)$
$A(4, 3)$, $B(5, 0)$, $C(-4, -3)$
$A(-3, 4)$, $B(5, 0)$, $C(3, -4)$
$A(3, 4)$, $B(5, 0)$, $C(-3, -4)$
$A(0, 5)$, $B(5, 0)$, $C(0, -5)$
$A(1, 8)$, $B(8, -1)$, $C(-4, -7)$
$A(8, 1)$, $B(1, -8)$, $C(-4, 7)$
$A(2, 9)$, $B(9, -2)$, $C(-6, -7)$
$A(9, 2)$, $B(2, -9)$, $C(-6, 7)$
The sum of their perimeters, rounded to four decimal places, is $291.0089$.
Find all such triangles with a perimeter $\le 10^5$.
Enter as your answer the sum of their perimeters rounded to four decimal places. | Consider all the triangles having:
All their vertices on lattice pointsInteger coordinates.
CircumcentreCentre of the circumscribed circle at the origin $O$.
OrthocentrePoint where the three altitudes meet at the point $H(5, 0)$.
There are nine such triangles having a perimeter $\le 50$.
Listed and shown in ascending order of their perimeter, they are:
$A(-4, 3)$, $B(5, 0)$, $C(4, -3)$
$A(4, 3)$, $B(5, 0)$, $C(-4, -3)$
$A(-3, 4)$, $B(5, 0)$, $C(3, -4)$
$A(3, 4)$, $B(5, 0)$, $C(-3, -4)$
$A(0, 5)$, $B(5, 0)$, $C(0, -5)$
$A(1, 8)$, $B(8, -1)$, $C(-4, -7)$
$A(8, 1)$, $B(1, -8)$, $C(-4, 7)$
$A(2, 9)$, $B(9, -2)$, $C(-6, -7)$
$A(9, 2)$, $B(2, -9)$, $C(-6, 7)$
The sum of their perimeters, rounded to four decimal places, is $291.0089$.
Find all such triangles with a perimeter $\le 10^5$.
Enter as your answer the sum of their perimeters rounded to four decimal places. | <p>Consider all the triangles having:
</p><ul><li>All their vertices on <strong class="tooltip">lattice points<span class="tooltiptext">Integer coordinates</span></strong>.</li>
<li><strong class="tooltip">Circumcentre<span class="tooltiptext">Centre of the circumscribed circle</span></strong> at the origin $O$.</li>
<li><strong class="tooltip">Orthocentre<span class="tooltiptext">Point where the three altitudes meet</span></strong> at the point $H(5, 0)$.</li>
</ul><p>There are nine such triangles having a perimeter $\le 50$.<br/>
Listed and shown in ascending order of their perimeter, they are:</p>
<p></p><table><tr><td>$A(-4, 3)$, $B(5, 0)$, $C(4, -3)$<br/>
$A(4, 3)$, $B(5, 0)$, $C(-4, -3)$<br/>
$A(-3, 4)$, $B(5, 0)$, $C(3, -4)$<br/><br/><br/>
$A(3, 4)$, $B(5, 0)$, $C(-3, -4)$<br/>
$A(0, 5)$, $B(5, 0)$, $C(0, -5)$<br/>
$A(1, 8)$, $B(8, -1)$, $C(-4, -7)$<br/><br/><br/>
$A(8, 1)$, $B(1, -8)$, $C(-4, 7)$<br/>
$A(2, 9)$, $B(9, -2)$, $C(-6, -7)$<br/>
$A(9, 2)$, $B(2, -9)$, $C(-6, 7)$<br/></td>
<td><img alt="0264_TriangleCentres.gif" class="dark_img" src="resources/images/0264_TriangleCentres.gif?1678992056"/></td>
</tr></table>
<p>The sum of their perimeters, rounded to four decimal places, is $291.0089$.</p>
<p>Find all such triangles with a perimeter $\le 10^5$.<br/>
Enter as your answer the sum of their perimeters rounded to four decimal places.</p> | 2816417.1055 | Saturday, 14th November 2009, 05:00 am | 640 | 85% | hard |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.