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 |
---|---|---|---|---|---|---|---|---|---|
412 | Gnomon Numbering | For integers $m, n$ ($0 \leq n \lt m$), let $L(m, n)$ be an $m \times m$ grid with the top-right $n \times n$ grid removed.
For example, $L(5, 3)$ looks like this:
We want to number each cell of $L(m, n)$ with consecutive integers $1, 2, 3, \dots$ such that the number in every cell is smaller than the number below it and to the left of it.
For example, here are two valid numberings of $L(5, 3)$:
Let $\operatorname{LC}(m, n)$ be the number of valid numberings of $L(m, n)$.
It can be verified that $\operatorname{LC}(3, 0) = 42$, $\operatorname{LC}(5, 3) = 250250$, $\operatorname{LC}(6, 3) = 406029023400$ and $\operatorname{LC}(10, 5) \bmod 76543217 = 61251715$.
Find $\operatorname{LC}(10000, 5000) \bmod 76543217$. | For integers $m, n$ ($0 \leq n \lt m$), let $L(m, n)$ be an $m \times m$ grid with the top-right $n \times n$ grid removed.
For example, $L(5, 3)$ looks like this:
We want to number each cell of $L(m, n)$ with consecutive integers $1, 2, 3, \dots$ such that the number in every cell is smaller than the number below it and to the left of it.
For example, here are two valid numberings of $L(5, 3)$:
Let $\operatorname{LC}(m, n)$ be the number of valid numberings of $L(m, n)$.
It can be verified that $\operatorname{LC}(3, 0) = 42$, $\operatorname{LC}(5, 3) = 250250$, $\operatorname{LC}(6, 3) = 406029023400$ and $\operatorname{LC}(10, 5) \bmod 76543217 = 61251715$.
Find $\operatorname{LC}(10000, 5000) \bmod 76543217$. | <p>For integers $m, n$ ($0 \leq n \lt m$), let $L(m, n)$ be an $m \times m$ grid with the top-right $n \times n$ grid removed.</p>
<p>For example, $L(5, 3)$ looks like this:</p>
<p class="center"><img alt="0412_table53.png" src="resources/images/0412_table53.png?1678992053"/></p>
<p>We want to number each cell of $L(m, n)$ with consecutive integers $1, 2, 3, \dots$ such that the number in every cell is smaller than the number below it and to the left of it.</p>
<p>For example, here are two valid numberings of $L(5, 3)$:</p>
<p class="center"><img alt="0412_tablenums.png" src="resources/images/0412_tablenums.png?1678992053"/></p>
<p>Let $\operatorname{LC}(m, n)$ be the number of valid numberings of $L(m, n)$.<br/>
It can be verified that $\operatorname{LC}(3, 0) = 42$, $\operatorname{LC}(5, 3) = 250250$, $\operatorname{LC}(6, 3) = 406029023400$ and $\operatorname{LC}(10, 5) \bmod 76543217 = 61251715$.</p>
<p>Find $\operatorname{LC}(10000, 5000) \bmod 76543217$.</p> | 38788800 | Sunday, 27th January 2013, 01:00 am | 556 | 50% | medium |
258 | A Lagged Fibonacci Sequence | A sequence is defined as:
$g_k = 1$, for $0 \le k \le 1999$
$g_k = g_{k-2000} + g_{k - 1999}$, for $k \ge 2000$.
Find $g_k \bmod 20092010$ for $k = 10^{18}$. | A sequence is defined as:
$g_k = 1$, for $0 \le k \le 1999$
$g_k = g_{k-2000} + g_{k - 1999}$, for $k \ge 2000$.
Find $g_k \bmod 20092010$ for $k = 10^{18}$. | <p>A sequence is defined as:</p>
<p>
</p><ul><li>$g_k = 1$, for $0 \le k \le 1999$</li>
<li>$g_k = g_{k-2000} + g_{k - 1999}$, for $k \ge 2000$.
</li></ul><p>Find $g_k \bmod 20092010$ for $k = 10^{18}$.</p> | 12747994 | Saturday, 3rd October 2009, 09:00 am | 1804 | 70% | hard |
740 | Secret Santa | Secret Santa is a process that allows $n$ people to give each other presents, so that each person gives a single present and receives a single present. At the beginning each of the $n$ people write their name on a slip of paper and put the slip into a hat. Each person takes a random slip from the hat. If the slip has their name they draw another random slip from the hat and then put the slip with their name back into the hat. At the end everyone buys a Christmas present for the person whose name is on the slip they are holding. This process will fail if the last person draws their own name.
In this variation each of the $n$ people gives and receives two presents. At the beginning each of the $n$ people writes their name on two slips of paper and puts the slips into a hat (there will be $2n$ slips of paper in the hat). As before each person takes from the hat a random slip that does not contain their own name. Then the same person repeats this process thus ending up with two slips, neither of which contains that person's own name. Then the next person draws two slips in the same way, and so on. The process will fail if the last person gets at least one slip with their own name.
Define $q(n)$ to be the probability of this happening. You are given $q(3) = 0.3611111111$ and $q(5) = 0.2476095994$ both rounded to 10 decimal places.
Find $q(100)$ rounded to 10 decimal places. | Secret Santa is a process that allows $n$ people to give each other presents, so that each person gives a single present and receives a single present. At the beginning each of the $n$ people write their name on a slip of paper and put the slip into a hat. Each person takes a random slip from the hat. If the slip has their name they draw another random slip from the hat and then put the slip with their name back into the hat. At the end everyone buys a Christmas present for the person whose name is on the slip they are holding. This process will fail if the last person draws their own name.
In this variation each of the $n$ people gives and receives two presents. At the beginning each of the $n$ people writes their name on two slips of paper and puts the slips into a hat (there will be $2n$ slips of paper in the hat). As before each person takes from the hat a random slip that does not contain their own name. Then the same person repeats this process thus ending up with two slips, neither of which contains that person's own name. Then the next person draws two slips in the same way, and so on. The process will fail if the last person gets at least one slip with their own name.
Define $q(n)$ to be the probability of this happening. You are given $q(3) = 0.3611111111$ and $q(5) = 0.2476095994$ both rounded to 10 decimal places.
Find $q(100)$ rounded to 10 decimal places. | <p>
Secret Santa is a process that allows $n$ people to give each other presents, so that each person gives a single present and receives a single present. At the beginning each of the $n$ people write their name on a slip of paper and put the slip into a hat. Each person takes a random slip from the hat. If the slip has their name they draw another random slip from the hat and then put the slip with their name back into the hat. At the end everyone buys a Christmas present for the person whose name is on the slip they are holding. This process will fail if the last person draws their own name.
</p>
<p>
In this variation each of the $n$ people gives and receives two presents. At the beginning each of the $n$ people writes their name on two slips of paper and puts the slips into a hat (there will be $2n$ slips of paper in the hat). As before each person takes from the hat a random slip that does not contain their own name. Then the same person repeats this process thus ending up with two slips, neither of which contains that person's own name. Then the next person draws two slips in the same way, and so on. The process will fail if the last person gets at least one slip with their own name.
</p>
<p>
Define $q(n)$ to be the probability of this happening. You are given $q(3) = 0.3611111111$ and $q(5) = 0.2476095994$ both rounded to 10 decimal places.
</p>
<p>
Find $q(100)$ rounded to 10 decimal places.
</p> | 0.0189581208 | Saturday, 26th December 2020, 01:00 pm | 228 | 55% | medium |
317 | Firecracker | A firecracker explodes at a height of $\pu{100 m}$ above level ground. It breaks into a large number of very small fragments, which move in every direction; all of them have the same initial velocity of $\pu{20 m/s}$.
We assume that the fragments move without air resistance, in a uniform gravitational field with $g=\pu{9.81 m/s^2}$.
Find the volume (in $\pu{m^3}$) of the region through which the fragments move before reaching the ground.
Give your answer rounded to four decimal places. | A firecracker explodes at a height of $\pu{100 m}$ above level ground. It breaks into a large number of very small fragments, which move in every direction; all of them have the same initial velocity of $\pu{20 m/s}$.
We assume that the fragments move without air resistance, in a uniform gravitational field with $g=\pu{9.81 m/s^2}$.
Find the volume (in $\pu{m^3}$) of the region through which the fragments move before reaching the ground.
Give your answer rounded to four decimal places. | <p>
A firecracker explodes at a height of $\pu{100 m}$ above level ground. It breaks into a large number of very small fragments, which move in every direction; all of them have the same initial velocity of $\pu{20 m/s}$.
</p>
<p>
We assume that the fragments move without air resistance, in a uniform gravitational field with $g=\pu{9.81 m/s^2}$.
</p>
<p>
Find the volume (in $\pu{m^3}$) of the region through which the fragments move before reaching the ground.
Give your answer rounded to four decimal places.
</p> | 1856532.8455 | Saturday, 1st January 2011, 04:00 pm | 2974 | 35% | medium |
252 | Convex Holes | Given a set of points on a plane, we define a convex hole to be a convex polygon having as vertices any of the given points and not containing any of the given points in its interior (in addition to the vertices, other given points may lie on the perimeter of the polygon).
As an example, the image below shows a set of twenty points and a few such convex holes.
The convex hole shown as a red heptagon has an area equal to $1049694.5$ square units, which is the highest possible area for a convex hole on the given set of points.
For our example, we used the first $20$ points $(T_{2k - 1}, T_{2k})$, for $k = 1,2,\dots,20$, produced with the pseudo-random number generator:
\begin{align}
S_0 &= 290797\\
S_{n + 1} &= S_n^2 \bmod 50515093\\
T_n &= (S_n \bmod 2000) - 1000
\end{align}
i.e. $(527, 144), (-488, 732), (-454, -947), \dots$
What is the maximum area for a convex hole on the set containing the first $500$ points in the pseudo-random sequence? Specify your answer including one digit after the decimal point. | Given a set of points on a plane, we define a convex hole to be a convex polygon having as vertices any of the given points and not containing any of the given points in its interior (in addition to the vertices, other given points may lie on the perimeter of the polygon).
As an example, the image below shows a set of twenty points and a few such convex holes.
The convex hole shown as a red heptagon has an area equal to $1049694.5$ square units, which is the highest possible area for a convex hole on the given set of points.
For our example, we used the first $20$ points $(T_{2k - 1}, T_{2k})$, for $k = 1,2,\dots,20$, produced with the pseudo-random number generator:
\begin{align}
S_0 &= 290797\\
S_{n + 1} &= S_n^2 \bmod 50515093\\
T_n &= (S_n \bmod 2000) - 1000
\end{align}
i.e. $(527, 144), (-488, 732), (-454, -947), \dots$
What is the maximum area for a convex hole on the set containing the first $500$ points in the pseudo-random sequence? Specify your answer including one digit after the decimal point. | <p>
Given a set of points on a plane, we define a convex hole to be a convex polygon having as vertices any of the given points and not containing any of the given points in its interior (in addition to the vertices, other given points may lie on the perimeter of the polygon).
</p>
<p>
As an example, the image below shows a set of twenty points and a few such convex holes.
The convex hole shown as a red heptagon has an area equal to $1049694.5$ square units, which is the highest possible area for a convex hole on the given set of points.
</p>
<div class="center">
<img alt="" class="dark_img" src="resources/images/0252_convexhole.gif?1678992056"/></div>
<p>
</p><p>For our example, we used the first $20$ points $(T_{2k - 1}, T_{2k})$, for $k = 1,2,\dots,20$, produced with the pseudo-random number generator:</p>
\begin{align}
S_0 &= 290797\\
S_{n + 1} &= S_n^2 \bmod 50515093\\
T_n &= (S_n \bmod 2000) - 1000
\end{align}
<p>
<i>i.e.</i> $(527, 144), (-488, 732), (-454, -947), \dots$
</p>
<p>
What is the maximum area for a convex hole on the set containing the first $500$ points in the pseudo-random sequence?<br/> Specify your answer including one digit after the decimal point.
</p> | 104924.0 | Saturday, 27th June 2009, 01:00 pm | 965 | 80% | hard |
868 | Belfry Maths | There is a method that is used by Bell ringers to generate all variations of the order that bells are rung.
The same method can be used to create all permutations of a set of letters. Consider the letters to be permuted initially in order from smallest to largest. At each step swap the largest letter with the letter on its left or right whichever generates a permutation that has not yet been seen. If neither gives a new permutation then try the next largest letter and so on. This procedure continues until all permutations have been generated.
For example, $3$ swaps are required to reach the permutation CBA when starting with ABC.
The swaps are ABC $\to$ ACB $\to$ CAB $\to$ CBA.
Also $59$ swaps are required to reach BELFRY when starting with these letters in alphabetical order.
Find the number of swaps that are required to reach NOWPICKBELFRYMATHS when starting with these letters in alphabetical order. | There is a method that is used by Bell ringers to generate all variations of the order that bells are rung.
The same method can be used to create all permutations of a set of letters. Consider the letters to be permuted initially in order from smallest to largest. At each step swap the largest letter with the letter on its left or right whichever generates a permutation that has not yet been seen. If neither gives a new permutation then try the next largest letter and so on. This procedure continues until all permutations have been generated.
For example, $3$ swaps are required to reach the permutation CBA when starting with ABC.
The swaps are ABC $\to$ ACB $\to$ CAB $\to$ CBA.
Also $59$ swaps are required to reach BELFRY when starting with these letters in alphabetical order.
Find the number of swaps that are required to reach NOWPICKBELFRYMATHS when starting with these letters in alphabetical order. | <p>
There is a method that is used by Bell ringers to generate all variations of the order that bells are rung.</p>
<p>
The same method can be used to create all permutations of a set of letters. Consider the letters to be permuted initially in order from smallest to largest. At each step swap the largest letter with the letter on its left or right whichever generates a permutation that has not yet been seen. If neither gives a new permutation then try the next largest letter and so on. This procedure continues until all permutations have been generated.</p><p>
</p><p>
For example, $3$ swaps are required to reach the permutation CBA when starting with ABC.<br/>
The swaps are ABC $\to$ ACB $\to$ CAB $\to$ CBA.<br/>
Also $59$ swaps are required to reach BELFRY when starting with these letters in alphabetical order.</p>
<p>
Find the number of swaps that are required to reach NOWPICKBELFRYMATHS when starting with these letters in alphabetical order.</p> | 3832914911887589 | Sunday, 17th December 2023, 10:00 am | 458 | 20% | easy |
601 | Divisibility Streaks | For every positive number $n$ we define the function $\mathop{streak}(n)=k$ as the smallest positive integer $k$ such that $n+k$ is not divisible by $k+1$.
E.g:
$13$ is divisible by $1$
$14$ is divisible by $2$
$15$ is divisible by $3$
$16$ is divisible by $4$
$17$ is NOT divisible by $5$
So $\mathop{streak}(13) = 4$.
Similarly:
$120$ is divisible by $1$
$121$ is NOT divisible by $2$
So $\mathop{streak}(120) = 1$.
Define $P(s, N)$ to be the number of integers $n$, $1 \lt n \lt N$, for which $\mathop{streak}(n) = s$.
So $P(3, 14) = 1$ and $P(6, 10^6) = 14286$.
Find the sum, as $i$ ranges from $1$ to $31$, of $P(i, 4^i)$. | For every positive number $n$ we define the function $\mathop{streak}(n)=k$ as the smallest positive integer $k$ such that $n+k$ is not divisible by $k+1$.
E.g:
$13$ is divisible by $1$
$14$ is divisible by $2$
$15$ is divisible by $3$
$16$ is divisible by $4$
$17$ is NOT divisible by $5$
So $\mathop{streak}(13) = 4$.
Similarly:
$120$ is divisible by $1$
$121$ is NOT divisible by $2$
So $\mathop{streak}(120) = 1$.
Define $P(s, N)$ to be the number of integers $n$, $1 \lt n \lt N$, for which $\mathop{streak}(n) = s$.
So $P(3, 14) = 1$ and $P(6, 10^6) = 14286$.
Find the sum, as $i$ ranges from $1$ to $31$, of $P(i, 4^i)$. | <p>
For every positive number $n$ we define the function $\mathop{streak}(n)=k$ as the smallest positive integer $k$ such that $n+k$ is not divisible by $k+1$.<br/>
E.g:<br/>
$13$ is divisible by $1$<br/>
$14$ is divisible by $2$<br/>
$15$ is divisible by $3$<br/>
$16$ is divisible by $4$<br/>
$17$ is NOT divisible by $5$<br/>
So $\mathop{streak}(13) = 4$. <br/>
Similarly:<br/>
$120$ is divisible by $1$<br/>
$121$ is NOT divisible by $2$<br/>
So $\mathop{streak}(120) = 1$.</p>
<p>
Define $P(s, N)$ to be the number of integers $n$, $1 \lt n \lt N$, for which $\mathop{streak}(n) = s$.<br/>
So $P(3, 14) = 1$ and $P(6, 10^6) = 14286$.
</p>
<p>
Find the sum, as $i$ ranges from $1$ to $31$, of $P(i, 4^i)$.
</p> | 1617243 | Saturday, 29th April 2017, 07:00 pm | 2284 | 20% | easy |
507 | Shortest Lattice Vector | Let $t_n$ be the tribonacci numbers defined as:
$t_0 = t_1 = 0$;
$t_2 = 1$;
$t_n = t_{n-1} + t_{n-2} + t_{n-3}$ for $n \ge 3$
and let $r_n = t_n \text{ mod } 10^7$.
For each pair of Vectors $V_n=(v_1,v_2,v_3)$ and $W_n=(w_1,w_2,w_3)$ with $v_1=r_{12n-11}-r_{12n-10}, v_2=r_{12n-9}+r_{12n-8}, v_3=r_{12n-7} \cdot r_{12n-6}$ and $w_1=r_{12n-5}-r_{12n-4}, w_2=r_{12n-3}+r_{12n-2}, w_3=r_{12n-1} \cdot r_{12n}$
we define $S(n)$ as the minimal value of the manhattan length of the vector $D=k \cdot V_n+l \cdot W_n$ measured as $|k \cdot v_1+l \cdot w_1|+|k \cdot v_2+l \cdot w_2|+|k \cdot v_3+l \cdot w_3|$
for any integers $k$ and $l$ with $(k,l)\neq (0,0)$.
The first vector pair is $(-1, 3, 28)$, $(-11, 125, 40826)$.
You are given that $S(1)=32$ and $\sum_{n=1}^{10} S(n)=130762273722$.
Find $\sum_{n=1}^{20000000} S(n)$. | Let $t_n$ be the tribonacci numbers defined as:
$t_0 = t_1 = 0$;
$t_2 = 1$;
$t_n = t_{n-1} + t_{n-2} + t_{n-3}$ for $n \ge 3$
and let $r_n = t_n \text{ mod } 10^7$.
For each pair of Vectors $V_n=(v_1,v_2,v_3)$ and $W_n=(w_1,w_2,w_3)$ with $v_1=r_{12n-11}-r_{12n-10}, v_2=r_{12n-9}+r_{12n-8}, v_3=r_{12n-7} \cdot r_{12n-6}$ and $w_1=r_{12n-5}-r_{12n-4}, w_2=r_{12n-3}+r_{12n-2}, w_3=r_{12n-1} \cdot r_{12n}$
we define $S(n)$ as the minimal value of the manhattan length of the vector $D=k \cdot V_n+l \cdot W_n$ measured as $|k \cdot v_1+l \cdot w_1|+|k \cdot v_2+l \cdot w_2|+|k \cdot v_3+l \cdot w_3|$
for any integers $k$ and $l$ with $(k,l)\neq (0,0)$.
The first vector pair is $(-1, 3, 28)$, $(-11, 125, 40826)$.
You are given that $S(1)=32$ and $\sum_{n=1}^{10} S(n)=130762273722$.
Find $\sum_{n=1}^{20000000} S(n)$. | <p>
Let $t_n$ be the <b>tribonacci numbers</b> defined as:<br/>
$t_0 = t_1 = 0$;<br/>
$t_2 = 1$;<br/>
$t_n = t_{n-1} + t_{n-2} + t_{n-3}$ for $n \ge 3$<br/>
and let $r_n = t_n \text{ mod } 10^7$.
</p>
<p>
For each pair of Vectors $V_n=(v_1,v_2,v_3)$ and $W_n=(w_1,w_2,w_3)$ with $v_1=r_{12n-11}-r_{12n-10}, v_2=r_{12n-9}+r_{12n-8}, v_3=r_{12n-7} \cdot r_{12n-6}$ and <br/> $w_1=r_{12n-5}-r_{12n-4}, w_2=r_{12n-3}+r_{12n-2}, w_3=r_{12n-1} \cdot r_{12n}$
<br/>
we define $S(n)$ as the minimal value of the manhattan length of the vector $D=k \cdot V_n+l \cdot W_n$ measured as $|k \cdot v_1+l \cdot w_1|+|k \cdot v_2+l \cdot w_2|+|k \cdot v_3+l \cdot w_3|$
for any integers $k$ and $l$ with $(k,l)\neq (0,0)$.
</p><p>
The first vector pair is $(-1, 3, 28)$, $(-11, 125, 40826)$.<br/>
You are given that $S(1)=32$ and $\sum_{n=1}^{10} S(n)=130762273722$.
</p>
<p>
Find $\sum_{n=1}^{20000000} S(n)$.
</p> | 316558047002627270 | Sunday, 15th March 2015, 07:00 am | 238 | 90% | hard |
79 | Passcode Derivation | A common security method used for online banking is to ask the user for three random characters from a passcode. For example, if the passcode was 531278, they may ask for the 2nd, 3rd, and 5th characters; the expected reply would be: 317.
The text file, keylog.txt, contains fifty successful login attempts.
Given that the three characters are always asked for in order, analyse the file so as to determine the shortest possible secret passcode of unknown length. | A common security method used for online banking is to ask the user for three random characters from a passcode. For example, if the passcode was 531278, they may ask for the 2nd, 3rd, and 5th characters; the expected reply would be: 317.
The text file, keylog.txt, contains fifty successful login attempts.
Given that the three characters are always asked for in order, analyse the file so as to determine the shortest possible secret passcode of unknown length. | <p>A common security method used for online banking is to ask the user for three random characters from a passcode. For example, if the passcode was 531278, they may ask for the 2nd, 3rd, and 5th characters; the expected reply would be: 317.</p>
<p>The text file, <a href="resources/documents/0079_keylog.txt">keylog.txt</a>, contains fifty successful login attempts.</p>
<p>Given that the three characters are always asked for in order, analyse the file so as to determine the shortest possible secret passcode of unknown length.</p> | 73162890 | Friday, 17th September 2004, 06:00 pm | 44387 | 5% | easy |
241 | Perfection Quotients | For a positive integer $n$, let $\sigma(n)$ be the sum of all divisors of $n$. For example, $\sigma(6) = 1 + 2 + 3 + 6 = 12$.
A perfect number, as you probably know, is a number with $\sigma(n) = 2n$.
Let us define the perfection quotient of a positive integer as $p(n) = \dfrac{\sigma(n)}{n}$.
Find the sum of all positive integers $n \le 10^{18}$ for which $p(n)$ has the form $k + \dfrac{1}{2}$, where $k$ is an integer. | For a positive integer $n$, let $\sigma(n)$ be the sum of all divisors of $n$. For example, $\sigma(6) = 1 + 2 + 3 + 6 = 12$.
A perfect number, as you probably know, is a number with $\sigma(n) = 2n$.
Let us define the perfection quotient of a positive integer as $p(n) = \dfrac{\sigma(n)}{n}$.
Find the sum of all positive integers $n \le 10^{18}$ for which $p(n)$ has the form $k + \dfrac{1}{2}$, where $k$ is an integer. | <p>For a positive integer $n$, let $\sigma(n)$ be the sum of all divisors of $n$. For example, $\sigma(6) = 1 + 2 + 3 + 6 = 12$.</p>
<p>A perfect number, as you probably know, is a number with $\sigma(n) = 2n$.</p>
<p>Let us define the <b>perfection quotient</b> of a positive integer as $p(n) = \dfrac{\sigma(n)}{n}$.</p>
<p>Find the sum of all positive integers $n \le 10^{18}$ for which $p(n)$ has the form $k + \dfrac{1}{2}$, where $k$ is an integer.</p> | 482316491800641154 | Saturday, 18th April 2009, 02:00 am | 1061 | 80% | hard |
377 | Sum of Digits - Experience #13 | There are $16$ positive integers that do not have a zero in their digits and that have a digital sum equal to $5$, namely:
$5$, $14$, $23$, $32$, $41$, $113$, $122$, $131$, $212$, $221$, $311$, $1112$, $1121$, $1211$, $2111$ and $11111$.
Their sum is $17891$.
Let $f(n)$ be the sum of all positive integers that do not have a zero in their digits and have a digital sum equal to $n$.
Find $\displaystyle \sum_{i=1}^{17} f(13^i)$.
Give the last $9$ digits as your answer. | There are $16$ positive integers that do not have a zero in their digits and that have a digital sum equal to $5$, namely:
$5$, $14$, $23$, $32$, $41$, $113$, $122$, $131$, $212$, $221$, $311$, $1112$, $1121$, $1211$, $2111$ and $11111$.
Their sum is $17891$.
Let $f(n)$ be the sum of all positive integers that do not have a zero in their digits and have a digital sum equal to $n$.
Find $\displaystyle \sum_{i=1}^{17} f(13^i)$.
Give the last $9$ digits as your answer. | <p>
There are $16$ positive integers that do not have a zero in their digits and that have a digital sum equal to $5$, namely: <br/>
$5$, $14$, $23$, $32$, $41$, $113$, $122$, $131$, $212$, $221$, $311$, $1112$, $1121$, $1211$, $2111$ and $11111$.<br/>
Their sum is $17891$.
</p>
<p>
Let $f(n)$ be the sum of all positive integers that do not have a zero in their digits and have a digital sum equal to $n$.
</p>
<p>
Find $\displaystyle \sum_{i=1}^{17} f(13^i)$.<br/>
Give the last $9$ digits as your answer.
</p> | 732385277 | Sunday, 25th March 2012, 05:00 am | 841 | 45% | medium |
215 | Crack-free Walls | Consider the problem of building a wall out of $2 \times 1$ and $3 \times 1$ bricks ($\text{horizontal} \times \text{vertical}$ dimensions) such that, for extra strength, the gaps between horizontally-adjacent bricks never line up in consecutive layers, i.e. never form a "running crack".
For example, the following $9 \times 3$ wall is not acceptable due to the running crack shown in red:
There are eight ways of forming a crack-free $9 \times 3$ wall, written $W(9,3) = 8$.
Calculate $W(32,10)$. | Consider the problem of building a wall out of $2 \times 1$ and $3 \times 1$ bricks ($\text{horizontal} \times \text{vertical}$ dimensions) such that, for extra strength, the gaps between horizontally-adjacent bricks never line up in consecutive layers, i.e. never form a "running crack".
For example, the following $9 \times 3$ wall is not acceptable due to the running crack shown in red:
There are eight ways of forming a crack-free $9 \times 3$ wall, written $W(9,3) = 8$.
Calculate $W(32,10)$. | <p>Consider the problem of building a wall out of $2 \times 1$ and $3 \times 1$ bricks ($\text{horizontal} \times \text{vertical}$ dimensions) such that, for extra strength, the gaps between horizontally-adjacent bricks never line up in consecutive layers, i.e. never form a "running crack".</p>
<p>For example, the following $9 \times 3$ wall is not acceptable due to the running crack shown in red:</p>
<div class="center">
<img alt="" class="dark_img" src="resources/images/0215_crackfree.gif?1678992055"/></div>
<p>There are eight ways of forming a crack-free $9 \times 3$ wall, written $W(9,3) = 8$.</p>
<p>Calculate $W(32,10)$.</p> | 806844323190414 | Friday, 31st October 2008, 01:00 pm | 4037 | 50% | medium |
550 | Divisor Game | Two players are playing a game, alternating turns. There are $k$ piles of stones.
On each turn, a player has to choose a pile and replace it with two piles of stones under the following two conditions:
Both new piles must have a number of stones more than one and less than the number of stones of the original pile.
The number of stones of each of the new piles must be a divisor of the number of stones of the original pile.
The first player unable to make a valid move loses.
Let $f(n,k)$ be the number of winning positions for the first player, assuming perfect play, when the game is played with $k$ piles each having between $2$ and $n$ stones (inclusively).$f(10,5)=40085$.
Find $f(10^7,10^{12})$.Give your answer modulo $987654321$. | Two players are playing a game, alternating turns. There are $k$ piles of stones.
On each turn, a player has to choose a pile and replace it with two piles of stones under the following two conditions:
Both new piles must have a number of stones more than one and less than the number of stones of the original pile.
The number of stones of each of the new piles must be a divisor of the number of stones of the original pile.
The first player unable to make a valid move loses.
Let $f(n,k)$ be the number of winning positions for the first player, assuming perfect play, when the game is played with $k$ piles each having between $2$ and $n$ stones (inclusively).$f(10,5)=40085$.
Find $f(10^7,10^{12})$.Give your answer modulo $987654321$. | <p>
Two players are playing a game, alternating turns. There are $k$ piles of stones.
On each turn, a player has to choose a pile and replace it with two piles of stones under the following two conditions:
</p>
<ul><li> Both new piles must have a number of stones more than one and less than the number of stones of the original pile.</li>
<li> The number of stones of each of the new piles must be a divisor of the number of stones of the original pile.</li></ul>
<p>
The first player unable to make a valid move loses.
<br/>
Let $f(n,k)$ be the number of winning positions for the first player, assuming perfect play, when the game is played with $k$ piles each having between $2$ and $n$ stones (inclusively).<br/>$f(10,5)=40085$.
</p>
<p>
Find $f(10^7,10^{12})$.<br/>Give your answer modulo $987654321$.
</p> | 328104836 | Saturday, 5th March 2016, 01:00 pm | 392 | 60% | hard |
419 | Look and Say Sequence | The look and say sequence goes 1, 11, 21, 1211, 111221, 312211, 13112221, 1113213211, ...
The sequence starts with 1 and all other members are obtained by describing the previous member in terms of consecutive digits.
It helps to do this out loud:
1 is 'one one' → 11
11 is 'two ones' → 21
21 is 'one two and one one' → 1211
1211 is 'one one, one two and two ones' → 111221
111221 is 'three ones, two twos and one one' → 312211
...
Define $A(n)$, $B(n)$ and $C(n)$ as the number of ones, twos and threes in the $n$'th element of the sequence respectively.
One can verify that $A(40) = 31254$, $B(40) = 20259$ and $C(40) = 11625$.
Find $A(n)$, $B(n)$ and $C(n)$ for $n = 10^{12}$.
Give your answer modulo $2^{30}$ and separate your values for $A$, $B$ and $C$ by a comma.
E.g. for $n = 40$ the answer would be 31254,20259,11625 | The look and say sequence goes 1, 11, 21, 1211, 111221, 312211, 13112221, 1113213211, ...
The sequence starts with 1 and all other members are obtained by describing the previous member in terms of consecutive digits.
It helps to do this out loud:
1 is 'one one' → 11
11 is 'two ones' → 21
21 is 'one two and one one' → 1211
1211 is 'one one, one two and two ones' → 111221
111221 is 'three ones, two twos and one one' → 312211
...
Define $A(n)$, $B(n)$ and $C(n)$ as the number of ones, twos and threes in the $n$'th element of the sequence respectively.
One can verify that $A(40) = 31254$, $B(40) = 20259$ and $C(40) = 11625$.
Find $A(n)$, $B(n)$ and $C(n)$ for $n = 10^{12}$.
Give your answer modulo $2^{30}$ and separate your values for $A$, $B$ and $C$ by a comma.
E.g. for $n = 40$ the answer would be 31254,20259,11625 | <p>
The <strong>look and say</strong> sequence goes 1, 11, 21, 1211, 111221, 312211, 13112221, 1113213211, ...<br/>
The sequence starts with 1 and all other members are obtained by describing the previous member in terms of consecutive digits.<br/>
It helps to do this out loud:<br/>
1 is 'one one' → 11<br/>
11 is 'two ones' → 21<br/>
21 is 'one two and one one' → 1211 <br/>
1211 is 'one one, one two and two ones' → 111221<br/>
111221 is 'three ones, two twos and one one' → 312211<br/>
...
</p>
<p>
Define $A(n)$, $B(n)$ and $C(n)$ as the number of ones, twos and threes in the $n$'th element of the sequence respectively.<br/>
One can verify that $A(40) = 31254$, $B(40) = 20259$ and $C(40) = 11625$.
</p>
<p>
Find $A(n)$, $B(n)$ and $C(n)$ for $n = 10^{12}$.<br/>
Give your answer modulo $2^{30}$ and separate your values for $A$, $B$ and $C$ by a comma.<br/>
E.g. for $n = 40$ the answer would be 31254,20259,11625
</p> | 998567458,1046245404,43363922 | Saturday, 16th March 2013, 10:00 pm | 543 | 50% | medium |
809 | Rational Recurrence Relation | The following is a function defined for all positive rational values of $x$.
$$ f(x)=\begin{cases} x &x\text{ is integral}\\
f(\frac 1{1-x}) &x \lt 1\\
f\Big(\frac 1{\lceil x\rceil -x}-1+f(x-1)\Big) &\text{otherwise}\end{cases} $$
For example, $f(3/2)=3$, $f(1/6) = 65533$ and $f(13/10) = 7625597484985$.
Find $f(22/7)$. Give your answer modulo $10^{15}$. | The following is a function defined for all positive rational values of $x$.
$$ f(x)=\begin{cases} x &x\text{ is integral}\\
f(\frac 1{1-x}) &x \lt 1\\
f\Big(\frac 1{\lceil x\rceil -x}-1+f(x-1)\Big) &\text{otherwise}\end{cases} $$
For example, $f(3/2)=3$, $f(1/6) = 65533$ and $f(13/10) = 7625597484985$.
Find $f(22/7)$. Give your answer modulo $10^{15}$. | <p>
The following is a function defined for all positive rational values of $x$.
</p>
$$ f(x)=\begin{cases} x &x\text{ is integral}\\
f(\frac 1{1-x}) &x \lt 1\\
f\Big(\frac 1{\lceil x\rceil -x}-1+f(x-1)\Big) &\text{otherwise}\end{cases} $$
<p>
For example, $f(3/2)=3$, $f(1/6) = 65533$ and $f(13/10) = 7625597484985$.
</p>
<p>
Find $f(22/7)$. Give your answer modulo $10^{15}$.
</p> | 75353432948733 | Sunday, 25th September 2022, 08:00 am | 323 | 35% | medium |
271 | Modular Cubes, Part 1 | For a positive number $n$, define $S(n)$ as the sum of the integers $x$, for which $1 \lt x \lt n$ and$x^3 \equiv 1 \bmod n$.
When $n=91$, there are $8$ possible values for $x$, namely: $9, 16, 22, 29, 53, 74, 79, 81$.
Thus, $S(91)=9+16+22+29+53+74+79+81=363$.
Find $S(13082761331670030)$. | For a positive number $n$, define $S(n)$ as the sum of the integers $x$, for which $1 \lt x \lt n$ and$x^3 \equiv 1 \bmod n$.
When $n=91$, there are $8$ possible values for $x$, namely: $9, 16, 22, 29, 53, 74, 79, 81$.
Thus, $S(91)=9+16+22+29+53+74+79+81=363$.
Find $S(13082761331670030)$. | <p>
For a positive number $n$, define $S(n)$ as the sum of the integers $x$, for which $1 \lt x \lt n$ and<br/>$x^3 \equiv 1 \bmod n$.
</p>
<p>
When $n=91$, there are $8$ possible values for $x$, namely: $9, 16, 22, 29, 53, 74, 79, 81$.<br/>
Thus, $S(91)=9+16+22+29+53+74+79+81=363$.</p>
<p>
Find $S(13082761331670030)$.
</p> | 4617456485273129588 | Saturday, 2nd January 2010, 05:00 am | 2654 | 60% | hard |
14 | Longest Collatz Sequence | The following iterative sequence is defined for the set of positive integers:
$n \to n/2$ ($n$ is even)
$n \to 3n + 1$ ($n$ is odd)
Using the rule above and starting with $13$, we generate the following sequence:
$$13 \to 40 \to 20 \to 10 \to 5 \to 16 \to 8 \to 4 \to 2 \to 1.$$
It can be seen that this sequence (starting at $13$ and finishing at $1$) contains $10$ terms. Although it has not been proved yet (Collatz Problem), it is thought that all starting numbers finish at $1$.
Which starting number, under one million, produces the longest chain?
NOTE: Once the chain starts the terms are allowed to go above one million. | The following iterative sequence is defined for the set of positive integers:
$n \to n/2$ ($n$ is even)
$n \to 3n + 1$ ($n$ is odd)
Using the rule above and starting with $13$, we generate the following sequence:
$$13 \to 40 \to 20 \to 10 \to 5 \to 16 \to 8 \to 4 \to 2 \to 1.$$
It can be seen that this sequence (starting at $13$ and finishing at $1$) contains $10$ terms. Although it has not been proved yet (Collatz Problem), it is thought that all starting numbers finish at $1$.
Which starting number, under one million, produces the longest chain?
NOTE: Once the chain starts the terms are allowed to go above one million. | <p>The following iterative sequence is defined for the set of positive integers:</p>
<ul style="list-style-type:none;">
<li>$n \to n/2$ ($n$ is even)</li>
<li>$n \to 3n + 1$ ($n$ is odd)</li></ul>
<p>Using the rule above and starting with $13$, we generate the following sequence:
$$13 \to 40 \to 20 \to 10 \to 5 \to 16 \to 8 \to 4 \to 2 \to 1.$$</p>
<p>It can be seen that this sequence (starting at $13$ and finishing at $1$) contains $10$ terms. Although it has not been proved yet (Collatz Problem), it is thought that all starting numbers finish at $1$.</p>
<p>Which starting number, under one million, produces the longest chain?</p>
<p class="note"><b>NOTE:</b> Once the chain starts the terms are allowed to go above one million.</p> | 837799 | Friday, 5th April 2002, 06:00 pm | 244361 | 5% | easy |
493 | Under the Rainbow | $70$ coloured balls are placed in an urn, $10$ for each of the seven rainbow colours.
What is the expected number of distinct colours in $20$ randomly picked balls?
Give your answer with nine digits after the decimal point (a.bcdefghij). | $70$ coloured balls are placed in an urn, $10$ for each of the seven rainbow colours.
What is the expected number of distinct colours in $20$ randomly picked balls?
Give your answer with nine digits after the decimal point (a.bcdefghij). | <p>$70$ coloured balls are placed in an urn, $10$ for each of the seven rainbow colours.</p>
<p>What is the expected number of distinct colours in $20$ randomly picked balls?</p>
<p>Give your answer with nine digits after the decimal point (a.bcdefghij).</p> | 6.818741802 | Saturday, 13th December 2014, 04:00 pm | 5893 | 10% | easy |
162 | Hexadecimal Numbers | In the hexadecimal number system numbers are represented using $16$ different digits:
$$0,1,2,3,4,5,6,7,8,9,\mathrm A,\mathrm B,\mathrm C,\mathrm D,\mathrm E,\mathrm F.$$
The hexadecimal number $\mathrm{AF}$ when written in the decimal number system equals $10 \times 16 + 15 = 175$.
In the $3$-digit hexadecimal numbers $10\mathrm A$, $1\mathrm A0$, $\mathrm A10$, and $\mathrm A01$ the digits $0$, $1$ and $\mathrm A$ are all present.
Like numbers written in base ten we write hexadecimal numbers without leading zeroes.
How many hexadecimal numbers containing at most sixteen hexadecimal digits exist with all of the digits $0$, $1$, and $\mathrm A$ present at least once?
Give your answer as a hexadecimal number.
(A, B, C, D, E and F in upper case, without any leading or trailing code that marks the number as hexadecimal and without leading zeroes, e.g. 1A3F and not: 1a3f and not 0x1a3f and not $1A3F and not #1A3F and not 0000001A3F) | In the hexadecimal number system numbers are represented using $16$ different digits:
$$0,1,2,3,4,5,6,7,8,9,\mathrm A,\mathrm B,\mathrm C,\mathrm D,\mathrm E,\mathrm F.$$
The hexadecimal number $\mathrm{AF}$ when written in the decimal number system equals $10 \times 16 + 15 = 175$.
In the $3$-digit hexadecimal numbers $10\mathrm A$, $1\mathrm A0$, $\mathrm A10$, and $\mathrm A01$ the digits $0$, $1$ and $\mathrm A$ are all present.
Like numbers written in base ten we write hexadecimal numbers without leading zeroes.
How many hexadecimal numbers containing at most sixteen hexadecimal digits exist with all of the digits $0$, $1$, and $\mathrm A$ present at least once?
Give your answer as a hexadecimal number.
(A, B, C, D, E and F in upper case, without any leading or trailing code that marks the number as hexadecimal and without leading zeroes, e.g. 1A3F and not: 1a3f and not 0x1a3f and not $1A3F and not #1A3F and not 0000001A3F) | <p>In the hexadecimal number system numbers are represented using $16$ different digits:
$$0,1,2,3,4,5,6,7,8,9,\mathrm A,\mathrm B,\mathrm C,\mathrm D,\mathrm E,\mathrm F.$$</p>
<p>The hexadecimal number $\mathrm{AF}$ when written in the decimal number system equals $10 \times 16 + 15 = 175$.</p>
<p>In the $3$-digit hexadecimal numbers $10\mathrm A$, $1\mathrm A0$, $\mathrm A10$, and $\mathrm A01$ the digits $0$, $1$ and $\mathrm A$ are all present.<br/>
Like numbers written in base ten we write hexadecimal numbers without leading zeroes.</p>
<p>How many hexadecimal numbers containing at most sixteen hexadecimal digits exist with all of the digits $0$, $1$, and $\mathrm A$ present at least once?<br/>
Give your answer as a hexadecimal number.</p>
<p>(A, B, C, D, E and F in upper case, without any leading or trailing code that marks the number as hexadecimal and without leading zeroes, e.g. 1A3F and not: 1a3f and not 0x1a3f and not $1A3F and not #1A3F and not 0000001A3F)</p> | 3D58725572C62302 | Friday, 5th October 2007, 10:00 pm | 5910 | 45% | medium |
393 | Migrating Ants | An $n \times n$ grid of squares contains $n^2$ ants, one ant per square.
All ants decide to move simultaneously to an adjacent square (usually $4$ possibilities, except for ants on the edge of the grid or at the corners).
We define $f(n)$ to be the number of ways this can happen without any ants ending on the same square and without any two ants crossing the same edge between two squares.
You are given that $f(4) = 88$.
Find $f(10)$. | An $n \times n$ grid of squares contains $n^2$ ants, one ant per square.
All ants decide to move simultaneously to an adjacent square (usually $4$ possibilities, except for ants on the edge of the grid or at the corners).
We define $f(n)$ to be the number of ways this can happen without any ants ending on the same square and without any two ants crossing the same edge between two squares.
You are given that $f(4) = 88$.
Find $f(10)$. | <p>
An $n \times n$ grid of squares contains $n^2$ ants, one ant per square.<br/>
All ants decide to move simultaneously to an adjacent square (usually $4$ possibilities, except for ants on the edge of the grid or at the corners).<br/>
We define $f(n)$ to be the number of ways this can happen without any ants ending on the same square and without any two ants crossing the same edge between two squares.
</p>
<p>
You are given that $f(4) = 88$.<br/>
Find $f(10)$.
</p> | 112398351350823112 | Saturday, 8th September 2012, 05:00 pm | 852 | 50% | medium |
217 | Balanced Numbers | A positive integer with $k$ (decimal) digits is called balanced if its first $\lceil k/2 \rceil$ digits sum to the same value as its last $\lceil k/2 \rceil$ digits, where $\lceil x \rceil$, pronounced ceiling of $x$, is the smallest integer $\ge x$, thus $\lceil \pi \rceil = 4$ and $\lceil 5 \rceil = 5$.
So, for example, all palindromes are balanced, as is $13722$.
Let $T(n)$ be the sum of all balanced numbers less than $10^n$.
Thus: $T(1) = 45$, $T(2) = 540$ and $T(5) = 334795890$.
Find $T(47) \bmod 3^{15}$. | A positive integer with $k$ (decimal) digits is called balanced if its first $\lceil k/2 \rceil$ digits sum to the same value as its last $\lceil k/2 \rceil$ digits, where $\lceil x \rceil$, pronounced ceiling of $x$, is the smallest integer $\ge x$, thus $\lceil \pi \rceil = 4$ and $\lceil 5 \rceil = 5$.
So, for example, all palindromes are balanced, as is $13722$.
Let $T(n)$ be the sum of all balanced numbers less than $10^n$.
Thus: $T(1) = 45$, $T(2) = 540$ and $T(5) = 334795890$.
Find $T(47) \bmod 3^{15}$. | <p>
A positive integer with $k$ (decimal) digits is called balanced if its first $\lceil k/2 \rceil$ digits sum to the same value as its last $\lceil k/2 \rceil$ digits, where $\lceil x \rceil$, pronounced <i>ceiling</i> of $x$, is the smallest integer $\ge x$, thus $\lceil \pi \rceil = 4$ and $\lceil 5 \rceil = 5$.</p>
<p>So, for example, all palindromes are balanced, as is $13722$.</p>
<p>Let $T(n)$ be the sum of all balanced numbers less than $10^n$. <br/>
Thus: $T(1) = 45$, $T(2) = 540$ and $T(5) = 334795890$.</p>
<p>Find $T(47) \bmod 3^{15}$.</p> | 6273134 | Friday, 14th November 2008, 09:00 pm | 1691 | 70% | hard |
208 | Robot Walks | A robot moves in a series of one-fifth circular arcs ($72^\circ$), with a free choice of a clockwise or an anticlockwise arc for each step, but no turning on the spot.
One of $70932$ possible closed paths of $25$ arcs starting northward is
Given that the robot starts facing North, how many journeys of $70$ arcs in length can it take that return it, after the final arc, to its starting position?
(Any arc may be traversed multiple times.) | A robot moves in a series of one-fifth circular arcs ($72^\circ$), with a free choice of a clockwise or an anticlockwise arc for each step, but no turning on the spot.
One of $70932$ possible closed paths of $25$ arcs starting northward is
Given that the robot starts facing North, how many journeys of $70$ arcs in length can it take that return it, after the final arc, to its starting position?
(Any arc may be traversed multiple times.) | <p>A robot moves in a series of one-fifth circular arcs ($72^\circ$), with a free choice of a clockwise or an anticlockwise arc for each step, but no turning on the spot.</p>
<p>One of $70932$ possible closed paths of $25$ arcs starting northward is</p>
<div class="center">
<img alt="" class="dark_img" src="resources/images/0208_robotwalk.gif?1678992055"/></div>
<p>Given that the robot starts facing North, how many journeys of $70$ arcs in length can it take that return it, after the final arc, to its starting position?<br/>
(Any arc may be traversed multiple times.)
</p> | 331951449665644800 | Friday, 12th September 2008, 02:00 pm | 1969 | 70% | hard |
607 | Marsh Crossing | Frodo and Sam need to travel 100 leagues due East from point A to point B. On normal terrain, they can cover 10 leagues per day, and so the journey would take 10 days. However, their path is crossed by a long marsh which runs exactly South-West to North-East, and walking through the marsh will slow them down. The marsh is 50 leagues wide at all points, and the mid-point of AB is located in the middle of the marsh. A map of the region is shown in the diagram below:
The marsh consists of 5 distinct regions, each 10 leagues across, as shown by the shading in the map. The strip closest to point A is relatively light marsh, and can be crossed at a speed of 9 leagues per day. However, each strip becomes progressively harder to navigate, the speeds going down to 8, 7, 6 and finally 5 leagues per day for the final region of marsh, before it ends and the terrain becomes easier again, with the speed going back to 10 leagues per day.
If Frodo and Sam were to head directly East for point B, they would travel exactly 100 leagues, and the journey would take approximately 13.4738 days. However, this time can be shortened if they deviate from the direct path.
Find the shortest possible time required to travel from point A to B, and give your answer in days, rounded to 10 decimal places. | Frodo and Sam need to travel 100 leagues due East from point A to point B. On normal terrain, they can cover 10 leagues per day, and so the journey would take 10 days. However, their path is crossed by a long marsh which runs exactly South-West to North-East, and walking through the marsh will slow them down. The marsh is 50 leagues wide at all points, and the mid-point of AB is located in the middle of the marsh. A map of the region is shown in the diagram below:
The marsh consists of 5 distinct regions, each 10 leagues across, as shown by the shading in the map. The strip closest to point A is relatively light marsh, and can be crossed at a speed of 9 leagues per day. However, each strip becomes progressively harder to navigate, the speeds going down to 8, 7, 6 and finally 5 leagues per day for the final region of marsh, before it ends and the terrain becomes easier again, with the speed going back to 10 leagues per day.
If Frodo and Sam were to head directly East for point B, they would travel exactly 100 leagues, and the journey would take approximately 13.4738 days. However, this time can be shortened if they deviate from the direct path.
Find the shortest possible time required to travel from point A to B, and give your answer in days, rounded to 10 decimal places. | <p>
Frodo and Sam need to travel 100 leagues due East from point A to point B. On normal terrain, they can cover 10 leagues per day, and so the journey would take 10 days. However, their path is crossed by a long marsh which runs exactly South-West to North-East, and walking through the marsh will slow them down. The marsh is 50 leagues wide at all points, and the mid-point of AB is located in the middle of the marsh. A map of the region is shown in the diagram below:
</p>
<div class="center">
<img alt="p607_marsh.png" src="project/images/p607_marsh.png"/></div>
<p>
The marsh consists of 5 distinct regions, each 10 leagues across, as shown by the shading in the map. The strip closest to point A is relatively light marsh, and can be crossed at a speed of 9 leagues per day. However, each strip becomes progressively harder to navigate, the speeds going down to 8, 7, 6 and finally 5 leagues per day for the final region of marsh, before it ends and the terrain becomes easier again, with the speed going back to 10 leagues per day.
</p>
<p>
If Frodo and Sam were to head directly East for point B, they would travel exactly 100 leagues, and the journey would take approximately 13.4738 days. However, this time can be shortened if they deviate from the direct path.
</p>
<p>
Find the shortest possible time required to travel from point A to B, and give your answer in days, rounded to 10 decimal places.
</p> | 13.1265108586 | Saturday, 10th June 2017, 01:00 pm | 1869 | 20% | easy |
686 | Powers of Two | $2^7=128$ is the first power of two whose leading digits are "12".
The next power of two whose leading digits are "12" is $2^{80}$.
Define $p(L, n)$ to be the $n$th-smallest value of $j$ such that the base 10 representation of $2^j$ begins with the digits of $L$.
So $p(12, 1) = 7$ and $p(12, 2) = 80$.
You are also given that $p(123, 45) = 12710$.
Find $p(123, 678910)$. | $2^7=128$ is the first power of two whose leading digits are "12".
The next power of two whose leading digits are "12" is $2^{80}$.
Define $p(L, n)$ to be the $n$th-smallest value of $j$ such that the base 10 representation of $2^j$ begins with the digits of $L$.
So $p(12, 1) = 7$ and $p(12, 2) = 80$.
You are also given that $p(123, 45) = 12710$.
Find $p(123, 678910)$. | <p>$2^7=128$ is the first power of two whose leading digits are "12".<br>
The next power of two whose leading digits are "12" is $2^{80}$.</br></p>
<p>Define $p(L, n)$ to be the $n$th-smallest value of $j$ such that the base 10 representation of $2^j$ begins with the digits of $L$.<br/>
So $p(12, 1) = 7$ and $p(12, 2) = 80$.</p>
<p>You are also given that $p(123, 45) = 12710$.</p>
<p>Find $p(123, 678910)$.</p> | 193060223 | Saturday, 26th October 2019, 07:00 pm | 3914 | 5% | easy |
113 | Non-bouncy Numbers | Working from left-to-right if no digit is exceeded by the digit to its left it is called an increasing number; for example, $134468$.
Similarly if no digit is exceeded by the digit to its right it is called a decreasing number; for example, $66420$.
We shall call a positive integer that is neither increasing nor decreasing a "bouncy" number; for example, $155349$.
As $n$ increases, the proportion of bouncy numbers below $n$ increases such that there are only $12951$ numbers below one-million that are not bouncy and only $277032$ non-bouncy numbers below $10^{10}$.
How many numbers below a googol ($10^{100}$) are not bouncy? | Working from left-to-right if no digit is exceeded by the digit to its left it is called an increasing number; for example, $134468$.
Similarly if no digit is exceeded by the digit to its right it is called a decreasing number; for example, $66420$.
We shall call a positive integer that is neither increasing nor decreasing a "bouncy" number; for example, $155349$.
As $n$ increases, the proportion of bouncy numbers below $n$ increases such that there are only $12951$ numbers below one-million that are not bouncy and only $277032$ non-bouncy numbers below $10^{10}$.
How many numbers below a googol ($10^{100}$) are not bouncy? | <p>Working from left-to-right if no digit is exceeded by the digit to its left it is called an increasing number; for example, $134468$.</p>
<p>Similarly if no digit is exceeded by the digit to its right it is called a decreasing number; for example, $66420$.</p>
<p>We shall call a positive integer that is neither increasing nor decreasing a "bouncy" number; for example, $155349$.</p>
<p>As $n$ increases, the proportion of bouncy numbers below $n$ increases such that there are only $12951$ numbers below one-million that are not bouncy and only $277032$ non-bouncy numbers below $10^{10}$.</p>
<p>How many numbers below a googol ($10^{100}$) are not bouncy?</p> | 51161058134250 | Friday, 10th February 2006, 06:00 pm | 12285 | 30% | easy |
508 | Integers in Base $i-1$ | Consider the Gaussian integer $i-1$. A base $i-1$ representation of a Gaussian integer $a+bi$ is a finite sequence of digits $d_{n - 1}d_{n - 2}\cdots d_1 d_0$ such that:
$a+bi = d_{n - 1}(i - 1)^{n - 1} + d_{n - 2}(i - 1)^{n - 2} + \cdots + d_1(i - 1) + d_0$
Each $d_k$ is in $\{0,1\}$
There are no leading zeroes, i.e. $d_{n-1} \ne 0$, unless $a+bi$ is itself $0$
Here are base $i-1$ representations of a few Gaussian integers:
$11+24i \to 111010110001101$
$24-11i \to 110010110011$
$8+0i \to 111000000$
$-5+0i \to 11001101$
$0+0i \to 0$
Remarkably, every Gaussian integer has a unique base $i-1$ representation!
Define $f(a + bi)$ as the number of $1$s in the unique base $i-1$ representation of $a + bi$. For example, $f(11+24i) = 9$ and $f(24-11i) = 7$.
Define $B(L)$ as the sum of $f(a + bi)$ for all integers $a, b$ such that $|a| \le L$ and $|b| \le L$. For example, $B(500) = 10795060$.
Find $B(10^{15}) \bmod 1\,000\,000\,007$. | Consider the Gaussian integer $i-1$. A base $i-1$ representation of a Gaussian integer $a+bi$ is a finite sequence of digits $d_{n - 1}d_{n - 2}\cdots d_1 d_0$ such that:
$a+bi = d_{n - 1}(i - 1)^{n - 1} + d_{n - 2}(i - 1)^{n - 2} + \cdots + d_1(i - 1) + d_0$
Each $d_k$ is in $\{0,1\}$
There are no leading zeroes, i.e. $d_{n-1} \ne 0$, unless $a+bi$ is itself $0$
Here are base $i-1$ representations of a few Gaussian integers:
$11+24i \to 111010110001101$
$24-11i \to 110010110011$
$8+0i \to 111000000$
$-5+0i \to 11001101$
$0+0i \to 0$
Remarkably, every Gaussian integer has a unique base $i-1$ representation!
Define $f(a + bi)$ as the number of $1$s in the unique base $i-1$ representation of $a + bi$. For example, $f(11+24i) = 9$ and $f(24-11i) = 7$.
Define $B(L)$ as the sum of $f(a + bi)$ for all integers $a, b$ such that $|a| \le L$ and $|b| \le L$. For example, $B(500) = 10795060$.
Find $B(10^{15}) \bmod 1\,000\,000\,007$. | <p>Consider the Gaussian integer $i-1$. A <strong>base $i-1$ representation</strong> of a Gaussian integer $a+bi$ is a finite sequence of digits $d_{n - 1}d_{n - 2}\cdots d_1 d_0$ such that:</p>
<ul><li>$a+bi = d_{n - 1}(i - 1)^{n - 1} + d_{n - 2}(i - 1)^{n - 2} + \cdots + d_1(i - 1) + d_0$</li>
<li>Each $d_k$ is in $\{0,1\}$</li>
<li>There are no leading zeroes, i.e. $d_{n-1} \ne 0$, unless $a+bi$ is itself $0$</li>
</ul><p>Here are base $i-1$ representations of a few Gaussian integers:<br/><br/>
$11+24i \to 111010110001101$<br/>
$24-11i \to 110010110011$<br/>
$8+0i \to 111000000$<br/>
$-5+0i \to 11001101$<br/>
$0+0i \to 0$</p>
<p>
Remarkably, every Gaussian integer has a unique base $i-1$ representation!</p>
<p>
Define $f(a + bi)$ as the number of $1$s in the unique base $i-1$ representation of $a + bi$. For example, $f(11+24i) = 9$ and $f(24-11i) = 7$.</p>
<p>
Define $B(L)$ as the sum of $f(a + bi)$ for all integers $a, b$ such that $|a| \le L$ and $|b| \le L$. For example, $B(500) = 10795060$.</p>
<p>
Find $B(10^{15}) \bmod 1\,000\,000\,007$.</p> | 891874596 | Sunday, 22nd March 2015, 10:00 am | 261 | 85% | hard |
19 | Counting Sundays | You are given the following information, but you may prefer to do some research for yourself.
1 Jan 1900 was a Monday.
Thirty days has September,
April, June and November.
All the rest have thirty-one,
Saving February alone,
Which has twenty-eight, rain or shine.
And on leap years, twenty-nine.
A leap year occurs on any year evenly divisible by 4, but not on a century unless it is divisible by 400.
How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)? | You are given the following information, but you may prefer to do some research for yourself.
1 Jan 1900 was a Monday.
Thirty days has September,
April, June and November.
All the rest have thirty-one,
Saving February alone,
Which has twenty-eight, rain or shine.
And on leap years, twenty-nine.
A leap year occurs on any year evenly divisible by 4, but not on a century unless it is divisible by 400.
How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)? | <p>You are given the following information, but you may prefer to do some research for yourself.</p>
<ul><li>1 Jan 1900 was a Monday.</li>
<li>Thirty days has September,<br>
April, June and November.<br/>
All the rest have thirty-one,<br/>
Saving February alone,<br/>
Which has twenty-eight, rain or shine.<br/>
And on leap years, twenty-nine.</br></li>
<li>A leap year occurs on any year evenly divisible by 4, but not on a century unless it is divisible by 400.</li>
</ul><p>How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)?</p> | 171 | Friday, 14th June 2002, 06:00 pm | 145831 | 5% | easy |
666 | Polymorphic Bacteria | Members of a species of bacteria occur in two different types: $\alpha$ and $\beta$. Individual bacteria are capable of multiplying and mutating between the types according to the following rules:
Every minute, each individual will simultaneously undergo some kind of transformation.
Each individual $A$ of type $\alpha$ will, independently, do one of the following (at random with equal probability):
clone itself, resulting in a new bacterium of type $\alpha$ (alongside $A$ who remains)
split into 3 new bacteria of type $\beta$ (replacing $A$)
Each individual $B$ of type $\beta$ will, independently, do one of the following (at random with equal probability):
spawn a new bacterium of type $\alpha$ (alongside $B$ who remains)
die
If a population starts with a single bacterium of type $\alpha$, then it can be shown that there is a 0.07243802 probability that the population will eventually die out, and a 0.92756198 probability that the population will last forever. These probabilities are given rounded to 8 decimal places.
Now consider another species of bacteria, $S_{k,m}$ (where $k$ and $m$ are positive integers), which occurs in $k$ different types $\alpha_i$ for $0\le i< k$. The rules governing this species' lifecycle involve the sequence $r_n$ defined by:
$r_0 = 306$
$r_{n+1} = r_n^2 \bmod 10\,007$
Every minute, for each $i$, each bacterium $A$ of type $\alpha_i$ will independently choose an integer $j$ uniformly at random in the range $0\le j<m$. What it then does depends on $q = r_{im+j} \bmod 5$:
If $q=0$, $A$ dies.
If $q=1$, $A$ clones itself, resulting in a new bacterium of type $\alpha_i$ (alongside $A$ who remains).
If $q=2$, $A$ mutates, changing into type $\alpha_{(2i) \bmod k}$.
If $q=3$, $A$ splits into 3 new bacteria of type $\alpha_{(i^2+1) \bmod k}$ (replacing $A$).
If $q=4$, $A$ spawns a new bacterium of type $\alpha_{(i+1) \bmod k}$ (alongside $A$ who remains).
In fact, our original species was none other than $S_{2,2}$, with $\alpha=\alpha_0$ and $\beta=\alpha_1$.
Let $P_{k,m}$ be the probability that a population of species $S_{k,m}$, starting with a single bacterium of type $\alpha_0$, will eventually die out. So $P_{2,2} = 0.07243802$. You are also given that $P_{4,3} = 0.18554021$ and $P_{10,5} = 0.53466253$, all rounded to 8 decimal places.
Find $P_{500,10}$, and give your answer rounded to 8 decimal places. | Members of a species of bacteria occur in two different types: $\alpha$ and $\beta$. Individual bacteria are capable of multiplying and mutating between the types according to the following rules:
Every minute, each individual will simultaneously undergo some kind of transformation.
Each individual $A$ of type $\alpha$ will, independently, do one of the following (at random with equal probability):
clone itself, resulting in a new bacterium of type $\alpha$ (alongside $A$ who remains)
split into 3 new bacteria of type $\beta$ (replacing $A$)
Each individual $B$ of type $\beta$ will, independently, do one of the following (at random with equal probability):
spawn a new bacterium of type $\alpha$ (alongside $B$ who remains)
die
If a population starts with a single bacterium of type $\alpha$, then it can be shown that there is a 0.07243802 probability that the population will eventually die out, and a 0.92756198 probability that the population will last forever. These probabilities are given rounded to 8 decimal places.
Now consider another species of bacteria, $S_{k,m}$ (where $k$ and $m$ are positive integers), which occurs in $k$ different types $\alpha_i$ for $0\le i< k$. The rules governing this species' lifecycle involve the sequence $r_n$ defined by:
$r_0 = 306$
$r_{n+1} = r_n^2 \bmod 10\,007$
Every minute, for each $i$, each bacterium $A$ of type $\alpha_i$ will independently choose an integer $j$ uniformly at random in the range $0\le j<m$. What it then does depends on $q = r_{im+j} \bmod 5$:
If $q=0$, $A$ dies.
If $q=1$, $A$ clones itself, resulting in a new bacterium of type $\alpha_i$ (alongside $A$ who remains).
If $q=2$, $A$ mutates, changing into type $\alpha_{(2i) \bmod k}$.
If $q=3$, $A$ splits into 3 new bacteria of type $\alpha_{(i^2+1) \bmod k}$ (replacing $A$).
If $q=4$, $A$ spawns a new bacterium of type $\alpha_{(i+1) \bmod k}$ (alongside $A$ who remains).
In fact, our original species was none other than $S_{2,2}$, with $\alpha=\alpha_0$ and $\beta=\alpha_1$.
Let $P_{k,m}$ be the probability that a population of species $S_{k,m}$, starting with a single bacterium of type $\alpha_0$, will eventually die out. So $P_{2,2} = 0.07243802$. You are also given that $P_{4,3} = 0.18554021$ and $P_{10,5} = 0.53466253$, all rounded to 8 decimal places.
Find $P_{500,10}$, and give your answer rounded to 8 decimal places. | Members of a species of bacteria occur in two different types: $\alpha$ and $\beta$. Individual bacteria are capable of multiplying and mutating between the types according to the following rules:
<ul><li>Every minute, each individual will simultaneously undergo some kind of transformation.</li>
<li>Each individual $A$ of type $\alpha$ will, independently, do one of the following (at random with equal probability):
<ul><li>clone itself, resulting in a new bacterium of type $\alpha$ (alongside $A$ who remains)</li>
<li>split into 3 new bacteria of type $\beta$ (replacing $A$)</li>
</ul></li>
<li>Each individual $B$ of type $\beta$ will, independently, do one of the following (at random with equal probability):
<ul><li>spawn a new bacterium of type $\alpha$ (alongside $B$ who remains)</li>
<li>die</li>
</ul></li></ul><p>
If a population starts with a single bacterium of type $\alpha$, then it can be shown that there is a 0.07243802 probability that the population will eventually die out, and a 0.92756198 probability that the population will last forever. These probabilities are given rounded to 8 decimal places.
</p>
<p>
Now consider another species of bacteria, $S_{k,m}$ (where $k$ and $m$ are positive integers), which occurs in $k$ different types $\alpha_i$ for $0\le i< k$. The rules governing this species' lifecycle involve the sequence $r_n$ defined by:
</p>
<ul style="list-style-type:none;"><li>$r_0 = 306$</li>
<li>$r_{n+1} = r_n^2 \bmod 10\,007$</li>
</ul><p>
Every minute, for each $i$, each bacterium $A$ of type $\alpha_i$ will independently choose an integer $j$ uniformly at random in the range $0\le j<m$. What it then does depends on $q = r_{im+j} \bmod 5$:</p>
<ul><li>If $q=0$, $A$ dies.</li>
<li>If $q=1$, $A$ clones itself, resulting in a new bacterium of type $\alpha_i$ (alongside $A$ who remains).</li>
<li>If $q=2$, $A$ mutates, changing into type $\alpha_{(2i) \bmod k}$.</li>
<li>If $q=3$, $A$ splits into 3 new bacteria of type $\alpha_{(i^2+1) \bmod k}$ (replacing $A$).</li>
<li>If $q=4$, $A$ spawns a new bacterium of type $\alpha_{(i+1) \bmod k}$ (alongside $A$ who remains).</li>
</ul><p>
In fact, our original species was none other than $S_{2,2}$, with $\alpha=\alpha_0$ and $\beta=\alpha_1$.
</p>
<p>
Let $P_{k,m}$ be the probability that a population of species $S_{k,m}$, starting with a single bacterium of type $\alpha_0$, will eventually die out. So $P_{2,2} = 0.07243802$. You are also given that $P_{4,3} = 0.18554021$ and $P_{10,5} = 0.53466253$, all rounded to 8 decimal places.
</p>
<p>
Find $P_{500,10}$, and give your answer rounded to 8 decimal places.
</p> | 0.48023168 | Saturday, 20th April 2019, 01:00 pm | 322 | 45% | medium |
524 | First Sort II | Consider the following algorithm for sorting a list:
1. Starting from the beginning of the list, check each pair of adjacent elements in turn.
2. If the elements are out of order:
a. Move the smallest element of the pair at the beginning of the list.
b. Restart the process from step 1.
3. If all pairs are in order, stop.
For example, the list $\{\,4\,1\,3\,2\,\}$ is sorted as follows:
$\underline{4\,1}\,3\,2$ ($4$ and $1$ are out of order so move $1$ to the front of the list)
$1\,\underline{4\,3}\,2$ ($4$ and $3$ are out of order so move $3$ to the front of the list)
$\underline{3\,1}\,4\,2$ ($3$ and $1$ are out of order so move $1$ to the front of the list)
$1\,3\,\underline{4\,2}$ ($4$ and $2$ are out of order so move $2$ to the front of the list)
$\underline{2\,1}\,3\,4$ ($2$ and $1$ are out of order so move $1$ to the front of the list)
$1\,2\,3\,4$ (The list is now sorted)
Let $F(L)$ be the number of times step 2a is executed to sort list $L$. For example, $F(\{\,4\,1\,3\,2\,\}) = 5$.
We can list all permutations $P$ of the integers $\{1, 2, \dots, n\}$ in lexicographical order, and assign to each permutation an index $I_n(P)$ from $1$ to $n!$ corresponding to its position in the list.
Let $Q(n, k) = \min(I_n(P))$ for $F(P) = k$, the index of the first permutation requiring exactly $k$ steps to sort with First Sort. If there is no permutation for which $F(P) = k$, then $Q(n, k)$ is undefined.
For $n = 4$ we have:
PI4(P)F(P)
{1, 2, 3, 4}10Q(4, 0) = 1
{1, 2, 4, 3}24Q(4, 4) = 2
{1, 3, 2, 4}32Q(4, 2) = 3
{1, 3, 4, 2}42
{1, 4, 2, 3}56Q(4, 6) = 5
{1, 4, 3, 2}64
{2, 1, 3, 4}71Q(4, 1) = 7
{2, 1, 4, 3}85Q(4, 5) = 8
{2, 3, 1, 4}91
{2, 3, 4, 1}101
{2, 4, 1, 3}115
{2, 4, 3, 1}123Q(4, 3) = 12
{3, 1, 2, 4}133
{3, 1, 4, 2}143
{3, 2, 1, 4}152
{3, 2, 4, 1}162
{3, 4, 1, 2}173
{3, 4, 2, 1}182
{4, 1, 2, 3}197Q(4, 7) = 19
{4, 1, 3, 2}205
{4, 2, 1, 3}216
{4, 2, 3, 1}224
{4, 3, 1, 2}234
{4, 3, 2, 1}243
Let $R(k) = \min(Q(n, k))$ over all $n$ for which $Q(n, k)$ is defined.
Find $R(12^{12})$. | Consider the following algorithm for sorting a list:
1. Starting from the beginning of the list, check each pair of adjacent elements in turn.
2. If the elements are out of order:
a. Move the smallest element of the pair at the beginning of the list.
b. Restart the process from step 1.
3. If all pairs are in order, stop.
For example, the list $\{\,4\,1\,3\,2\,\}$ is sorted as follows:
$\underline{4\,1}\,3\,2$ ($4$ and $1$ are out of order so move $1$ to the front of the list)
$1\,\underline{4\,3}\,2$ ($4$ and $3$ are out of order so move $3$ to the front of the list)
$\underline{3\,1}\,4\,2$ ($3$ and $1$ are out of order so move $1$ to the front of the list)
$1\,3\,\underline{4\,2}$ ($4$ and $2$ are out of order so move $2$ to the front of the list)
$\underline{2\,1}\,3\,4$ ($2$ and $1$ are out of order so move $1$ to the front of the list)
$1\,2\,3\,4$ (The list is now sorted)
Let $F(L)$ be the number of times step 2a is executed to sort list $L$. For example, $F(\{\,4\,1\,3\,2\,\}) = 5$.
We can list all permutations $P$ of the integers $\{1, 2, \dots, n\}$ in lexicographical order, and assign to each permutation an index $I_n(P)$ from $1$ to $n!$ corresponding to its position in the list.
Let $Q(n, k) = \min(I_n(P))$ for $F(P) = k$, the index of the first permutation requiring exactly $k$ steps to sort with First Sort. If there is no permutation for which $F(P) = k$, then $Q(n, k)$ is undefined.
For $n = 4$ we have:
PI4(P)F(P)
{1, 2, 3, 4}10Q(4, 0) = 1
{1, 2, 4, 3}24Q(4, 4) = 2
{1, 3, 2, 4}32Q(4, 2) = 3
{1, 3, 4, 2}42
{1, 4, 2, 3}56Q(4, 6) = 5
{1, 4, 3, 2}64
{2, 1, 3, 4}71Q(4, 1) = 7
{2, 1, 4, 3}85Q(4, 5) = 8
{2, 3, 1, 4}91
{2, 3, 4, 1}101
{2, 4, 1, 3}115
{2, 4, 3, 1}123Q(4, 3) = 12
{3, 1, 2, 4}133
{3, 1, 4, 2}143
{3, 2, 1, 4}152
{3, 2, 4, 1}162
{3, 4, 1, 2}173
{3, 4, 2, 1}182
{4, 1, 2, 3}197Q(4, 7) = 19
{4, 1, 3, 2}205
{4, 2, 1, 3}216
{4, 2, 3, 1}224
{4, 3, 1, 2}234
{4, 3, 2, 1}243
Let $R(k) = \min(Q(n, k))$ over all $n$ for which $Q(n, k)$ is defined.
Find $R(12^{12})$. | <p>Consider the following algorithm for sorting a list:</p>
<ul style="list-style-type:none;"><li>1. Starting from the beginning of the list, check each pair of adjacent elements in turn.</li>
<li>2. If the elements are out of order:
<ul style="list-style-type:none;"><li>a. Move the smallest element of the pair at the beginning of the list.</li>
<li>b. Restart the process from step 1.</li></ul></li>
<li>3. If all pairs are in order, stop.</li></ul>
<p>For example, the list $\{\,4\,1\,3\,2\,\}$ is sorted as follows:</p>
<ul style="list-style-type:none;"><li>$\underline{4\,1}\,3\,2$ ($4$ and $1$ are out of order so move $1$ to the front of the list)</li>
<li>$1\,\underline{4\,3}\,2$ ($4$ and $3$ are out of order so move $3$ to the front of the list)</li>
<li>$\underline{3\,1}\,4\,2$ ($3$ and $1$ are out of order so move $1$ to the front of the list)</li>
<li>$1\,3\,\underline{4\,2}$ ($4$ and $2$ are out of order so move $2$ to the front of the list)</li>
<li>$\underline{2\,1}\,3\,4$ ($2$ and $1$ are out of order so move $1$ to the front of the list)</li>
<li>$1\,2\,3\,4$ (The list is now sorted)</li></ul>
<p>Let $F(L)$ be the number of times step 2a is executed to sort list $L$. For example, $F(\{\,4\,1\,3\,2\,\}) = 5$.</p>
<p>We can list all permutations $P$ of the integers $\{1, 2, \dots, n\}$ in <strong>lexicographical order</strong>, and assign to each permutation an index $I_n(P)$ from $1$ to $n!$ corresponding to its position in the list.
</p><p>Let $Q(n, k) = \min(I_n(P))$ for $F(P) = k$, the index of the first permutation requiring exactly $k$ steps to sort with First Sort. If there is no permutation for which $F(P) = k$, then $Q(n, k)$ is undefined.</p>
<p>For $n = 4$ we have:</p>
<p></p><table border="1" style="text-align:left;">
<tr><th><var>P</var></th><th><var>I</var><sub>4</sub>(<var>P</var>)</th><th><var>F</var>(<var>P</var>)</th><th></th></tr>
<tr><td>{1, 2, 3, 4}</td><td>1</td><td>0</td><td>Q(4, 0) = 1</td></tr>
<tr><td>{1, 2, 4, 3}</td><td>2</td><td>4</td><td>Q(4, 4) = 2</td></tr>
<tr><td>{1, 3, 2, 4}</td><td>3</td><td>2</td><td>Q(4, 2) = 3</td></tr>
<tr><td>{1, 3, 4, 2}</td><td>4</td><td>2</td><td></td></tr>
<tr><td>{1, 4, 2, 3}</td><td>5</td><td>6</td><td>Q(4, 6) = 5</td></tr>
<tr><td>{1, 4, 3, 2}</td><td>6</td><td>4</td><td></td></tr>
<tr><td>{2, 1, 3, 4}</td><td>7</td><td>1</td><td>Q(4, 1) = 7</td></tr>
<tr><td>{2, 1, 4, 3}</td><td>8</td><td>5</td><td>Q(4, 5) = 8</td></tr>
<tr><td>{2, 3, 1, 4}</td><td>9</td><td>1</td><td></td></tr>
<tr><td>{2, 3, 4, 1}</td><td>10</td><td>1</td><td></td></tr>
<tr><td>{2, 4, 1, 3}</td><td>11</td><td>5</td><td></td></tr>
<tr><td>{2, 4, 3, 1}</td><td>12</td><td>3</td><td>Q(4, 3) = 12</td></tr>
<tr><td>{3, 1, 2, 4}</td><td>13</td><td>3</td><td></td></tr>
<tr><td>{3, 1, 4, 2}</td><td>14</td><td>3</td><td></td></tr>
<tr><td>{3, 2, 1, 4}</td><td>15</td><td>2</td><td></td></tr>
<tr><td>{3, 2, 4, 1}</td><td>16</td><td>2</td><td></td></tr>
<tr><td>{3, 4, 1, 2}</td><td>17</td><td>3</td><td></td></tr>
<tr><td>{3, 4, 2, 1}</td><td>18</td><td>2</td><td></td></tr>
<tr><td>{4, 1, 2, 3}</td><td>19</td><td>7</td><td>Q(4, 7) = 19</td></tr>
<tr><td>{4, 1, 3, 2}</td><td>20</td><td>5</td><td></td></tr>
<tr><td>{4, 2, 1, 3}</td><td>21</td><td>6</td><td></td></tr>
<tr><td>{4, 2, 3, 1}</td><td>22</td><td>4</td><td></td></tr>
<tr><td>{4, 3, 1, 2}</td><td>23</td><td>4</td><td></td></tr>
<tr><td>{4, 3, 2, 1}</td><td>24</td><td>3</td><td></td></tr>
</table>
<p>Let $R(k) = \min(Q(n, k))$ over all $n$ for which $Q(n, k)$ is defined.</p>
<p>Find $R(12^{12})$.</p> | 2432925835413407847 | Sunday, 6th September 2015, 07:00 am | 247 | 75% | hard |
158 | Lexicographical Neighbours | Taking three different letters from the $26$ letters of the alphabet, character strings of length three can be formed.
Examples are 'abc', 'hat' and 'zyx'.
When we study these three examples we see that for 'abc' two characters come lexicographically after its neighbour to the left.
For 'hat' there is exactly one character that comes lexicographically after its neighbour to the left. For 'zyx' there are zero characters that come lexicographically after its neighbour to the left.
In all there are $10400$ strings of length $3$ for which exactly one character comes lexicographically after its neighbour to the left.
We now consider strings of $n \le 26$ different characters from the alphabet.
For every $n$, $p(n)$ is the number of strings of length $n$ for which exactly one character comes lexicographically after its neighbour to the left.
What is the maximum value of $p(n)$? | Taking three different letters from the $26$ letters of the alphabet, character strings of length three can be formed.
Examples are 'abc', 'hat' and 'zyx'.
When we study these three examples we see that for 'abc' two characters come lexicographically after its neighbour to the left.
For 'hat' there is exactly one character that comes lexicographically after its neighbour to the left. For 'zyx' there are zero characters that come lexicographically after its neighbour to the left.
In all there are $10400$ strings of length $3$ for which exactly one character comes lexicographically after its neighbour to the left.
We now consider strings of $n \le 26$ different characters from the alphabet.
For every $n$, $p(n)$ is the number of strings of length $n$ for which exactly one character comes lexicographically after its neighbour to the left.
What is the maximum value of $p(n)$? | <p>Taking three different letters from the $26$ letters of the alphabet, character strings of length three can be formed.<br/>
Examples are 'abc', 'hat' and 'zyx'.<br/>
When we study these three examples we see that for 'abc' two characters come lexicographically after its neighbour to the left.<br/>
For 'hat' there is exactly one character that comes lexicographically after its neighbour to the left. For 'zyx' there are zero characters that come lexicographically after its neighbour to the left.<br/>
In all there are $10400$ strings of length $3$ for which exactly one character comes lexicographically after its neighbour to the left.</p>
<p>We now consider strings of $n \le 26$ different characters from the alphabet.<br/>
For every $n$, $p(n)$ is the number of strings of length $n$ for which exactly one character comes lexicographically after its neighbour to the left.</p>
<p>What is the maximum value of $p(n)$?</p> | 409511334375 | Friday, 15th June 2007, 02:00 pm | 4057 | 55% | medium |
206 | Concealed Square | Find the unique positive integer whose square has the form 1_2_3_4_5_6_7_8_9_0, where each “_” is a single digit. | Find the unique positive integer whose square has the form 1_2_3_4_5_6_7_8_9_0, where each “_” is a single digit. | <p>Find the unique positive integer whose square has the form 1_2_3_4_5_6_7_8_9_0,<br> where each “_” is a single digit.</br></p> | 1389019170 | Saturday, 6th September 2008, 02:00 pm | 26343 | 5% | easy |
336 | Maximix Arrangements | A train is used to transport four carriages in the order: ABCD. However, sometimes when the train arrives to collect the carriages they are not in the correct order.
To rearrange the carriages they are all shunted on to a large rotating turntable. After the carriages are uncoupled at a specific point the train moves off the turntable pulling the carriages still attached with it. The remaining carriages are rotated 180 degrees. All of the carriages are then rejoined and this process is repeated as often as necessary in order to obtain the least number of uses of the turntable.
Some arrangements, such as ADCB, can be solved easily: the carriages are separated between A and D, and after DCB are rotated the correct order has been achieved.
However, Simple Simon, the train driver, is not known for his efficiency, so he always solves the problem by initially getting carriage A in the correct place, then carriage B, and so on.
Using four carriages, the worst possible arrangements for Simon, which we shall call maximix arrangements, are DACB and DBAC; each requiring him five rotations (although, using the most efficient approach, they could be solved using just three rotations). The process he uses for DACB is shown below.
It can be verified that there are 24 maximix arrangements for six carriages, of which the tenth lexicographic maximix arrangement is DFAECB.
Find the 2011th lexicographic maximix arrangement for eleven carriages. | A train is used to transport four carriages in the order: ABCD. However, sometimes when the train arrives to collect the carriages they are not in the correct order.
To rearrange the carriages they are all shunted on to a large rotating turntable. After the carriages are uncoupled at a specific point the train moves off the turntable pulling the carriages still attached with it. The remaining carriages are rotated 180 degrees. All of the carriages are then rejoined and this process is repeated as often as necessary in order to obtain the least number of uses of the turntable.
Some arrangements, such as ADCB, can be solved easily: the carriages are separated between A and D, and after DCB are rotated the correct order has been achieved.
However, Simple Simon, the train driver, is not known for his efficiency, so he always solves the problem by initially getting carriage A in the correct place, then carriage B, and so on.
Using four carriages, the worst possible arrangements for Simon, which we shall call maximix arrangements, are DACB and DBAC; each requiring him five rotations (although, using the most efficient approach, they could be solved using just three rotations). The process he uses for DACB is shown below.
It can be verified that there are 24 maximix arrangements for six carriages, of which the tenth lexicographic maximix arrangement is DFAECB.
Find the 2011th lexicographic maximix arrangement for eleven carriages. | <p>A train is used to transport four carriages in the order: ABCD. However, sometimes when the train arrives to collect the carriages they are not in the correct order. <br>
To rearrange the carriages they are all shunted on to a large rotating turntable. After the carriages are uncoupled at a specific point the train moves off the turntable pulling the carriages still attached with it. The remaining carriages are rotated 180 degrees. All of the carriages are then rejoined and this process is repeated as often as necessary in order to obtain the least number of uses of the turntable.<br/>
Some arrangements, such as ADCB, can be solved easily: the carriages are separated between A and D, and after DCB are rotated the correct order has been achieved.</br></p>
<p>However, Simple Simon, the train driver, is not known for his efficiency, so he always solves the problem by initially getting carriage A in the correct place, then carriage B, and so on.</p>
<p>Using four carriages, the worst possible arrangements for Simon, which we shall call <i>maximix arrangements</i>, are DACB and DBAC; each requiring him five rotations (although, using the most efficient approach, they could be solved using just three rotations). The process he uses for DACB is shown below.</p>
<div align="center"><img alt="p336_maximix.gif" class="dark_img" src="project/images/p336_maximix.gif"/></div>
<p>It can be verified that there are 24 maximix arrangements for six carriages, of which the tenth lexicographic maximix arrangement is DFAECB.</p>
<p>Find the 2011<sup>th</sup> lexicographic maximix arrangement for eleven carriages.</p> | CAGBIHEFJDK | Saturday, 30th April 2011, 07:00 pm | 2264 | 25% | easy |
459 | Flipping Game | The flipping game is a two player game played on an $N$ by $N$ square board.
Each square contains a disk with one side white and one side black.
The game starts with all disks showing their white side.
A turn consists of flipping all disks in a rectangle with the following properties:
the upper right corner of the rectangle contains a white disk
the rectangle width is a perfect square ($1$, $4$, $9$, $16$, ...)
the rectangle height is a triangular numberThe triangular numbers are defined as $\frac 1 2 n(n + 1)$ for positive integer $n$. ($1$, $3$, $6$, $10$, ...)
Players alternate turns. A player wins by turning the grid all black.
Let $W(N)$ be the number of winning movesThe first move of a strategy that ensures a win no matter what the opponent plays. for the first player on an $N$ by $N$ board with all disks white, assuming perfect play.
$W(1) = 1$, $W(2) = 0$, $W(5) = 8$ and $W(10^2) = 31395$.
For $N=5$, the first player's eight winning first moves are:
Find $W(10^6)$. | The flipping game is a two player game played on an $N$ by $N$ square board.
Each square contains a disk with one side white and one side black.
The game starts with all disks showing their white side.
A turn consists of flipping all disks in a rectangle with the following properties:
the upper right corner of the rectangle contains a white disk
the rectangle width is a perfect square ($1$, $4$, $9$, $16$, ...)
the rectangle height is a triangular numberThe triangular numbers are defined as $\frac 1 2 n(n + 1)$ for positive integer $n$. ($1$, $3$, $6$, $10$, ...)
Players alternate turns. A player wins by turning the grid all black.
Let $W(N)$ be the number of winning movesThe first move of a strategy that ensures a win no matter what the opponent plays. for the first player on an $N$ by $N$ board with all disks white, assuming perfect play.
$W(1) = 1$, $W(2) = 0$, $W(5) = 8$ and $W(10^2) = 31395$.
For $N=5$, the first player's eight winning first moves are:
Find $W(10^6)$. | <p>The flipping game is a two player game played on an $N$ by $N$ square board.<br/>
Each square contains a disk with one side white and one side black.<br/>
The game starts with all disks showing their white side.</p>
<p>A turn consists of flipping all disks in a rectangle with the following properties:
</p><p></p><ul><li>the upper right corner of the rectangle contains a white disk</li>
<li>the rectangle width is a perfect square ($1$, $4$, $9$, $16$, ...)</li>
<li>the rectangle height is a <strong class="tooltip">triangular number<span class="tooltiptext">The triangular numbers are defined as $\frac 1 2 n(n + 1)$ for positive integer $n$.</span></strong> ($1$, $3$, $6$, $10$, ...)</li>
</ul>
<p class="center"><img alt="0459-flipping-game-0.png" src="resources/images/0459-flipping-game-0.png?1678992053"/></p>
<p>Players alternate turns. A player wins by turning the grid all black.</p>
<p>Let $W(N)$ be the number of <strong class="tooltip">winning moves<span class="tooltiptext">The first move of a strategy that ensures a win no matter what the opponent plays.</span></strong> for the first player on an $N$ by $N$ board with all disks white, assuming perfect play.<br/>
$W(1) = 1$, $W(2) = 0$, $W(5) = 8$ and $W(10^2) = 31395$.</p>
<p>For $N=5$, the first player's eight winning first moves are:</p>
<p class="center"><img alt="0459-flipping-game-1.png" class="dark_img" src="resources/images/0459-flipping-game-1.png?1678992053"/></p>
<p>Find $W(10^6)$.</p> | 3996390106631 | Sunday, 16th February 2014, 10:00 am | 262 | 100% | hard |
224 | Almost Right-angled Triangles II | Let us call an integer sided triangle with sides $a \le b \le c$ barely obtuse if the sides satisfy $a^2 + b^2 = c^2 - 1$.
How many barely obtuse triangles are there with perimeter $\le 75\,000\,000$? | Let us call an integer sided triangle with sides $a \le b \le c$ barely obtuse if the sides satisfy $a^2 + b^2 = c^2 - 1$.
How many barely obtuse triangles are there with perimeter $\le 75\,000\,000$? | <p>Let us call an integer sided triangle with sides $a \le b \le c$ <dfn>barely obtuse</dfn> if the sides satisfy <br/>$a^2 + b^2 = c^2 - 1$.</p>
<p>How many barely obtuse triangles are there with perimeter $\le 75\,000\,000$?</p> | 4137330 | Friday, 26th December 2008, 05:00 pm | 1405 | 75% | hard |
854 | Pisano Periods 2 | For every positive integer $n$ the Fibonacci sequence modulo $n$ is periodic. The period depends on the value of $n$.
This period is called the Pisano period for $n$, often shortened to $\pi(n)$.
Define $M(p)$ as the largest integer $n$ such that $\pi(n) = p$, and define $M(p) = 1$ if there is no such $n$.
For example, there are three values of $n$ for which $\pi(n)$ equals $18$: $19, 38, 76$. Therefore $M(18) = 76$.
Let the product function $P(n)$ be: $$P(n)=\prod_{p = 1}^{n}M(p).$$
You are given: $P(10)=264$.
Find $P(1\,000\,000)\bmod 1\,234\,567\,891$. | For every positive integer $n$ the Fibonacci sequence modulo $n$ is periodic. The period depends on the value of $n$.
This period is called the Pisano period for $n$, often shortened to $\pi(n)$.
Define $M(p)$ as the largest integer $n$ such that $\pi(n) = p$, and define $M(p) = 1$ if there is no such $n$.
For example, there are three values of $n$ for which $\pi(n)$ equals $18$: $19, 38, 76$. Therefore $M(18) = 76$.
Let the product function $P(n)$ be: $$P(n)=\prod_{p = 1}^{n}M(p).$$
You are given: $P(10)=264$.
Find $P(1\,000\,000)\bmod 1\,234\,567\,891$. | <p>
For every positive integer $n$ the Fibonacci sequence modulo $n$ is periodic. The period depends on the value of $n$.
This period is called the <strong>Pisano period</strong> for $n$, often shortened to $\pi(n)$.</p>
<p>
Define $M(p)$ as the largest integer $n$ such that $\pi(n) = p$, and define $M(p) = 1$ if there is no such $n$.<br/>
For example, there are three values of $n$ for which $\pi(n)$ equals $18$: $19, 38, 76$. Therefore $M(18) = 76$.</p>
<p>
Let the product function $P(n)$ be: $$P(n)=\prod_{p = 1}^{n}M(p).$$
You are given: $P(10)=264$.</p>
<p>
Find $P(1\,000\,000)\bmod 1\,234\,567\,891$.</p> | 29894398 | Saturday, 9th September 2023, 05:00 pm | 365 | 40% | medium |
579 | Lattice Points in Lattice Cubes | A lattice cube is a cube in which all vertices have integer coordinates. Let $C(n)$ be the number of different lattice cubes in which the coordinates of all vertices range between (and including) $0$ and $n$. Two cubes are hereby considered different if any of their vertices have different coordinates.
For example, $C(1)=1$, $C(2)=9$, $C(4)=100$, $C(5)=229$, $C(10)=4469$ and $C(50)=8154671$.
Different cubes may contain different numbers of lattice points.
For example, the cube with the vertices
$(0, 0, 0)$, $(3, 0, 0)$, $(0, 3, 0)$, $(0, 0, 3)$, $(0, 3, 3)$, $(3, 0, 3)$, $(3, 3, 0)$, $(3, 3, 3)$ contains $64$ lattice points ($56$ lattice points on the surface including the $8$ vertices and $8$ points within the cube).
In contrast, the cube with the vertices
$(0, 2, 2)$, $(1, 4, 4)$, $(2, 0, 3)$, $(2, 3, 0)$, $(3, 2, 5)$, $(3, 5, 2)$, $(4, 1, 1)$, $(5, 3, 3)$ contains only $40$ lattice points ($20$ points on the surface and $20$ points within the cube), although both cubes have the same side length $3$.
Let $S(n)$ be the sum of the lattice points contained in the different lattice cubes in which the coordinates of all vertices range between (and including) $0$ and $n$.
For example, $S(1)=8$, $S(2)=91$, $S(4)=1878$, $S(5)=5832$, $S(10)=387003$ and $S(50)=29948928129$.
Find $S(5000) \bmod 10^9$. | A lattice cube is a cube in which all vertices have integer coordinates. Let $C(n)$ be the number of different lattice cubes in which the coordinates of all vertices range between (and including) $0$ and $n$. Two cubes are hereby considered different if any of their vertices have different coordinates.
For example, $C(1)=1$, $C(2)=9$, $C(4)=100$, $C(5)=229$, $C(10)=4469$ and $C(50)=8154671$.
Different cubes may contain different numbers of lattice points.
For example, the cube with the vertices
$(0, 0, 0)$, $(3, 0, 0)$, $(0, 3, 0)$, $(0, 0, 3)$, $(0, 3, 3)$, $(3, 0, 3)$, $(3, 3, 0)$, $(3, 3, 3)$ contains $64$ lattice points ($56$ lattice points on the surface including the $8$ vertices and $8$ points within the cube).
In contrast, the cube with the vertices
$(0, 2, 2)$, $(1, 4, 4)$, $(2, 0, 3)$, $(2, 3, 0)$, $(3, 2, 5)$, $(3, 5, 2)$, $(4, 1, 1)$, $(5, 3, 3)$ contains only $40$ lattice points ($20$ points on the surface and $20$ points within the cube), although both cubes have the same side length $3$.
Let $S(n)$ be the sum of the lattice points contained in the different lattice cubes in which the coordinates of all vertices range between (and including) $0$ and $n$.
For example, $S(1)=8$, $S(2)=91$, $S(4)=1878$, $S(5)=5832$, $S(10)=387003$ and $S(50)=29948928129$.
Find $S(5000) \bmod 10^9$. | <p>A <strong>lattice cube</strong> is a cube in which all vertices have integer coordinates. Let $C(n)$ be the number of different lattice cubes in which the coordinates of all vertices range between (and including) $0$ and $n$. Two cubes are hereby considered different if any of their vertices have different coordinates.<br/>
For example, $C(1)=1$, $C(2)=9$, $C(4)=100$, $C(5)=229$, $C(10)=4469$ and $C(50)=8154671$.
</p>
<p>Different cubes may contain different numbers of lattice points.</p>
<p>
For example, the cube with the vertices<br/>
$(0, 0, 0)$, $(3, 0, 0)$, $(0, 3, 0)$, $(0, 0, 3)$, $(0, 3, 3)$, $(3, 0, 3)$, $(3, 3, 0)$, $(3, 3, 3)$ contains $64$ lattice points ($56$ lattice points on the surface including the $8$ vertices and $8$ points within the cube). </p>
<p>In contrast, the cube with the vertices<br/>
$(0, 2, 2)$, $(1, 4, 4)$, $(2, 0, 3)$, $(2, 3, 0)$, $(3, 2, 5)$, $(3, 5, 2)$, $(4, 1, 1)$, $(5, 3, 3)$ contains only $40$ lattice points ($20$ points on the surface and $20$ points within the cube), although both cubes have the same side length $3$.
</p>
<p>
Let $S(n)$ be the sum of the lattice points contained in the different lattice cubes in which the coordinates of all vertices range between (and including) $0$ and $n$.</p>
<p>For example, $S(1)=8$, $S(2)=91$, $S(4)=1878$, $S(5)=5832$, $S(10)=387003$ and $S(50)=29948928129$.</p>
<p>Find $S(5000) \bmod 10^9$.</p> | 3805524 | Sunday, 27th November 2016, 01:00 am | 189 | 100% | hard |
522 | Hilbert's Blackout | Despite the popularity of Hilbert's infinite hotel, Hilbert decided to try managing extremely large finite hotels, instead.
To cut costs, Hilbert wished to power the new hotel with his own special generator. Each floor would send power to the floor above it, with the top floor sending power back down to the bottom floor. That way, Hilbert could have the generator placed on any given floor (as he likes having the option) and have electricity flow freely throughout the entire hotel.
Unfortunately, the contractors misinterpreted the schematics when they built the hotel. They informed Hilbert that each floor sends power to another floor at random, instead. This may compromise Hilbert's freedom to have the generator placed anywhere, since blackouts could occur on certain floors.
For example, consider a sample flow diagram for a three-story hotel:
If the generator were placed on the first floor, then every floor would receive power. But if it were placed on the second or third floors instead, then there would be a blackout on the first floor. Note that while a given floor can receive power from many other floors at once, it can only send power to one other floor.
To resolve the blackout concerns, Hilbert decided to have a minimal number of floors rewired. To rewire a floor is to change the floor it sends power to. In the sample diagram above, all possible blackouts can be avoided by rewiring the second floor to send power to the first floor instead of the third floor.
Let $F(n)$ be the sum of the minimum number of floor rewirings needed over all possible power-flow arrangements in a hotel of $n$ floors. For example, $F(3) = 6$, $F(8) = 16276736$, and $F(100) \bmod 135707531 = 84326147$.
Find $F(12344321) \bmod 135707531$. | Despite the popularity of Hilbert's infinite hotel, Hilbert decided to try managing extremely large finite hotels, instead.
To cut costs, Hilbert wished to power the new hotel with his own special generator. Each floor would send power to the floor above it, with the top floor sending power back down to the bottom floor. That way, Hilbert could have the generator placed on any given floor (as he likes having the option) and have electricity flow freely throughout the entire hotel.
Unfortunately, the contractors misinterpreted the schematics when they built the hotel. They informed Hilbert that each floor sends power to another floor at random, instead. This may compromise Hilbert's freedom to have the generator placed anywhere, since blackouts could occur on certain floors.
For example, consider a sample flow diagram for a three-story hotel:
If the generator were placed on the first floor, then every floor would receive power. But if it were placed on the second or third floors instead, then there would be a blackout on the first floor. Note that while a given floor can receive power from many other floors at once, it can only send power to one other floor.
To resolve the blackout concerns, Hilbert decided to have a minimal number of floors rewired. To rewire a floor is to change the floor it sends power to. In the sample diagram above, all possible blackouts can be avoided by rewiring the second floor to send power to the first floor instead of the third floor.
Let $F(n)$ be the sum of the minimum number of floor rewirings needed over all possible power-flow arrangements in a hotel of $n$ floors. For example, $F(3) = 6$, $F(8) = 16276736$, and $F(100) \bmod 135707531 = 84326147$.
Find $F(12344321) \bmod 135707531$. | <p>Despite the popularity of Hilbert's infinite hotel, Hilbert decided to try managing extremely large finite hotels, instead.</p>
<p>To cut costs, Hilbert wished to power the new hotel with his own special generator. Each floor would send power to the floor above it, with the top floor sending power back down to the bottom floor. That way, Hilbert could have the generator placed on any given floor (as he likes having the option) and have electricity flow freely throughout the entire hotel.</p>
<p>Unfortunately, the contractors misinterpreted the schematics when they built the hotel. They informed Hilbert that each floor sends power to another floor at random, instead. This may compromise Hilbert's freedom to have the generator placed anywhere, since blackouts could occur on certain floors.</p>
<p>For example, consider a sample flow diagram for a three-story hotel:</p>
<p align="center"><img alt="0522_hilberts_blackout.png" src="resources/images/0522_hilberts_blackout.png?1678992053"/></p>
<p>If the generator were placed on the first floor, then every floor would receive power. But if it were placed on the second or third floors instead, then there would be a blackout on the first floor. Note that while a given floor can <i>receive</i> power from many other floors at once, it can only <i>send</i> power to one other floor.</p>
<p>To resolve the blackout concerns, Hilbert decided to have a minimal number of floors rewired. To rewire a floor is to change the floor it sends power to. In the sample diagram above, all possible blackouts can be avoided by rewiring the second floor to send power to the first floor instead of the third floor.</p>
<p>Let $F(n)$ be the sum of the minimum number of floor rewirings needed over all possible power-flow arrangements in a hotel of $n$ floors. For example, $F(3) = 6$, $F(8) = 16276736$, and $F(100) \bmod 135707531 = 84326147$.</p>
<p>Find $F(12344321) \bmod 135707531$.</p> | 96772715 | Sunday, 28th June 2015, 04:00 am | 295 | 85% | hard |
363 | Bézier Curves | A cubic Bézier curve is defined by four points: $P_0, P_1, P_2,$ and $P_3$.
The curve is constructed as follows:
On the segments $P_0 P_1$, $P_1 P_2$, and $P_2 P_3$ the points $Q_0, Q_1,$ and $Q_2$ are drawn such that $\dfrac{P_0 Q_0}{P_0 P_1} = \dfrac{P_1 Q_1}{P_1 P_2} = \dfrac{P_2 Q_2}{P_2 P_3} = t$, with $t$ in $[0, 1]$.
On the segments $Q_0 Q_1$ and $Q_1 Q_2$ the points $R_0$ and $R_1$ are drawn such that
$\dfrac{Q_0 R_0}{Q_0 Q_1} = \dfrac{Q_1 R_1}{Q_1 Q_2} = t$ for the same value of $t$.
On the segment $R_0 R_1$ the point $B$ is drawn such that $\dfrac{R_0 B}{R_0 R_1} = t$ for the same value of $t$.
The Bézier curve defined by the points $P_0, P_1, P_2, P_3$ is the locus of $B$ as $Q_0$ takes all possible positions on the segment $P_0 P_1$.
(Please note that for all points the value of $t$ is the same.)
From the construction it is clear that the Bézier curve will be tangent to the segments $P_0 P_1$ in $P_0$ and $P_2 P_3$ in $P_3$.
A cubic Bézier curve with $P_0 = (1, 0), P_1 = (1, v), P_2 = (v, 1),$ and $P_3 = (0, 1)$ is used to approximate a quarter circle.
The value $v \gt 0$ is chosen such that the area enclosed by the lines $O P_0, OP_3$ and the curve is equal to $\dfrac{\pi}{4}$ (the area of the quarter circle).
By how many percent does the length of the curve differ from the length of the quarter circle?
That is, if $L$ is the length of the curve, calculate $100 \times \dfrac{L - \frac{\pi}{2}}{\frac{\pi}{2}}$
Give your answer rounded to 10 digits behind the decimal point. | A cubic Bézier curve is defined by four points: $P_0, P_1, P_2,$ and $P_3$.
The curve is constructed as follows:
On the segments $P_0 P_1$, $P_1 P_2$, and $P_2 P_3$ the points $Q_0, Q_1,$ and $Q_2$ are drawn such that $\dfrac{P_0 Q_0}{P_0 P_1} = \dfrac{P_1 Q_1}{P_1 P_2} = \dfrac{P_2 Q_2}{P_2 P_3} = t$, with $t$ in $[0, 1]$.
On the segments $Q_0 Q_1$ and $Q_1 Q_2$ the points $R_0$ and $R_1$ are drawn such that
$\dfrac{Q_0 R_0}{Q_0 Q_1} = \dfrac{Q_1 R_1}{Q_1 Q_2} = t$ for the same value of $t$.
On the segment $R_0 R_1$ the point $B$ is drawn such that $\dfrac{R_0 B}{R_0 R_1} = t$ for the same value of $t$.
The Bézier curve defined by the points $P_0, P_1, P_2, P_3$ is the locus of $B$ as $Q_0$ takes all possible positions on the segment $P_0 P_1$.
(Please note that for all points the value of $t$ is the same.)
From the construction it is clear that the Bézier curve will be tangent to the segments $P_0 P_1$ in $P_0$ and $P_2 P_3$ in $P_3$.
A cubic Bézier curve with $P_0 = (1, 0), P_1 = (1, v), P_2 = (v, 1),$ and $P_3 = (0, 1)$ is used to approximate a quarter circle.
The value $v \gt 0$ is chosen such that the area enclosed by the lines $O P_0, OP_3$ and the curve is equal to $\dfrac{\pi}{4}$ (the area of the quarter circle).
By how many percent does the length of the curve differ from the length of the quarter circle?
That is, if $L$ is the length of the curve, calculate $100 \times \dfrac{L - \frac{\pi}{2}}{\frac{\pi}{2}}$
Give your answer rounded to 10 digits behind the decimal point. | <p>A cubic Bézier curve is defined by four points: $P_0, P_1, P_2,$ and $P_3$.</p>
<div class="float_right"><img alt="p363_bezier.png" class="dark_img" src="project/images/p363_bezier.png"/></div>
<p>The curve is constructed as follows:</p>
<p>On the segments $P_0 P_1$, $P_1 P_2$, and $P_2 P_3$ the points $Q_0, Q_1,$ and $Q_2$ are drawn such that $\dfrac{P_0 Q_0}{P_0 P_1} = \dfrac{P_1 Q_1}{P_1 P_2} = \dfrac{P_2 Q_2}{P_2 P_3} = t$, with $t$ in $[0, 1]$.</p>
<p>On the segments $Q_0 Q_1$ and $Q_1 Q_2$ the points $R_0$ and $R_1$ are drawn such that<br>
$\dfrac{Q_0 R_0}{Q_0 Q_1} = \dfrac{Q_1 R_1}{Q_1 Q_2} = t$ for the same value of $t$.</br></p>
<p>On the segment $R_0 R_1$ the point $B$ is drawn such that $\dfrac{R_0 B}{R_0 R_1} = t$ for the same value of $t$.</p>
<p>The Bézier curve defined by the points $P_0, P_1, P_2, P_3$ is the locus of $B$ as $Q_0$ takes all possible positions on the segment $P_0 P_1$.<br/>
(Please note that for all points the value of $t$ is the same.)</p>
<p>From the construction it is clear that the Bézier curve will be tangent to the segments $P_0 P_1$ in $P_0$ and $P_2 P_3$ in $P_3$.</p>
<p>A cubic Bézier curve with $P_0 = (1, 0), P_1 = (1, v), P_2 = (v, 1),$ and $P_3 = (0, 1)$ is used to approximate a quarter circle.<br/>
The value $v \gt 0$ is chosen such that the area enclosed by the lines $O P_0, OP_3$ and the curve is equal to $\dfrac{\pi}{4}$ (the area of the quarter circle).</p>
<p>By how many percent does the length of the curve differ from the length of the quarter circle?<br/>
That is, if $L$ is the length of the curve, calculate $100 \times \dfrac{L - \frac{\pi}{2}}{\frac{\pi}{2}}$<br/>
Give your answer rounded to 10 digits behind the decimal point.</p> | 0.0000372091 | Sunday, 18th December 2011, 10:00 am | 1248 | 35% | medium |
820 | $N$th Digit of Reciprocals | Let $d_n(x)$ be the $n$th decimal digit of the fractional part of $x$, or $0$ if the fractional part has fewer than $n$ digits.
For example:
$d_7 \mathopen{}\left( 1 \right)\mathclose{} = d_7 \mathopen{}\left( \frac 1 2 \right)\mathclose{} = d_7 \mathopen{}\left( \frac 1 4 \right)\mathclose{} = d_7 \mathopen{}\left( \frac 1 5 \right)\mathclose{} = 0$
$d_7 \mathopen{}\left( \frac 1 3 \right)\mathclose{} = 3$ since $\frac 1 3 =$ 0.3333333333...
$d_7 \mathopen{}\left( \frac 1 6 \right)\mathclose{} = 6$ since $\frac 1 6 =$ 0.1666666666...
$d_7 \mathopen{}\left( \frac 1 7 \right)\mathclose{} = 1$ since $\frac 1 7 =$ 0.1428571428...
Let $\displaystyle S(n) = \sum_{k=1}^n d_n \mathopen{}\left( \frac 1 k \right)\mathclose{}$.
You are given:
$S(7) = 0 + 0 + 3 + 0 + 0 + 6 + 1 = 10$
$S(100) = 418$
Find $S(10^7)$. | Let $d_n(x)$ be the $n$th decimal digit of the fractional part of $x$, or $0$ if the fractional part has fewer than $n$ digits.
For example:
$d_7 \mathopen{}\left( 1 \right)\mathclose{} = d_7 \mathopen{}\left( \frac 1 2 \right)\mathclose{} = d_7 \mathopen{}\left( \frac 1 4 \right)\mathclose{} = d_7 \mathopen{}\left( \frac 1 5 \right)\mathclose{} = 0$
$d_7 \mathopen{}\left( \frac 1 3 \right)\mathclose{} = 3$ since $\frac 1 3 =$ 0.3333333333...
$d_7 \mathopen{}\left( \frac 1 6 \right)\mathclose{} = 6$ since $\frac 1 6 =$ 0.1666666666...
$d_7 \mathopen{}\left( \frac 1 7 \right)\mathclose{} = 1$ since $\frac 1 7 =$ 0.1428571428...
Let $\displaystyle S(n) = \sum_{k=1}^n d_n \mathopen{}\left( \frac 1 k \right)\mathclose{}$.
You are given:
$S(7) = 0 + 0 + 3 + 0 + 0 + 6 + 1 = 10$
$S(100) = 418$
Find $S(10^7)$. | <p>Let $d_n(x)$ be the $n$<sup>th</sup> decimal digit of the fractional part of $x$, or $0$ if the fractional part has fewer than $n$ digits.</p>
<p>For example:</p>
<ul>
<li>$d_7 \mathopen{}\left( 1 \right)\mathclose{} = d_7 \mathopen{}\left( \frac 1 2 \right)\mathclose{} = d_7 \mathopen{}\left( \frac 1 4 \right)\mathclose{} = d_7 \mathopen{}\left( \frac 1 5 \right)\mathclose{} = 0$</li>
<li>$d_7 \mathopen{}\left( \frac 1 3 \right)\mathclose{} = 3$ since $\frac 1 3 =$ 0.333333<span style="color:#FF0000;font-weight:bold;">3</span>333...</li>
<li>$d_7 \mathopen{}\left( \frac 1 6 \right)\mathclose{} = 6$ since $\frac 1 6 =$ 0.166666<span style="color:#FF0000;font-weight:bold;">6</span>666...</li>
<li>$d_7 \mathopen{}\left( \frac 1 7 \right)\mathclose{} = 1$ since $\frac 1 7 =$ 0.142857<span style="color:#FF0000;font-weight:bold;">1</span>428...</li>
</ul>
<p>Let $\displaystyle S(n) = \sum_{k=1}^n d_n \mathopen{}\left( \frac 1 k \right)\mathclose{}$.</p>
<p>You are given:</p>
<ul>
<li>$S(7) = 0 + 0 + 3 + 0 + 0 + 6 + 1 = 10$</li>
<li>$S(100) = 418$</li>
</ul>
<p>Find $S(10^7)$.</p> | 44967734 | Saturday, 10th December 2022, 04:00 pm | 1060 | 10% | easy |
511 | Sequences with Nice Divisibility Properties | Let $Seq(n,k)$ be the number of positive-integer sequences $\{a_i\}_{1 \le i \le n}$ of length $n$ such that:
$n$ is divisible by $a_i$ for $1 \le i \le n$, and
$n + a_1 + a_2 + \cdots + a_n$ is divisible by $k$.
Examples:
$Seq(3,4) = 4$, and the $4$ sequences are:
$\{1, 1, 3\}$
$\{1, 3, 1\}$
$\{3, 1, 1\}$
$\{3, 3, 3\}$
$Seq(4,11) = 8$, and the $8$ sequences are:
$\{1, 1, 1, 4\}$
$\{1, 1, 4, 1\}$
$\{1, 4, 1, 1\}$
$\{4, 1, 1, 1\}$
$\{2, 2, 2, 1\}$
$\{2, 2, 1, 2\}$
$\{2, 1, 2, 2\}$
$\{1, 2, 2, 2\}$
The last nine digits of $Seq(1111,24)$ are $840643584$.
Find the last nine digits of $Seq(1234567898765,4321)$. | Let $Seq(n,k)$ be the number of positive-integer sequences $\{a_i\}_{1 \le i \le n}$ of length $n$ such that:
$n$ is divisible by $a_i$ for $1 \le i \le n$, and
$n + a_1 + a_2 + \cdots + a_n$ is divisible by $k$.
Examples:
$Seq(3,4) = 4$, and the $4$ sequences are:
$\{1, 1, 3\}$
$\{1, 3, 1\}$
$\{3, 1, 1\}$
$\{3, 3, 3\}$
$Seq(4,11) = 8$, and the $8$ sequences are:
$\{1, 1, 1, 4\}$
$\{1, 1, 4, 1\}$
$\{1, 4, 1, 1\}$
$\{4, 1, 1, 1\}$
$\{2, 2, 2, 1\}$
$\{2, 2, 1, 2\}$
$\{2, 1, 2, 2\}$
$\{1, 2, 2, 2\}$
The last nine digits of $Seq(1111,24)$ are $840643584$.
Find the last nine digits of $Seq(1234567898765,4321)$. | <p>Let $Seq(n,k)$ be the number of positive-integer sequences $\{a_i\}_{1 \le i \le n}$ of length $n$ such that:</p>
<ul style="list-style-type:disc;"><li>$n$ is divisible by $a_i$ for $1 \le i \le n$, and</li>
<li>$n + a_1 + a_2 + \cdots + a_n$ is divisible by $k$.</li>
</ul><p>Examples:</p>
<p>$Seq(3,4) = 4$, and the $4$ sequences are:<br/>
$\{1, 1, 3\}$<br/>
$\{1, 3, 1\}$<br/>
$\{3, 1, 1\}$<br/>
$\{3, 3, 3\}$</p>
<p>$Seq(4,11) = 8$, and the $8$ sequences are:<br/>
$\{1, 1, 1, 4\}$<br/>
$\{1, 1, 4, 1\}$<br/>
$\{1, 4, 1, 1\}$<br/>
$\{4, 1, 1, 1\}$<br/>
$\{2, 2, 2, 1\}$<br/>
$\{2, 2, 1, 2\}$<br/>
$\{2, 1, 2, 2\}$<br/>
$\{1, 2, 2, 2\}$</p>
<p>The last nine digits of $Seq(1111,24)$ are $840643584$.</p>
<p>Find the last nine digits of $Seq(1234567898765,4321)$.</p> | 935247012 | Saturday, 11th April 2015, 07:00 pm | 464 | 55% | medium |
572 | Idempotent Matrices | A matrix $M$ is called idempotent if $M^2 = M$.
Let $M$ be a three by three matrix :
$M=\begin{pmatrix}
a & b & c\\
d & e & f\\
g &h &i\\
\end{pmatrix}$.
Let $C(n)$ be the number of idempotent three by three matrices $M$ with integer elements such that
$ -n \le a,b,c,d,e,f,g,h,i \le n$.
$C(1)=164$ and $C(2)=848$.
Find $C(200)$. | A matrix $M$ is called idempotent if $M^2 = M$.
Let $M$ be a three by three matrix :
$M=\begin{pmatrix}
a & b & c\\
d & e & f\\
g &h &i\\
\end{pmatrix}$.
Let $C(n)$ be the number of idempotent three by three matrices $M$ with integer elements such that
$ -n \le a,b,c,d,e,f,g,h,i \le n$.
$C(1)=164$ and $C(2)=848$.
Find $C(200)$. | <p>
A matrix $M$ is called idempotent if $M^2 = M$.<br/>
Let $M$ be a three by three matrix :
$M=\begin{pmatrix}
a & b & c\\
d & e & f\\
g &h &i\\
\end{pmatrix}$.<br/>
Let $C(n)$ be the number of idempotent three by three matrices $M$ with integer elements such that<br/>
$ -n \le a,b,c,d,e,f,g,h,i \le n$.</p>
<p>
$C(1)=164$ and $C(2)=848$.
</p>
<p>
Find $C(200)$.
</p> | 19737656 | Sunday, 2nd October 2016, 04:00 am | 380 | 50% | medium |
408 | Admissible Paths Through a Grid | Let's call a lattice point $(x, y)$ inadmissible if $x, y$ and $x+y$ are all positive perfect squares.
For example, $(9, 16)$ is inadmissible, while $(0, 4)$, $(3, 1)$ and $(9, 4)$ are not.
Consider a path from point $(x_1, y_1)$ to point $(x_2, y_2)$ using only unit steps north or east.
Let's call such a path admissible if none of its intermediate points are inadmissible.
Let $P(n)$ be the number of admissible paths from $(0, 0)$ to $(n, n)$.
It can be verified that $P(5) = 252$, $P(16) = 596994440$ and $P(1000) \bmod 1\,000\,000\,007 = 341920854$.
Find $P(10\,000\,000) \bmod 1\,000\,000\,007$. | Let's call a lattice point $(x, y)$ inadmissible if $x, y$ and $x+y$ are all positive perfect squares.
For example, $(9, 16)$ is inadmissible, while $(0, 4)$, $(3, 1)$ and $(9, 4)$ are not.
Consider a path from point $(x_1, y_1)$ to point $(x_2, y_2)$ using only unit steps north or east.
Let's call such a path admissible if none of its intermediate points are inadmissible.
Let $P(n)$ be the number of admissible paths from $(0, 0)$ to $(n, n)$.
It can be verified that $P(5) = 252$, $P(16) = 596994440$ and $P(1000) \bmod 1\,000\,000\,007 = 341920854$.
Find $P(10\,000\,000) \bmod 1\,000\,000\,007$. | <p>Let's call a lattice point $(x, y)$ <dfn>inadmissible</dfn> if $x, y$ and $x+y$ are all positive perfect squares.<br/>
For example, $(9, 16)$ is inadmissible, while $(0, 4)$, $(3, 1)$ and $(9, 4)$ are not.</p>
<p>Consider a path from point $(x_1, y_1)$ to point $(x_2, y_2)$ using only unit steps north or east.<br/>
Let's call such a path <dfn>admissible</dfn> if none of its intermediate points are inadmissible.</p>
<p>Let $P(n)$ be the number of admissible paths from $(0, 0)$ to $(n, n)$.<br/>
It can be verified that $P(5) = 252$, $P(16) = 596994440$ and $P(1000) \bmod 1\,000\,000\,007 = 341920854$.</p>
<p>Find $P(10\,000\,000) \bmod 1\,000\,000\,007$.</p> | 299742733 | Saturday, 29th December 2012, 01:00 pm | 640 | 50% | medium |
749 | Near Power Sums | A positive integer, $n$, is a near power sum if there exists a positive integer, $k$, such that the sum of the $k$th powers of the digits in its decimal representation is equal to either $n+1$ or $n-1$. For example $35$ is a near power sum number because $3^2+5^2 = 34$.
Define $S(d)$ to be the sum of all near power sum numbers of $d$ digits or less.
Then $S(2) = 110$ and $S(6) = 2562701$.
Find $S(16)$. | A positive integer, $n$, is a near power sum if there exists a positive integer, $k$, such that the sum of the $k$th powers of the digits in its decimal representation is equal to either $n+1$ or $n-1$. For example $35$ is a near power sum number because $3^2+5^2 = 34$.
Define $S(d)$ to be the sum of all near power sum numbers of $d$ digits or less.
Then $S(2) = 110$ and $S(6) = 2562701$.
Find $S(16)$. | <p>
A positive integer, $n$, is a <dfn>near power sum</dfn> if there exists a positive integer, $k$, such that the sum of the $k$th powers of the digits in its decimal representation is equal to either $n+1$ or $n-1$. For example $35$ is a near power sum number because $3^2+5^2 = 34$.
</p>
<p>
Define $S(d)$ to be the sum of all near power sum numbers of $d$ digits or less.
Then $S(2) = 110$ and $S(6) = 2562701$.
</p>
<p>
Find $S(16)$.
</p> | 13459471903176422 | Saturday, 27th February 2021, 04:00 pm | 798 | 15% | easy |
5 | Smallest Multiple | $2520$ is the smallest number that can be divided by each of the numbers from $1$ to $10$ without any remainder.
What is the smallest positive number that is evenly divisibledivisible with no remainder by all of the numbers from $1$ to $20$? | $2520$ is the smallest number that can be divided by each of the numbers from $1$ to $10$ without any remainder.
What is the smallest positive number that is evenly divisibledivisible with no remainder by all of the numbers from $1$ to $20$? | <p>$2520$ is the smallest number that can be divided by each of the numbers from $1$ to $10$ without any remainder.</p>
<p>What is the smallest positive number that is <strong class="tooltip">evenly divisible<span class="tooltiptext">divisible with no remainder</span></strong> by all of the numbers from $1$ to $20$?</p> | 232792560 | Friday, 30th November 2001, 06:00 pm | 522306 | 5% | easy |
95 | Amicable Chains | The proper divisors of a number are all the divisors excluding the number itself. For example, the proper divisors of $28$ are $1$, $2$, $4$, $7$, and $14$. As the sum of these divisors is equal to $28$, we call it a perfect number.
Interestingly the sum of the proper divisors of $220$ is $284$ and the sum of the proper divisors of $284$ is $220$, forming a chain of two numbers. For this reason, $220$ and $284$ are called an amicable pair.
Perhaps less well known are longer chains. For example, starting with $12496$, we form a chain of five numbers:
$$12496 \to 14288 \to 15472 \to 14536 \to 14264 (\to 12496 \to \cdots)$$
Since this chain returns to its starting point, it is called an amicable chain.
Find the smallest member of the longest amicable chain with no element exceeding one million. | The proper divisors of a number are all the divisors excluding the number itself. For example, the proper divisors of $28$ are $1$, $2$, $4$, $7$, and $14$. As the sum of these divisors is equal to $28$, we call it a perfect number.
Interestingly the sum of the proper divisors of $220$ is $284$ and the sum of the proper divisors of $284$ is $220$, forming a chain of two numbers. For this reason, $220$ and $284$ are called an amicable pair.
Perhaps less well known are longer chains. For example, starting with $12496$, we form a chain of five numbers:
$$12496 \to 14288 \to 15472 \to 14536 \to 14264 (\to 12496 \to \cdots)$$
Since this chain returns to its starting point, it is called an amicable chain.
Find the smallest member of the longest amicable chain with no element exceeding one million. | <p>The proper divisors of a number are all the divisors excluding the number itself. For example, the proper divisors of $28$ are $1$, $2$, $4$, $7$, and $14$. As the sum of these divisors is equal to $28$, we call it a perfect number.</p>
<p>Interestingly the sum of the proper divisors of $220$ is $284$ and the sum of the proper divisors of $284$ is $220$, forming a chain of two numbers. For this reason, $220$ and $284$ are called an amicable pair.</p>
<p>Perhaps less well known are longer chains. For example, starting with $12496$, we form a chain of five numbers:
$$12496 \to 14288 \to 15472 \to 14536 \to 14264 (\to 12496 \to \cdots)$$</p>
<p>Since this chain returns to its starting point, it is called an amicable chain.</p>
<p>Find the smallest member of the longest amicable chain with no element exceeding one million.</p> | 14316 | Friday, 13th May 2005, 06:00 pm | 16208 | 30% | easy |
561 | Divisor Pairs | Let $S(n)$ be the number of pairs $(a,b)$ of distinct divisors of $n$ such that $a$ divides $b$.
For $n=6$ we get the following pairs: $(1,2), (1,3), (1,6),( 2,6)$ and $(3,6)$. So $S(6)=5$.
Let $p_m\#$ be the product of the first $m$ prime numbers, so $p_2\# = 2*3 = 6$.
Let $E(m, n)$ be the highest integer $k$ such that $2^k$ divides $S((p_m\#)^n)$.
$E(2,1) = 0$ since $2^0$ is the highest power of 2 that divides S(6)=5.
Let $Q(n)=\sum_{i=1}^{n} E(904961, i)$
$Q(8)=2714886$.
Evaluate $Q(10^{12})$. | Let $S(n)$ be the number of pairs $(a,b)$ of distinct divisors of $n$ such that $a$ divides $b$.
For $n=6$ we get the following pairs: $(1,2), (1,3), (1,6),( 2,6)$ and $(3,6)$. So $S(6)=5$.
Let $p_m\#$ be the product of the first $m$ prime numbers, so $p_2\# = 2*3 = 6$.
Let $E(m, n)$ be the highest integer $k$ such that $2^k$ divides $S((p_m\#)^n)$.
$E(2,1) = 0$ since $2^0$ is the highest power of 2 that divides S(6)=5.
Let $Q(n)=\sum_{i=1}^{n} E(904961, i)$
$Q(8)=2714886$.
Evaluate $Q(10^{12})$. | <p>
Let $S(n)$ be the number of pairs $(a,b)$ of distinct divisors of $n$ such that $a$ divides $b$.<br>
For $n=6$ we get the following pairs: $(1,2), (1,3), (1,6),( 2,6)$ and $(3,6)$. So $S(6)=5$.<br/>
Let $p_m\#$ be the product of the first $m$ prime numbers, so $p_2\# = 2*3 = 6$.<br/>
Let $E(m, n)$ be the highest integer $k$ such that $2^k$ divides $S((p_m\#)^n)$.<br/>
$E(2,1) = 0$ since $2^0$ is the highest power of 2 that divides S(6)=5.<br/>
Let $Q(n)=\sum_{i=1}^{n} E(904961, i)$<br/>
$Q(8)=2714886$.
</br></p>
<p>
Evaluate $Q(10^{12})$.
</p> | 452480999988235494 | Saturday, 21st May 2016, 10:00 pm | 866 | 30% | easy |
482 | The Incenter of a Triangle | $ABC$ is an integer sided triangle with incenter $I$ and perimeter $p$.
The segments $IA$, $IB$ and $IC$ have integral length as well.
Let $L = p + |IA| + |IB| + |IC|$.
Let $S(P) = \sum L$ for all such triangles where $p \le P$. For example, $S(10^3) = 3619$.
Find $S(10^7)$. | $ABC$ is an integer sided triangle with incenter $I$ and perimeter $p$.
The segments $IA$, $IB$ and $IC$ have integral length as well.
Let $L = p + |IA| + |IB| + |IC|$.
Let $S(P) = \sum L$ for all such triangles where $p \le P$. For example, $S(10^3) = 3619$.
Find $S(10^7)$. | <p>
$ABC$ is an integer sided triangle with incenter $I$ and perimeter $p$.<br/>
The segments $IA$, $IB$ and $IC$ have integral length as well.
</p>
<p>
Let $L = p + |IA| + |IB| + |IC|$.
</p>
<p>
Let $S(P) = \sum L$ for all such triangles where $p \le P$. For example, $S(10^3) = 3619$.
</p>
<p>
Find $S(10^7)$.
</p> | 1400824879147 | Sunday, 28th September 2014, 07:00 am | 247 | 85% | hard |
500 | Problem 500!!! | The number of divisors of $120$ is $16$.
In fact $120$ is the smallest number having $16$ divisors.
Find the smallest number with $2^{500500}$ divisors.
Give your answer modulo $500500507$. | The number of divisors of $120$ is $16$.
In fact $120$ is the smallest number having $16$ divisors.
Find the smallest number with $2^{500500}$ divisors.
Give your answer modulo $500500507$. | <p>The number of divisors of $120$ is $16$.<br/>
In fact $120$ is the smallest number having $16$ divisors.
</p>
<p>
Find the smallest number with $2^{500500}$ divisors.<br/>
Give your answer modulo $500500507$.
</p> | 35407281 | Saturday, 31st January 2015, 01:00 pm | 4493 | 15% | easy |
324 | Building a Tower | Let $f(n)$ represent the number of ways one can fill a $3 \times 3 \times n$ tower with blocks of $2 \times 1 \times 1$.You're allowed to rotate the blocks in any way you like; however, rotations, reflections etc of the tower itself are counted as distinct.
For example (with $q = 100000007$):$f(2) = 229$,$f(4) = 117805$,$f(10) \bmod q = 96149360$,$f(10^3) \bmod q = 24806056$,$f(10^6) \bmod q = 30808124$.
Find $f(10^{10000}) \bmod 100000007$. | Let $f(n)$ represent the number of ways one can fill a $3 \times 3 \times n$ tower with blocks of $2 \times 1 \times 1$.You're allowed to rotate the blocks in any way you like; however, rotations, reflections etc of the tower itself are counted as distinct.
For example (with $q = 100000007$):$f(2) = 229$,$f(4) = 117805$,$f(10) \bmod q = 96149360$,$f(10^3) \bmod q = 24806056$,$f(10^6) \bmod q = 30808124$.
Find $f(10^{10000}) \bmod 100000007$. | <p>Let $f(n)$ represent the number of ways one can fill a $3 \times 3 \times n$ tower with blocks of $2 \times 1 \times 1$.<br/>You're allowed to rotate the blocks in any way you like; however, rotations, reflections etc of the tower itself are counted as distinct.</p>
<p>For example (with $q = 100000007$):<br/>$f(2) = 229$,<br/>$f(4) = 117805$,<br/>$f(10) \bmod q = 96149360$,<br/>$f(10^3) \bmod q = 24806056$,<br/>$f(10^6) \bmod q = 30808124$.</p>
<p>Find $f(10^{10000}) \bmod 100000007$.</p> | 96972774 | Sunday, 13th February 2011, 10:00 am | 792 | 50% | medium |
94 | Almost Equilateral Triangles | It is easily proved that no equilateral triangle exists with integral length sides and integral area. However, the almost equilateral triangle $5$-$5$-$6$ has an area of $12$ square units.
We shall define an almost equilateral triangle to be a triangle for which two sides are equal and the third differs by no more than one unit.
Find the sum of the perimeters of all almost equilateral triangles with integral side lengths and area and whose perimeters do not exceed one billion ($1\,000\,000\,000$). | It is easily proved that no equilateral triangle exists with integral length sides and integral area. However, the almost equilateral triangle $5$-$5$-$6$ has an area of $12$ square units.
We shall define an almost equilateral triangle to be a triangle for which two sides are equal and the third differs by no more than one unit.
Find the sum of the perimeters of all almost equilateral triangles with integral side lengths and area and whose perimeters do not exceed one billion ($1\,000\,000\,000$). | <p>It is easily proved that no equilateral triangle exists with integral length sides and integral area. However, the <dfn>almost equilateral triangle</dfn> $5$-$5$-$6$ has an area of $12$ square units.</p>
<p>We shall define an <dfn>almost equilateral triangle</dfn> to be a triangle for which two sides are equal and the third differs by no more than one unit.</p>
<p>Find the sum of the perimeters of all <dfn>almost equilateral triangles</dfn> with integral side lengths and area and whose perimeters do not exceed one billion ($1\,000\,000\,000$).</p> | 518408346 | Friday, 29th April 2005, 06:00 pm | 14113 | 35% | medium |
771 | Pseudo Geometric Sequences | We define a pseudo-geometric sequence to be a finite sequence $a_0, a_1, \dotsc, a_n$ of positive integers, satisfying the following conditions:
$n \geq 4$, i.e. the sequence has at least $5$ terms.
$0 \lt a_0 \lt a_1 \lt \cdots \lt a_n$, i.e. the sequence is strictly increasing.
$| a_i^2 - a_{i - 1}a_{i + 1} | \le 2$ for $1 \le i \le n-1$.
Let $G(N)$ be the number of different pseudo-geometric sequences whose terms do not exceed $N$.
For example, $G(6) = 4$, as the following $4$ sequences give a complete list:
$1, 2, 3, 4, 5 \qquad 1, 2, 3, 4, 6 \qquad 2, 3, 4, 5, 6 \qquad 1, 2, 3, 4, 5, 6$
Also, $G(10) = 26$, $G(100) = 4710$ and $G(1000) = 496805$.
Find $G(10^{18})$. Give your answer modulo $1\,000\,000\,007$. | We define a pseudo-geometric sequence to be a finite sequence $a_0, a_1, \dotsc, a_n$ of positive integers, satisfying the following conditions:
$n \geq 4$, i.e. the sequence has at least $5$ terms.
$0 \lt a_0 \lt a_1 \lt \cdots \lt a_n$, i.e. the sequence is strictly increasing.
$| a_i^2 - a_{i - 1}a_{i + 1} | \le 2$ for $1 \le i \le n-1$.
Let $G(N)$ be the number of different pseudo-geometric sequences whose terms do not exceed $N$.
For example, $G(6) = 4$, as the following $4$ sequences give a complete list:
$1, 2, 3, 4, 5 \qquad 1, 2, 3, 4, 6 \qquad 2, 3, 4, 5, 6 \qquad 1, 2, 3, 4, 5, 6$
Also, $G(10) = 26$, $G(100) = 4710$ and $G(1000) = 496805$.
Find $G(10^{18})$. Give your answer modulo $1\,000\,000\,007$. | <p>
We define a <dfn>pseudo-geometric sequence</dfn> to be a finite sequence $a_0, a_1, \dotsc, a_n$ of positive integers, satisfying the following conditions:
</p><ul>
<li>$n \geq 4$, i.e. the sequence has at least $5$ terms.</li>
<li>$0 \lt a_0 \lt a_1 \lt \cdots \lt a_n$, i.e. the sequence is strictly increasing.</li>
<li>$| a_i^2 - a_{i - 1}a_{i + 1} | \le 2$ for $1 \le i \le n-1$.</li>
</ul>
<p>
Let $G(N)$ be the number of different pseudo-geometric sequences whose terms do not exceed $N$.<br/>
For example, $G(6) = 4$, as the following $4$ sequences give a complete list:
</p><center>$1, 2, 3, 4, 5 \qquad 1, 2, 3, 4, 6 \qquad 2, 3, 4, 5, 6 \qquad 1, 2, 3, 4, 5, 6$ </center>
<p>
Also, $G(10) = 26$, $G(100) = 4710$ and $G(1000) = 496805$.</p>
<p>
Find $G(10^{18})$. Give your answer modulo $1\,000\,000\,007$.</p> | 398803409 | Saturday, 6th November 2021, 01:00 pm | 135 | 80% | hard |
779 | Prime Factor and Exponent | For a positive integer $n \gt 1$, let $p(n)$ be the smallest prime dividing $n$, and let $\alpha(n)$ be its $p$-adic order, i.e. the largest integer such that $p(n)^{\alpha(n)}$ divides $n$.
For a positive integer $K$, define the function $f_K(n)$ by:
$$f_K(n)=\frac{\alpha(n)-1}{(p(n))^K}.$$
Also define $\overline{f_K}$ by:
$$\overline{f_K}=\lim_{N \to \infty} \frac{1}{N}\sum_{n=2}^{N} f_K(n).$$
It can be verified that $\overline{f_1} \approx 0.282419756159$.
Find $\displaystyle \sum_{K=1}^{\infty}\overline{f_K}$. Give your answer rounded to $12$ digits after the decimal point. | For a positive integer $n \gt 1$, let $p(n)$ be the smallest prime dividing $n$, and let $\alpha(n)$ be its $p$-adic order, i.e. the largest integer such that $p(n)^{\alpha(n)}$ divides $n$.
For a positive integer $K$, define the function $f_K(n)$ by:
$$f_K(n)=\frac{\alpha(n)-1}{(p(n))^K}.$$
Also define $\overline{f_K}$ by:
$$\overline{f_K}=\lim_{N \to \infty} \frac{1}{N}\sum_{n=2}^{N} f_K(n).$$
It can be verified that $\overline{f_1} \approx 0.282419756159$.
Find $\displaystyle \sum_{K=1}^{\infty}\overline{f_K}$. Give your answer rounded to $12$ digits after the decimal point. | <p>
For a positive integer $n \gt 1$, let $p(n)$ be the smallest prime dividing $n$, and let $\alpha(n)$ be its <strong>$p$-adic order</strong>, i.e. the largest integer such that $p(n)^{\alpha(n)}$ divides $n$.
</p>
<p>
For a positive integer $K$, define the function $f_K(n)$ by:
$$f_K(n)=\frac{\alpha(n)-1}{(p(n))^K}.$$</p>
<p>
Also define $\overline{f_K}$ by:
$$\overline{f_K}=\lim_{N \to \infty} \frac{1}{N}\sum_{n=2}^{N} f_K(n).$$</p>
<p>
It can be verified that $\overline{f_1} \approx 0.282419756159$.
</p>
<p>
Find $\displaystyle \sum_{K=1}^{\infty}\overline{f_K}$. Give your answer rounded to $12$ digits after the decimal point.
</p> | 0.547326103833 | Saturday, 1st January 2022, 01:00 pm | 535 | 25% | easy |
390 | Triangles with Non Rational Sides and Integral Area | Consider the triangle with sides $\sqrt 5$, $\sqrt {65}$ and $\sqrt {68}$.
It can be shown that this triangle has area $9$.
$S(n)$ is the sum of the areas of all triangles with sides $\sqrt{1+b^2}$, $\sqrt {1+c^2}$ and $\sqrt{b^2+c^2}\,$ (for positive integers $b$ and $c$) that have an integral area not exceeding $n$.
The example triangle has $b=2$ and $c=8$.
$S(10^6)=18018206$.
Find $S(10^{10})$. | Consider the triangle with sides $\sqrt 5$, $\sqrt {65}$ and $\sqrt {68}$.
It can be shown that this triangle has area $9$.
$S(n)$ is the sum of the areas of all triangles with sides $\sqrt{1+b^2}$, $\sqrt {1+c^2}$ and $\sqrt{b^2+c^2}\,$ (for positive integers $b$ and $c$) that have an integral area not exceeding $n$.
The example triangle has $b=2$ and $c=8$.
$S(10^6)=18018206$.
Find $S(10^{10})$. | <p>Consider the triangle with sides $\sqrt 5$, $\sqrt {65}$ and $\sqrt {68}$.
It can be shown that this triangle has area $9$.</p>
<p>$S(n)$ is the sum of the areas of all triangles with sides $\sqrt{1+b^2}$, $\sqrt {1+c^2}$ and $\sqrt{b^2+c^2}\,$ (for positive integers $b$ and $c$) that have an integral area not exceeding $n$.</p>
<p>The example triangle has $b=2$ and $c=8$.</p>
<p>$S(10^6)=18018206$.</p>
<p>Find $S(10^{10})$.</p> | 2919133642971 | Saturday, 23rd June 2012, 08:00 pm | 625 | 60% | hard |
398 | Cutting Rope | Inside a rope of length $n$, $n - 1$ points are placed with distance $1$ from each other and from the endpoints. Among these points, we choose $m - 1$ points at random and cut the rope at these points to create $m$ segments.
Let $E(n, m)$ be the expected length of the second-shortest segment.
For example, $E(3, 2) = 2$ and $E(8, 3) = 16/7$.
Note that if multiple segments have the same shortest length the length of the second-shortest segment is defined as the same as the shortest length.
Find $E(10^7, 100)$.
Give your answer rounded to $5$ decimal places behind the decimal point. | Inside a rope of length $n$, $n - 1$ points are placed with distance $1$ from each other and from the endpoints. Among these points, we choose $m - 1$ points at random and cut the rope at these points to create $m$ segments.
Let $E(n, m)$ be the expected length of the second-shortest segment.
For example, $E(3, 2) = 2$ and $E(8, 3) = 16/7$.
Note that if multiple segments have the same shortest length the length of the second-shortest segment is defined as the same as the shortest length.
Find $E(10^7, 100)$.
Give your answer rounded to $5$ decimal places behind the decimal point. | <p>
Inside a rope of length $n$, $n - 1$ points are placed with distance $1$ from each other and from the endpoints. Among these points, we choose $m - 1$ points at random and cut the rope at these points to create $m$ segments.
</p>
<p>
Let $E(n, m)$ be the expected length of the second-shortest segment.
For example, $E(3, 2) = 2$ and $E(8, 3) = 16/7$.
Note that if multiple segments have the same shortest length the length of the second-shortest segment is defined as the same as the shortest length.
</p>
<p>
Find $E(10^7, 100)$.
Give your answer rounded to $5$ decimal places behind the decimal point.
</p> | 2010.59096 | Sunday, 14th October 2012, 08:00 am | 425 | 55% | medium |
565 | Divisibility of Sum of Divisors | Let $\sigma(n)$ be the sum of the divisors of $n$.
E.g. the divisors of $4$ are $1$, $2$ and $4$, so $\sigma(4)=7$.
The numbers $n$ not exceeding $20$ such that $7$ divides $\sigma(n)$ are: $4$, $12$, $13$ and $20$, the sum of these numbers being $49$.
Let $S(n, d)$ be the sum of the numbers $i$ not exceeding $n$ such that $d$ divides $\sigma(i)$.
So $S(20 , 7)=49$.
You are given: $S(10^6,2017)=150850429$ and $S(10^9, 2017)=249652238344557$.
Find $S(10^{11}, 2017)$. | Let $\sigma(n)$ be the sum of the divisors of $n$.
E.g. the divisors of $4$ are $1$, $2$ and $4$, so $\sigma(4)=7$.
The numbers $n$ not exceeding $20$ such that $7$ divides $\sigma(n)$ are: $4$, $12$, $13$ and $20$, the sum of these numbers being $49$.
Let $S(n, d)$ be the sum of the numbers $i$ not exceeding $n$ such that $d$ divides $\sigma(i)$.
So $S(20 , 7)=49$.
You are given: $S(10^6,2017)=150850429$ and $S(10^9, 2017)=249652238344557$.
Find $S(10^{11}, 2017)$. | <p>Let $\sigma(n)$ be the sum of the divisors of $n$.<br/>
E.g. the divisors of $4$ are $1$, $2$ and $4$, so $\sigma(4)=7$.
</p>
<p>
The numbers $n$ not exceeding $20$ such that $7$ divides $\sigma(n)$ are: $4$, $12$, $13$ and $20$, the sum of these numbers being $49$.
</p>
<p>
Let $S(n, d)$ be the sum of the numbers $i$ not exceeding $n$ such that $d$ divides $\sigma(i)$.<br/>
So $S(20 , 7)=49$.
</p>
<p>
You are given: $S(10^6,2017)=150850429$ and $S(10^9, 2017)=249652238344557$.
</p>
<p>
Find $S(10^{11}, 2017)$.
</p> | 2992480851924313898 | Sunday, 19th June 2016, 10:00 am | 700 | 35% | medium |
33 | Digit Cancelling Fractions | The fraction $49/98$ is a curious fraction, as an inexperienced mathematician in attempting to simplify it may incorrectly believe that $49/98 = 4/8$, which is correct, is obtained by cancelling the $9$s.
We shall consider fractions like, $30/50 = 3/5$, to be trivial examples.
There are exactly four non-trivial examples of this type of fraction, less than one in value, and containing two digits in the numerator and denominator.
If the product of these four fractions is given in its lowest common terms, find the value of the denominator. | The fraction $49/98$ is a curious fraction, as an inexperienced mathematician in attempting to simplify it may incorrectly believe that $49/98 = 4/8$, which is correct, is obtained by cancelling the $9$s.
We shall consider fractions like, $30/50 = 3/5$, to be trivial examples.
There are exactly four non-trivial examples of this type of fraction, less than one in value, and containing two digits in the numerator and denominator.
If the product of these four fractions is given in its lowest common terms, find the value of the denominator. | <p>The fraction $49/98$ is a curious fraction, as an inexperienced mathematician in attempting to simplify it may incorrectly believe that $49/98 = 4/8$, which is correct, is obtained by cancelling the $9$s.</p>
<p>We shall consider fractions like, $30/50 = 3/5$, to be trivial examples.</p>
<p>There are exactly four non-trivial examples of this type of fraction, less than one in value, and containing two digits in the numerator and denominator.</p>
<p>If the product of these four fractions is given in its lowest common terms, find the value of the denominator.</p> | 100 | Friday, 20th December 2002, 06:00 pm | 78466 | 5% | easy |
387 | Harshad Numbers | A Harshad or Niven number is a number that is divisible by the sum of its digits.
$201$ is a Harshad number because it is divisible by $3$ (the sum of its digits.)
When we truncate the last digit from $201$, we get $20$, which is a Harshad number.
When we truncate the last digit from $20$, we get $2$, which is also a Harshad number.
Let's call a Harshad number that, while recursively truncating the last digit, always results in a Harshad number a right truncatable Harshad number.
Also:
$201/3=67$ which is prime.
Let's call a Harshad number that, when divided by the sum of its digits, results in a prime a strong Harshad number.
Now take the number $2011$ which is prime.
When we truncate the last digit from it we get $201$, a strong Harshad number that is also right truncatable.
Let's call such primes strong, right truncatable Harshad primes.
You are given that the sum of the strong, right truncatable Harshad primes less than $10000$ is $90619$.
Find the sum of the strong, right truncatable Harshad primes less than $10^{14}$. | A Harshad or Niven number is a number that is divisible by the sum of its digits.
$201$ is a Harshad number because it is divisible by $3$ (the sum of its digits.)
When we truncate the last digit from $201$, we get $20$, which is a Harshad number.
When we truncate the last digit from $20$, we get $2$, which is also a Harshad number.
Let's call a Harshad number that, while recursively truncating the last digit, always results in a Harshad number a right truncatable Harshad number.
Also:
$201/3=67$ which is prime.
Let's call a Harshad number that, when divided by the sum of its digits, results in a prime a strong Harshad number.
Now take the number $2011$ which is prime.
When we truncate the last digit from it we get $201$, a strong Harshad number that is also right truncatable.
Let's call such primes strong, right truncatable Harshad primes.
You are given that the sum of the strong, right truncatable Harshad primes less than $10000$ is $90619$.
Find the sum of the strong, right truncatable Harshad primes less than $10^{14}$. | <p>A <strong>Harshad or Niven number</strong> is a number that is divisible by the sum of its digits.
<br/>$201$ is a Harshad number because it is divisible by $3$ (the sum of its digits.)
<br/>When we truncate the last digit from $201$, we get $20$, which is a Harshad number.
<br/>When we truncate the last digit from $20$, we get $2$, which is also a Harshad number.
<br/>Let's call a Harshad number that, while recursively truncating the last digit, always results in a Harshad number a <dfn>right truncatable Harshad number</dfn>.</p>
<p>Also:
<br/>$201/3=67$ which is prime.
<br/>Let's call a Harshad number that, when divided by the sum of its digits, results in a prime a <dfn>strong Harshad number</dfn>.</p>
<p>Now take the number $2011$ which is prime.
<br/>When we truncate the last digit from it we get $201$, a strong Harshad number that is also right truncatable.
<br/>Let's call such primes <dfn>strong, right truncatable Harshad primes</dfn>.</p>
<p>You are given that the sum of the strong, right truncatable Harshad primes less than $10000$ is $90619$.</p>
<p>Find the sum of the strong, right truncatable Harshad primes less than $10^{14}$.</p> | 696067597313468 | Sunday, 3rd June 2012, 11:00 am | 5096 | 10% | easy |
365 | A Huge Binomial Coefficient | The binomial coefficient $\displaystyle{\binom{10^{18}}{10^9}}$ is a number with more than $9$ billion ($9\times 10^9$) digits.
Let $M(n,k,m)$ denote the binomial coefficient $\displaystyle{\binom{n}{k}}$ modulo $m$.
Calculate $\displaystyle{\sum M(10^{18},10^9,p\cdot q\cdot r)}$ for $1000\lt p\lt q\lt r\lt 5000$ and $p$,$q$,$r$ prime. | The binomial coefficient $\displaystyle{\binom{10^{18}}{10^9}}$ is a number with more than $9$ billion ($9\times 10^9$) digits.
Let $M(n,k,m)$ denote the binomial coefficient $\displaystyle{\binom{n}{k}}$ modulo $m$.
Calculate $\displaystyle{\sum M(10^{18},10^9,p\cdot q\cdot r)}$ for $1000\lt p\lt q\lt r\lt 5000$ and $p$,$q$,$r$ prime. | <p>
The binomial coefficient $\displaystyle{\binom{10^{18}}{10^9}}$ is a number with more than $9$ billion ($9\times 10^9$) digits.
</p>
<p>
Let $M(n,k,m)$ denote the binomial coefficient $\displaystyle{\binom{n}{k}}$ modulo $m$.
</p>
<p>
Calculate $\displaystyle{\sum M(10^{18},10^9,p\cdot q\cdot r)}$ for $1000\lt p\lt q\lt r\lt 5000$ and $p$,$q$,$r$ prime.
</p> | 162619462356610313 | Saturday, 31st December 2011, 04:00 pm | 1436 | 40% | medium |
668 | Square Root Smooth Numbers | A positive integer is called square root smooth if all of its prime factors are strictly less than its square root.
Including the number $1$, there are $29$ square root smooth numbers not exceeding $100$.
How many square root smooth numbers are there not exceeding $10\,000\,000\,000$? | A positive integer is called square root smooth if all of its prime factors are strictly less than its square root.
Including the number $1$, there are $29$ square root smooth numbers not exceeding $100$.
How many square root smooth numbers are there not exceeding $10\,000\,000\,000$? | <p>
A positive integer is called <dfn>square root smooth</dfn> if all of its prime factors are strictly less than its square root.<br/>
Including the number $1$, there are $29$ square root smooth numbers not exceeding $100$.
</p>
<p>
How many square root smooth numbers are there not exceeding $10\,000\,000\,000$?</p> | 2811077773 | Saturday, 4th May 2019, 07:00 pm | 1173 | 20% | easy |
454 | Diophantine Reciprocals III | In the following equation $x$, $y$, and $n$ are positive integers.
$$\dfrac{1}{x} + \dfrac{1}{y} = \dfrac{1}{n}$$
For a limit $L$ we define $F(L)$ as the number of solutions which satisfy $x \lt y \le L$.
We can verify that $F(15) = 4$ and $F(1000) = 1069$.
Find $F(10^{12})$. | In the following equation $x$, $y$, and $n$ are positive integers.
$$\dfrac{1}{x} + \dfrac{1}{y} = \dfrac{1}{n}$$
For a limit $L$ we define $F(L)$ as the number of solutions which satisfy $x \lt y \le L$.
We can verify that $F(15) = 4$ and $F(1000) = 1069$.
Find $F(10^{12})$. | <p>In the following equation $x$, $y$, and $n$ are positive integers.</p>
$$\dfrac{1}{x} + \dfrac{1}{y} = \dfrac{1}{n}$$
<p>For a limit $L$ we define $F(L)$ as the number of solutions which satisfy $x \lt y \le L$.</p>
<p>We can verify that $F(15) = 4$ and $F(1000) = 1069$.<br/>
Find $F(10^{12})$.</p> | 5435004633092 | Saturday, 11th January 2014, 07:00 pm | 534 | 50% | medium |
441 | The Inverse Summation of Coprime Couples | For an integer $M$, we define $R(M)$ as the sum of $1/(p \cdot q)$ for all the integer pairs $p$ and $q$ which satisfy all of these conditions:
$1 \leq p \lt q \leq M$
$p + q \geq M$
$p$ and $q$ are coprime.
We also define $S(N)$ as the sum of $R(i)$ for $2 \leq i \leq N$.
We can verify that $S(2) = R(2) = 1/2$, $S(10) \approx 6.9147$ and $S(100) \approx 58.2962$.
Find $S(10^7)$. Give your answer rounded to four decimal places. | For an integer $M$, we define $R(M)$ as the sum of $1/(p \cdot q)$ for all the integer pairs $p$ and $q$ which satisfy all of these conditions:
$1 \leq p \lt q \leq M$
$p + q \geq M$
$p$ and $q$ are coprime.
We also define $S(N)$ as the sum of $R(i)$ for $2 \leq i \leq N$.
We can verify that $S(2) = R(2) = 1/2$, $S(10) \approx 6.9147$ and $S(100) \approx 58.2962$.
Find $S(10^7)$. Give your answer rounded to four decimal places. | <p>
For an integer $M$, we define $R(M)$ as the sum of $1/(p \cdot q)$ for all the integer pairs $p$ and $q$ which satisfy all of these conditions:
</p>
<ul><li> $1 \leq p \lt q \leq M$</li>
<li> $p + q \geq M$</li>
<li> $p$ and $q$ are coprime.</li>
</ul><p>
We also define $S(N)$ as the sum of $R(i)$ for $2 \leq i \leq N$.<br/>
We can verify that $S(2) = R(2) = 1/2$, $S(10) \approx 6.9147$ and $S(100) \approx 58.2962$.
</p>
<p>
Find $S(10^7)$. Give your answer rounded to four decimal places.
</p> | 5000088.8395 | Sunday, 20th October 2013, 10:00 am | 396 | 65% | hard |
641 | A Long Row of Dice | Consider a row of $n$ dice all showing 1.
First turn every second die,$ (2,4,6,\ldots)$, so that the number showing is increased by 1. Then turn every third die. The sixth die will now show a 3. Then turn every fourth die and so on until every $n$th die (only the last die) is turned. If the die to be turned is showing a 6 then it is changed to show a 1.
Let $f(n)$ be the number of dice that are showing a 1 when the process finishes. You are given $f(100)=2$ and $f(10^8) = 69$.
Find $f(10^{36})$. | Consider a row of $n$ dice all showing 1.
First turn every second die,$ (2,4,6,\ldots)$, so that the number showing is increased by 1. Then turn every third die. The sixth die will now show a 3. Then turn every fourth die and so on until every $n$th die (only the last die) is turned. If the die to be turned is showing a 6 then it is changed to show a 1.
Let $f(n)$ be the number of dice that are showing a 1 when the process finishes. You are given $f(100)=2$ and $f(10^8) = 69$.
Find $f(10^{36})$. | <p>Consider a row of $n$ dice all showing 1.</p>
<p>First turn every second die,$ (2,4,6,\ldots)$, so that the number showing is increased by 1. Then turn every third die. The sixth die will now show a 3. Then turn every fourth die and so on until every $n$th die (only the last die) is turned. If the die to be turned is showing a 6 then it is changed to show a 1.</p>
<p>Let $f(n)$ be the number of dice that are showing a 1 when the process finishes. You are given $f(100)=2$ and $f(10^8) = 69$.</p>
<p>Find $f(10^{36})$.</p> | 793525366 | Saturday, 3rd November 2018, 01:00 pm | 549 | 35% | medium |
634 | Numbers of the Form $a^2b^3$ | Define $F(n)$ to be the number of integers $x≤n$ that can be written in the form $x=a^2b^3$, where $a$ and $b$ are integers not necessarily different and both greater than 1.
For example, $32=2^2\times 2^3$ and $72=3^2\times 2^3$ are the only two integers less than $100$ that can be written in this form. Hence, $F(100)=2$.
Further you are given $F(2\times 10^4)=130$ and $F(3\times 10^6)=2014$.
Find $F(9\times 10^{18})$. | Define $F(n)$ to be the number of integers $x≤n$ that can be written in the form $x=a^2b^3$, where $a$ and $b$ are integers not necessarily different and both greater than 1.
For example, $32=2^2\times 2^3$ and $72=3^2\times 2^3$ are the only two integers less than $100$ that can be written in this form. Hence, $F(100)=2$.
Further you are given $F(2\times 10^4)=130$ and $F(3\times 10^6)=2014$.
Find $F(9\times 10^{18})$. | <p>
Define $F(n)$ to be the number of integers $x≤n$ that can be written in the form $x=a^2b^3$, where $a$ and $b$ are integers not necessarily different and both greater than 1.</p>
<p>
For example, $32=2^2\times 2^3$ and $72=3^2\times 2^3$ are the only two integers less than $100$ that can be written in this form. Hence, $F(100)=2$.
</p>
<p>
Further you are given $F(2\times 10^4)=130$ and $F(3\times 10^6)=2014$.
</p>
<p>
Find $F(9\times 10^{18})$.
</p> | 4019680944 | Saturday, 11th August 2018, 04:00 pm | 690 | 40% | medium |
228 | Minkowski Sums | Let $S_n$ be the regular $n$-sided polygon – or shape – whose vertices
$v_k$ ($k = 1, 2, \dots, n$) have coordinates:
\begin{align}
x_k &= \cos((2k - 1)/n \times 180^\circ)\\
y_k &= \sin((2k - 1)/n \times 180^\circ)
\end{align}
Each $S_n$ is to be interpreted as a filled shape consisting of all points on the perimeter and in the interior.
The Minkowski sum, $S + T$, of two shapes $S$ and $T$ is the result of adding every point in $S$ to every point in $T$, where point addition is performed coordinate-wise: $(u, v) + (x, y) = (u + x, v + y)$.
For example, the sum of $S_3$ and $S_4$ is the six-sided shape shown in pink below:
How many sides does $S_{1864} + S_{1865} + \cdots + S_{1909}$ have? | Let $S_n$ be the regular $n$-sided polygon – or shape – whose vertices
$v_k$ ($k = 1, 2, \dots, n$) have coordinates:
\begin{align}
x_k &= \cos((2k - 1)/n \times 180^\circ)\\
y_k &= \sin((2k - 1)/n \times 180^\circ)
\end{align}
Each $S_n$ is to be interpreted as a filled shape consisting of all points on the perimeter and in the interior.
The Minkowski sum, $S + T$, of two shapes $S$ and $T$ is the result of adding every point in $S$ to every point in $T$, where point addition is performed coordinate-wise: $(u, v) + (x, y) = (u + x, v + y)$.
For example, the sum of $S_3$ and $S_4$ is the six-sided shape shown in pink below:
How many sides does $S_{1864} + S_{1865} + \cdots + S_{1909}$ have? | <p>Let $S_n$ be the regular $n$-sided polygon – or <dfn>shape</dfn> – whose vertices
$v_k$ ($k = 1, 2, \dots, n$) have coordinates:</p>
\begin{align}
x_k &= \cos((2k - 1)/n \times 180^\circ)\\
y_k &= \sin((2k - 1)/n \times 180^\circ)
\end{align}
<p>Each $S_n$ is to be interpreted as a filled shape consisting of all points on the perimeter and in the interior.</p>
<p>The <strong>Minkowski sum</strong>, $S + T$, of two shapes $S$ and $T$ is the result of adding every point in $S$ to every point in $T$, where point addition is performed coordinate-wise: $(u, v) + (x, y) = (u + x, v + y)$.</p>
<p>For example, the sum of $S_3$ and $S_4$ is the six-sided shape shown in pink below:</p>
<div class="center">
<img alt="picture showing S_3 + S_4" class="dark_img" src="resources/images/0228.png?1678992052"/></div>
<p>How many sides does $S_{1864} + S_{1865} + \cdots + S_{1909}$ have?</p> | 86226 | Saturday, 17th January 2009, 05:00 am | 1494 | 70% | hard |
370 | Geometric Triangles | Let us define a geometric triangle as an integer sided triangle with sides $a \le b \le c$ so that its sides form a geometric progression, i.e. $b^2 = a \cdot c$
An example of such a geometric triangle is the triangle with sides $a = 144$, $b = 156$ and $c = 169$.
There are $861805$ geometric triangles with perimeter $\le 10^6$.
How many geometric triangles exist with perimeter $\le 2.5 \cdot 10^{13}$? | Let us define a geometric triangle as an integer sided triangle with sides $a \le b \le c$ so that its sides form a geometric progression, i.e. $b^2 = a \cdot c$
An example of such a geometric triangle is the triangle with sides $a = 144$, $b = 156$ and $c = 169$.
There are $861805$ geometric triangles with perimeter $\le 10^6$.
How many geometric triangles exist with perimeter $\le 2.5 \cdot 10^{13}$? | <p>Let us define a <dfn>geometric triangle</dfn> as an integer sided triangle with sides $a \le b \le c$ so that its sides form a <strong>geometric progression</strong>, i.e. $b^2 = a \cdot c$</p>
<p>An example of such a geometric triangle is the triangle with sides $a = 144$, $b = 156$ and $c = 169$.</p>
<p>There are $861805$ geometric triangles with perimeter $\le 10^6$.</p>
<p>How many geometric triangles exist with perimeter $\le 2.5 \cdot 10^{13}$?</p> | 41791929448408 | Sunday, 5th February 2012, 07:00 am | 592 | 65% | hard |
643 | $2$-Friendly | Two positive integers $a$ and $b$ are $2$-friendly when $\gcd(a,b) = 2^t, t \gt 0$. For example, $24$ and $40$ are $2$-friendly because $\gcd(24,40) = 8 = 2^3$ while $24$ and $36$ are not because $\gcd(24,36) = 12 = 2^2\cdot 3$ not a power of $2$.
Let $f(n)$ be the number of pairs, $(p,q)$, of positive integers with $1\le p\lt q\le n$ such that $p$ and $q$ are $2$-friendly. You are given $f(10^2) = 1031$ and $f(10^6) = 321418433$ modulo $1\,000\,000\,007$.
Find $f(10^{11})$ modulo $1\,000\,000\,007$. | Two positive integers $a$ and $b$ are $2$-friendly when $\gcd(a,b) = 2^t, t \gt 0$. For example, $24$ and $40$ are $2$-friendly because $\gcd(24,40) = 8 = 2^3$ while $24$ and $36$ are not because $\gcd(24,36) = 12 = 2^2\cdot 3$ not a power of $2$.
Let $f(n)$ be the number of pairs, $(p,q)$, of positive integers with $1\le p\lt q\le n$ such that $p$ and $q$ are $2$-friendly. You are given $f(10^2) = 1031$ and $f(10^6) = 321418433$ modulo $1\,000\,000\,007$.
Find $f(10^{11})$ modulo $1\,000\,000\,007$. | <p>Two positive integers $a$ and $b$ are <dfn>$2$-friendly</dfn> when $\gcd(a,b) = 2^t, t \gt 0$. For example, $24$ and $40$ are $2$-friendly because $\gcd(24,40) = 8 = 2^3$ while $24$ and $36$ are not because $\gcd(24,36) = 12 = 2^2\cdot 3$ not a power of $2$.</p>
<p>Let $f(n)$ be the number of pairs, $(p,q)$, of positive integers with $1\le p\lt q\le n$ such that $p$ and $q$ are $2$-friendly. You are given $f(10^2) = 1031$ and $f(10^6) = 321418433$ modulo $1\,000\,000\,007$.</p>
<p>Find $f(10^{11})$ modulo $1\,000\,000\,007$.</p> | 968274154 | Saturday, 17th November 2018, 07:00 pm | 694 | 25% | easy |
417 | Reciprocal Cycles II | A unit fraction contains $1$ in the numerator. The decimal representation of the unit fractions with denominators $2$ to $10$ are given:
\begin{align}
1/2 &= 0.5\\
1/3 &=0.(3)\\
1/4 &=0.25\\
1/5 &= 0.2\\
1/6 &= 0.1(6)\\
1/7 &= 0.(142857)\\
1/8 &= 0.125\\
1/9 &= 0.(1)\\
1/10 &= 0.1
\end{align}
Where $0.1(6)$ means $0.166666\cdots$, and has a $1$-digit recurring cycle. It can be seen that $1/7$ has a $6$-digit recurring cycle.
Unit fractions whose denominator has no other prime factors than $2$ and/or $5$ are not considered to have a recurring cycle.
We define the length of the recurring cycle of those unit fractions as $0$.
Let $L(n)$ denote the length of the recurring cycle of $1/n$.
You are given that $\sum L(n)$ for $3 \leq n \leq 1\,000\,000$ equals $55535191115$.
Find $\sum L(n)$ for $3 \leq n \leq 100\,000\,000$. | A unit fraction contains $1$ in the numerator. The decimal representation of the unit fractions with denominators $2$ to $10$ are given:
\begin{align}
1/2 &= 0.5\\
1/3 &=0.(3)\\
1/4 &=0.25\\
1/5 &= 0.2\\
1/6 &= 0.1(6)\\
1/7 &= 0.(142857)\\
1/8 &= 0.125\\
1/9 &= 0.(1)\\
1/10 &= 0.1
\end{align}
Where $0.1(6)$ means $0.166666\cdots$, and has a $1$-digit recurring cycle. It can be seen that $1/7$ has a $6$-digit recurring cycle.
Unit fractions whose denominator has no other prime factors than $2$ and/or $5$ are not considered to have a recurring cycle.
We define the length of the recurring cycle of those unit fractions as $0$.
Let $L(n)$ denote the length of the recurring cycle of $1/n$.
You are given that $\sum L(n)$ for $3 \leq n \leq 1\,000\,000$ equals $55535191115$.
Find $\sum L(n)$ for $3 \leq n \leq 100\,000\,000$. | <p>A unit fraction contains $1$ in the numerator. The decimal representation of the unit fractions with denominators $2$ to $10$ are given:</p>
\begin{align}
1/2 &= 0.5\\
1/3 &=0.(3)\\
1/4 &=0.25\\
1/5 &= 0.2\\
1/6 &= 0.1(6)\\
1/7 &= 0.(142857)\\
1/8 &= 0.125\\
1/9 &= 0.(1)\\
1/10 &= 0.1
\end{align}
<p>Where $0.1(6)$ means $0.166666\cdots$, and has a $1$-digit recurring cycle. It can be seen that $1/7$ has a $6$-digit recurring cycle.</p>
<p>
Unit fractions whose denominator has no other prime factors than $2$ and/or $5$ are not considered to have a recurring cycle.<br/>
We define the length of the recurring cycle of those unit fractions as $0$.
</p>
<p>
Let $L(n)$ denote the length of the recurring cycle of $1/n$.
You are given that $\sum L(n)$ for $3 \leq n \leq 1\,000\,000$ equals $55535191115$.
</p>
<p>
Find $\sum L(n)$ for $3 \leq n \leq 100\,000\,000$.</p> | 446572970925740 | Saturday, 2nd March 2013, 04:00 pm | 993 | 35% | medium |
453 | Lattice Quadrilaterals | A simple quadrilateral is a polygon that has four distinct vertices, has no straight angles and does not self-intersect.
Let $Q(m, n)$ be the number of simple quadrilaterals whose vertices are lattice points with coordinates $(x,y)$ satisfying $0 \le x \le m$ and $0 \le y \le n$.
For example, $Q(2, 2) = 94$ as can be seen below:
It can also be verified that $Q(3, 7) = 39590$, $Q(12, 3) = 309000$ and $Q(123, 45) = 70542215894646$.
Find $Q(12345, 6789) \bmod 135707531$. | A simple quadrilateral is a polygon that has four distinct vertices, has no straight angles and does not self-intersect.
Let $Q(m, n)$ be the number of simple quadrilaterals whose vertices are lattice points with coordinates $(x,y)$ satisfying $0 \le x \le m$ and $0 \le y \le n$.
For example, $Q(2, 2) = 94$ as can be seen below:
It can also be verified that $Q(3, 7) = 39590$, $Q(12, 3) = 309000$ and $Q(123, 45) = 70542215894646$.
Find $Q(12345, 6789) \bmod 135707531$. | <p>A <strong>simple quadrilateral</strong> is a polygon that has four distinct vertices, has no straight angles and does not self-intersect.</p>
<p>Let $Q(m, n)$ be the number of simple quadrilaterals whose vertices are lattice points with coordinates $(x,y)$ satisfying $0 \le x \le m$ and $0 \le y \le n$.</p>
<p>For example, $Q(2, 2) = 94$ as can be seen below:</p>
<p align="center"><img alt="0453_quad.png" class="dark_img" src="resources/images/0453_quad.png?1678992053"/></p>
<p>It can also be verified that $Q(3, 7) = 39590$, $Q(12, 3) = 309000$ and $Q(123, 45) = 70542215894646$.</p>
<p>Find $Q(12345, 6789) \bmod 135707531$.</p> | 104354107 | Saturday, 4th January 2014, 04:00 pm | 239 | 95% | hard |
82 | Path Sum: Three Ways | NOTE: This problem is a more challenging version of Problem 81.
The minimal path sum in the $5$ by $5$ matrix below, by starting in any cell in the left column and finishing in any cell in the right column, and only moving up, down, and right, is indicated in red and bold; the sum is equal to $994$.
$$
\begin{pmatrix}
131 & 673 & \color{red}{234} & \color{red}{103} & \color{red}{18}\\
\color{red}{201} & \color{red}{96} & \color{red}{342} & 965 & 150\\
630 & 803 & 746 & 422 & 111\\
537 & 699 & 497 & 121 & 956\\
805 & 732 & 524 & 37 & 331
\end{pmatrix}
$$
Find the minimal path sum from the left column to the right column in matrix.txt (right click and "Save Link/Target As..."), a 31K text file containing an $80$ by $80$ matrix. | NOTE: This problem is a more challenging version of Problem 81.
The minimal path sum in the $5$ by $5$ matrix below, by starting in any cell in the left column and finishing in any cell in the right column, and only moving up, down, and right, is indicated in red and bold; the sum is equal to $994$.
$$
\begin{pmatrix}
131 & 673 & \color{red}{234} & \color{red}{103} & \color{red}{18}\\
\color{red}{201} & \color{red}{96} & \color{red}{342} & 965 & 150\\
630 & 803 & 746 & 422 & 111\\
537 & 699 & 497 & 121 & 956\\
805 & 732 & 524 & 37 & 331
\end{pmatrix}
$$
Find the minimal path sum from the left column to the right column in matrix.txt (right click and "Save Link/Target As..."), a 31K text file containing an $80$ by $80$ matrix. | <p class="small_notice">NOTE: This problem is a more challenging version of <a href="problem=81">Problem 81</a>.</p>
<p>The minimal path sum in the $5$ by $5$ matrix below, by starting in any cell in the left column and finishing in any cell in the right column, and only moving up, down, and right, is indicated in red and bold; the sum is equal to $994$.</p>
<div class="center">
$$
\begin{pmatrix}
131 & 673 & \color{red}{234} & \color{red}{103} & \color{red}{18}\\
\color{red}{201} & \color{red}{96} & \color{red}{342} & 965 & 150\\
630 & 803 & 746 & 422 & 111\\
537 & 699 & 497 & 121 & 956\\
805 & 732 & 524 & 37 & 331
\end{pmatrix}
$$
</div>
<p>Find the minimal path sum from the left column to the right column in <a href="resources/documents/0082_matrix.txt">matrix.txt</a> (right click and "Save Link/Target As..."), a 31K text file containing an $80$ by $80$ matrix.</p> | 260324 | Friday, 5th November 2004, 06:00 pm | 23449 | 20% | easy |
755 | Not Zeckendorf | Consider the Fibonacci sequence $\{1,2,3,5,8,13,21,\ldots\}$.
We let $f(n)$ be the number of ways of representing an integer $n\ge 0$ as the sum of different Fibonacci numbers.
For example, $16 = 3+13 = 1+2+13 = 3+5+8 = 1+2+5+8$ and hence $f(16) = 4$.
By convention $f(0) = 1$.
Further we define
$$S(n) = \sum_{k=0}^n f(k).$$
You are given $S(100) = 415$ and $S(10^4) = 312807$.
Find $\displaystyle S(10^{13})$. | Consider the Fibonacci sequence $\{1,2,3,5,8,13,21,\ldots\}$.
We let $f(n)$ be the number of ways of representing an integer $n\ge 0$ as the sum of different Fibonacci numbers.
For example, $16 = 3+13 = 1+2+13 = 3+5+8 = 1+2+5+8$ and hence $f(16) = 4$.
By convention $f(0) = 1$.
Further we define
$$S(n) = \sum_{k=0}^n f(k).$$
You are given $S(100) = 415$ and $S(10^4) = 312807$.
Find $\displaystyle S(10^{13})$. | <p>
Consider the Fibonacci sequence $\{1,2,3,5,8,13,21,\ldots\}$.
</p>
<p>
We let $f(n)$ be the number of ways of representing an integer $n\ge 0$ as the sum of different Fibonacci numbers.<br/>
For example, $16 = 3+13 = 1+2+13 = 3+5+8 = 1+2+5+8$ and hence $f(16) = 4$.
By convention $f(0) = 1$.
</p>
<p>
Further we define
$$S(n) = \sum_{k=0}^n f(k).$$
You are given $S(100) = 415$ and $S(10^4) = 312807$.
</p>
<p>
Find $\displaystyle S(10^{13})$.
</p> | 2877071595975576960 | Sunday, 18th April 2021, 11:00 am | 972 | 15% | easy |
790 | Clock Grid | There is a grid of length and width $50515093$ points. A clock is placed on each grid point. The clocks are all analogue showing a single hour hand initially pointing at $12$.
A sequence $S_t$ is created where:
$$
\begin{align}
S_0 &= 290797\\
S_t &= S_{t-1}^2 \bmod 50515093 &t>0
\end{align}
$$
The four numbers $N_t = (S_{4t-4}, S_{4t-3}, S_{4t-2}, S_{4t-1})$ represent a range within the grid, with the first pair of numbers representing the x-bounds and the second pair representing the y-bounds. For example, if $N_t = (3,9,47,20)$, the range would be $3\le x\le 9$ and $20\le y\le47$, and would include $196$ clocks.
For each $t$ $(t>0)$, the clocks within the range represented by $N_t$ are moved to the next hour $12\rightarrow 1\rightarrow 2\rightarrow \cdots $.
We define $C(t)$ to be the sum of the hours that the clock hands are pointing to after timestep $t$.
You are given $C(0) = 30621295449583788$, $C(1) = 30613048345941659$, $C(10) = 21808930308198471$ and $C(100) = 16190667393984172$.
Find $C(10^5)$. | There is a grid of length and width $50515093$ points. A clock is placed on each grid point. The clocks are all analogue showing a single hour hand initially pointing at $12$.
A sequence $S_t$ is created where:
$$
\begin{align}
S_0 &= 290797\\
S_t &= S_{t-1}^2 \bmod 50515093 &t>0
\end{align}
$$
The four numbers $N_t = (S_{4t-4}, S_{4t-3}, S_{4t-2}, S_{4t-1})$ represent a range within the grid, with the first pair of numbers representing the x-bounds and the second pair representing the y-bounds. For example, if $N_t = (3,9,47,20)$, the range would be $3\le x\le 9$ and $20\le y\le47$, and would include $196$ clocks.
For each $t$ $(t>0)$, the clocks within the range represented by $N_t$ are moved to the next hour $12\rightarrow 1\rightarrow 2\rightarrow \cdots $.
We define $C(t)$ to be the sum of the hours that the clock hands are pointing to after timestep $t$.
You are given $C(0) = 30621295449583788$, $C(1) = 30613048345941659$, $C(10) = 21808930308198471$ and $C(100) = 16190667393984172$.
Find $C(10^5)$. | <p>There is a grid of length and width $50515093$ points. A clock is placed on each grid point. The clocks are all analogue showing a single hour hand initially pointing at $12$.</p>
<p>A sequence $S_t$ is created where:
$$
\begin{align}
S_0 &= 290797\\
S_t &= S_{t-1}^2 \bmod 50515093 &t>0
\end{align}
$$
The four numbers $N_t = (S_{4t-4}, S_{4t-3}, S_{4t-2}, S_{4t-1})$ represent a range within the grid, with the first pair of numbers representing the x-bounds and the second pair representing the y-bounds. For example, if $N_t = (3,9,47,20)$, the range would be $3\le x\le 9$ and $20\le y\le47$, and would include $196$ clocks.</p>
<p>For each $t$ $(t>0)$, the clocks within the range represented by $N_t$ are moved to the next hour $12\rightarrow 1\rightarrow 2\rightarrow \cdots $.</p>
<p>We define $C(t)$ to be the sum of the hours that the clock hands are pointing to after timestep $t$.<br/>
You are given $C(0) = 30621295449583788$, $C(1) = 30613048345941659$, $C(10) = 21808930308198471$ and $C(100) = 16190667393984172$.</p>
<p>Find $C(10^5)$.</p> | 16585056588495119 | Saturday, 19th March 2022, 10:00 pm | 281 | 45% | medium |
371 | Licence Plates | Oregon licence plates consist of three letters followed by a three digit number (each digit can be from [0..9]).
While driving to work Seth plays the following game:
Whenever the numbers of two licence plates seen on his trip add to 1000 that's a win.
E.g. MIC-012 and HAN-988 is a win and RYU-500 and SET-500 too (as long as he sees them in the same trip).
Find the expected number of plates he needs to see for a win.
Give your answer rounded to 8 decimal places behind the decimal point.
Note: We assume that each licence plate seen is equally likely to have any three digit number on it. | Oregon licence plates consist of three letters followed by a three digit number (each digit can be from [0..9]).
While driving to work Seth plays the following game:
Whenever the numbers of two licence plates seen on his trip add to 1000 that's a win.
E.g. MIC-012 and HAN-988 is a win and RYU-500 and SET-500 too (as long as he sees them in the same trip).
Find the expected number of plates he needs to see for a win.
Give your answer rounded to 8 decimal places behind the decimal point.
Note: We assume that each licence plate seen is equally likely to have any three digit number on it. | <p>
Oregon licence plates consist of three letters followed by a three digit number (each digit can be from [0..9]).<br/>
While driving to work Seth plays the following game:<br/>
Whenever the numbers of two licence plates seen on his trip add to 1000 that's a win.
</p>
<p>
E.g. MIC-012 and HAN-988 is a win and RYU-500 and SET-500 too (as long as he sees them in the same trip).
</p><p>
</p><p>
Find the expected number of plates he needs to see for a win.<br/>
Give your answer rounded to 8 decimal places behind the decimal point.
</p>
<p style="font-size:88%;">
<b>Note:</b> We assume that each licence plate seen is equally likely to have any three digit number on it.
</p> | 40.66368097 | Sunday, 12th February 2012, 10:00 am | 1819 | 30% | easy |
312 | Cyclic Paths on Sierpiński Graphs | - A Sierpiński graph of order-$1$ ($S_1$) is an equilateral triangle.
- $S_{n + 1}$ is obtained from $S_n$ by positioning three copies of $S_n$ so that every pair of copies has one common corner.
Let $C(n)$ be the number of cycles that pass exactly once through all the vertices of $S_n$.
For example, $C(3) = 8$ because eight such cycles can be drawn on $S_3$, as shown below:
It can also be verified that :
$C(1) = C(2) = 1$
$C(5) = 71328803586048$
$C(10\,000) \bmod 10^8 = 37652224$
$C(10\,000) \bmod 13^8 = 617720485$
Find $C(C(C(10\,000))) \bmod 13^8$. | - A Sierpiński graph of order-$1$ ($S_1$) is an equilateral triangle.
- $S_{n + 1}$ is obtained from $S_n$ by positioning three copies of $S_n$ so that every pair of copies has one common corner.
Let $C(n)$ be the number of cycles that pass exactly once through all the vertices of $S_n$.
For example, $C(3) = 8$ because eight such cycles can be drawn on $S_3$, as shown below:
It can also be verified that :
$C(1) = C(2) = 1$
$C(5) = 71328803586048$
$C(10\,000) \bmod 10^8 = 37652224$
$C(10\,000) \bmod 13^8 = 617720485$
Find $C(C(C(10\,000))) \bmod 13^8$. | <p>- A <strong>Sierpiński graph</strong> of order-$1$ ($S_1$) is an equilateral triangle.<br/>
- $S_{n + 1}$ is obtained from $S_n$ by positioning three copies of $S_n$ so that every pair of copies has one common corner.
</p>
<div align="center"><img alt="0312_sierpinskyAt.gif" class="dark_img" src="resources/images/0312_sierpinskyAt.gif?1678992056"/></div>
<p>Let $C(n)$ be the number of cycles that pass exactly once through all the vertices of $S_n$.<br/>
For example, $C(3) = 8$ because eight such cycles can be drawn on $S_3$, as shown below:
</p>
<div align="center"><img alt="0312_sierpinsky8t.gif" class="dark_img" src="resources/images/0312_sierpinsky8t.gif?1678992056"/></div>
<p>It can also be verified that :<br/>
$C(1) = C(2) = 1$<br/>
$C(5) = 71328803586048$<br/>
$C(10\,000) \bmod 10^8 = 37652224$<br/>
$C(10\,000) \bmod 13^8 = 617720485$<br/></p>
<p>Find $C(C(C(10\,000))) \bmod 13^8$.
</p> | 324681947 | Sunday, 28th November 2010, 01:00 am | 944 | 50% | medium |
451 | Modular Inverses | Consider the number $15$.
There are eight positive numbers less than $15$ which are coprime to $15$: $1, 2, 4, 7, 8, 11, 13, 14$.
The modular inverses of these numbers modulo $15$ are: $1, 8, 4, 13, 2, 11, 7, 14$
because
$1 \cdot 1 \bmod 15=1$
$2 \cdot 8=16 \bmod 15=1$
$4 \cdot 4=16 \bmod 15=1$
$7 \cdot 13=91 \bmod 15=1$
$11 \cdot 11=121 \bmod 15=1$
$14 \cdot 14=196 \bmod 15=1$
Let $I(n)$ be the largest positive number $m$ smaller than $n-1$ such that the modular inverse of $m$ modulo $n$ equals $m$ itself.
So $I(15)=11$.
Also $I(100)=51$ and $I(7)=1$.
Find $\sum I(n)$ for $3 \le n \le 2 \times 10^7$. | Consider the number $15$.
There are eight positive numbers less than $15$ which are coprime to $15$: $1, 2, 4, 7, 8, 11, 13, 14$.
The modular inverses of these numbers modulo $15$ are: $1, 8, 4, 13, 2, 11, 7, 14$
because
$1 \cdot 1 \bmod 15=1$
$2 \cdot 8=16 \bmod 15=1$
$4 \cdot 4=16 \bmod 15=1$
$7 \cdot 13=91 \bmod 15=1$
$11 \cdot 11=121 \bmod 15=1$
$14 \cdot 14=196 \bmod 15=1$
Let $I(n)$ be the largest positive number $m$ smaller than $n-1$ such that the modular inverse of $m$ modulo $n$ equals $m$ itself.
So $I(15)=11$.
Also $I(100)=51$ and $I(7)=1$.
Find $\sum I(n)$ for $3 \le n \le 2 \times 10^7$. | <p>
Consider the number $15$.<br/>
There are eight positive numbers less than $15$ which are coprime to $15$: $1, 2, 4, 7, 8, 11, 13, 14$.<br/>
The modular inverses of these numbers modulo $15$ are: $1, 8, 4, 13, 2, 11, 7, 14$<br/>
because<br/>
$1 \cdot 1 \bmod 15=1$<br/>
$2 \cdot 8=16 \bmod 15=1$<br/>
$4 \cdot 4=16 \bmod 15=1$<br/>
$7 \cdot 13=91 \bmod 15=1$<br/>
$11 \cdot 11=121 \bmod 15=1$<br/>
$14 \cdot 14=196 \bmod 15=1<br/>$</p>
<p>
Let $I(n)$ be the largest positive number $m$ smaller than $n-1$ such that the modular inverse of $m$ modulo $n$ equals $m$ itself.<br/>
So $I(15)=11$.<br/>
Also $I(100)=51$ and $I(7)=1$.<br/></p>
<p>
Find $\sum I(n)$ for $3 \le n \le 2 \times 10^7$.</p> | 153651073760956 | Sunday, 22nd December 2013, 10:00 am | 1630 | 30% | easy |
53 | Combinatoric Selections | There are exactly ten ways of selecting three from five, 12345:
123, 124, 125, 134, 135, 145, 234, 235, 245, and 345
In combinatorics, we use the notation, $\displaystyle \binom 5 3 = 10$.
In general, $\displaystyle \binom n r = \dfrac{n!}{r!(n-r)!}$, where $r \le n$, $n! = n \times (n-1) \times ... \times 3 \times 2 \times 1$, and $0! = 1$.
It is not until $n = 23$, that a value exceeds one-million: $\displaystyle \binom {23} {10} = 1144066$.
How many, not necessarily distinct, values of $\displaystyle \binom n r$ for $1 \le n \le 100$, are greater than one-million? | There are exactly ten ways of selecting three from five, 12345:
123, 124, 125, 134, 135, 145, 234, 235, 245, and 345
In combinatorics, we use the notation, $\displaystyle \binom 5 3 = 10$.
In general, $\displaystyle \binom n r = \dfrac{n!}{r!(n-r)!}$, where $r \le n$, $n! = n \times (n-1) \times ... \times 3 \times 2 \times 1$, and $0! = 1$.
It is not until $n = 23$, that a value exceeds one-million: $\displaystyle \binom {23} {10} = 1144066$.
How many, not necessarily distinct, values of $\displaystyle \binom n r$ for $1 \le n \le 100$, are greater than one-million? | <p>There are exactly ten ways of selecting three from five, 12345:</p>
<p class="center">123, 124, 125, 134, 135, 145, 234, 235, 245, and 345</p>
<p>In combinatorics, we use the notation, $\displaystyle \binom 5 3 = 10$.</p>
<p>In general, $\displaystyle \binom n r = \dfrac{n!}{r!(n-r)!}$, where $r \le n$, $n! = n \times (n-1) \times ... \times 3 \times 2 \times 1$, and $0! = 1$.
</p>
<p>It is not until $n = 23$, that a value exceeds one-million: $\displaystyle \binom {23} {10} = 1144066$.</p>
<p>How many, not necessarily distinct, values of $\displaystyle \binom n r$ for $1 \le n \le 100$, are greater than one-million?</p> | 4075 | Friday, 26th September 2003, 06:00 pm | 64266 | 5% | easy |
837 | Amidakuji | Amidakuji (Japanese: 阿弥陀籤) is a method for producing a random permutation of a set of objects.
In the beginning, a number of parallel vertical lines are drawn, one for each object. Then a specified number of horizontal rungs are added, each lower than any previous rungs. Each rung is drawn as a line segment spanning a randomly select pair of adjacent vertical lines.
For example, the following diagram depicts an Amidakuji with three objects ($A$, $B$, $C$) and six rungs:
The coloured lines in the diagram illustrate how to form the permutation. For each object, starting from the top of its vertical line, trace downwards but follow any rung encountered along the way, and record which vertical we end up on. In this example, the resulting permutation happens to be the identity: $A\mapsto A$, $B\mapsto B$, $C\mapsto C$.
Let $a(m, n)$ be the number of different three-object Amidakujis that have $m$ rungs between $A$ and $B$, and $n$ rungs between $B$ and $C$, and whose outcome is the identity permutation. For example, $a(3, 3) = 2$, because the Amidakuji shown above and its mirror image are the only ones with the required property.
You are also given that $a(123, 321) \equiv 172633303 \pmod{1234567891}$.
Find $a(123456789, 987654321)$. Give your answer modulo $1234567891$. | Amidakuji (Japanese: 阿弥陀籤) is a method for producing a random permutation of a set of objects.
In the beginning, a number of parallel vertical lines are drawn, one for each object. Then a specified number of horizontal rungs are added, each lower than any previous rungs. Each rung is drawn as a line segment spanning a randomly select pair of adjacent vertical lines.
For example, the following diagram depicts an Amidakuji with three objects ($A$, $B$, $C$) and six rungs:
The coloured lines in the diagram illustrate how to form the permutation. For each object, starting from the top of its vertical line, trace downwards but follow any rung encountered along the way, and record which vertical we end up on. In this example, the resulting permutation happens to be the identity: $A\mapsto A$, $B\mapsto B$, $C\mapsto C$.
Let $a(m, n)$ be the number of different three-object Amidakujis that have $m$ rungs between $A$ and $B$, and $n$ rungs between $B$ and $C$, and whose outcome is the identity permutation. For example, $a(3, 3) = 2$, because the Amidakuji shown above and its mirror image are the only ones with the required property.
You are also given that $a(123, 321) \equiv 172633303 \pmod{1234567891}$.
Find $a(123456789, 987654321)$. Give your answer modulo $1234567891$. | <p>
<a href="https://en.wikipedia.org/wiki/Amidakuji">Amidakuji</a> (Japanese: 阿弥陀籤) is a method for producing a random permutation of a set of objects.</p>
<p>
In the beginning, a number of parallel vertical lines are drawn, one for each object. Then a specified number of horizontal rungs are added, each lower than any previous rungs. Each rung is drawn as a line segment spanning a randomly select pair of adjacent vertical lines.</p>
<p>
For example, the following diagram depicts an Amidakuji with three objects ($A$, $B$, $C$) and six rungs:</p>
<div style="text-align:center;">
<img alt="0837_amidakuji.png" src="resources/images/0837_amidakuji.png?1678992054"/>
</div>
<p>
The coloured lines in the diagram illustrate how to form the permutation. For each object, starting from the top of its vertical line, trace downwards but follow any rung encountered along the way, and record which vertical we end up on. In this example, the resulting permutation happens to be the identity: $A\mapsto A$, $B\mapsto B$, $C\mapsto C$.</p>
<p>
Let $a(m, n)$ be the number of different three-object Amidakujis that have $m$ rungs between $A$ and $B$, and $n$ rungs between $B$ and $C$, and whose outcome is the identity permutation. For example, $a(3, 3) = 2$, because the Amidakuji shown above and its mirror image are the only ones with the required property.</p>
<p>
You are also given that $a(123, 321) \equiv 172633303 \pmod{1234567891}$.</p>
<p>
Find $a(123456789, 987654321)$. Give your answer modulo $1234567891$.</p> | 428074856 | Saturday, 1st April 2023, 05:00 pm | 221 | 55% | medium |
343 | Fractional Sequences | For any positive integer $k$, a finite sequence $a_i$ of fractions $x_i/y_i$ is defined by:
$a_1 = 1/k$ and
$a_i = (x_{i - 1} + 1) / (y_{i - 1} - 1)$ reduced to lowest terms for $i \gt 1$.
When $a_i$ reaches some integer $n$, the sequence stops. (That is, when $y_i = 1$.)
Define $f(k) = n$.
For example, for $k = 20$:
$1/20 \to 2/19 \to 3/18 = 1/6 \to 2/5 \to 3/4 \to 4/3 \to 5/2 \to 6/1 = 6$
So $f(20) = 6$.
Also $f(1) = 1$, $f(2) = 2$, $f(3) = 1$ and $\sum f(k^3) = 118937$ for $1 \le k \le 100$.
Find $\sum f(k^3)$ for $1 \le k \le 2 \times 10^6$. | For any positive integer $k$, a finite sequence $a_i$ of fractions $x_i/y_i$ is defined by:
$a_1 = 1/k$ and
$a_i = (x_{i - 1} + 1) / (y_{i - 1} - 1)$ reduced to lowest terms for $i \gt 1$.
When $a_i$ reaches some integer $n$, the sequence stops. (That is, when $y_i = 1$.)
Define $f(k) = n$.
For example, for $k = 20$:
$1/20 \to 2/19 \to 3/18 = 1/6 \to 2/5 \to 3/4 \to 4/3 \to 5/2 \to 6/1 = 6$
So $f(20) = 6$.
Also $f(1) = 1$, $f(2) = 2$, $f(3) = 1$ and $\sum f(k^3) = 118937$ for $1 \le k \le 100$.
Find $\sum f(k^3)$ for $1 \le k \le 2 \times 10^6$. | <p>For any positive integer $k$, a finite sequence $a_i$ of fractions $x_i/y_i$ is defined by:<br/>
$a_1 = 1/k$ and<br/>
$a_i = (x_{i - 1} + 1) / (y_{i - 1} - 1)$ reduced to lowest terms for $i \gt 1$.<br/>
When $a_i$ reaches some integer $n$, the sequence stops. (That is, when $y_i = 1$.)<br/>
Define $f(k) = n$. <br/>
For example, for $k = 20$:
</p>
<p>
$1/20 \to 2/19 \to 3/18 = 1/6 \to 2/5 \to 3/4 \to 4/3 \to 5/2 \to 6/1 = 6$
</p>
<p>
So $f(20) = 6$.
</p>
<p>
Also $f(1) = 1$, $f(2) = 2$, $f(3) = 1$ and $\sum f(k^3) = 118937$ for $1 \le k \le 100$.
</p>
<p>
Find $\sum f(k^3)$ for $1 \le k \le 2 \times 10^6$.
</p> | 269533451410884183 | Saturday, 18th June 2011, 04:00 pm | 1552 | 35% | medium |
541 | Divisibility of Harmonic Number Denominators | The $n$th harmonic number $H_n$ is defined as the sum of the multiplicative inverses of the first $n$ positive integers, and can be written as a reduced fraction $a_n/b_n$.
$H_n = \displaystyle \sum_{k=1}^n \frac 1 k = \frac {a_n} {b_n}$, with $\gcd(a_n, b_n)=1$.
Let $M(p)$ be the largest value of $n$ such that $b_n$ is not divisible by $p$.
For example, $M(3) = 68$ because $H_{68} = \frac {a_{68}} {b_{68}} = \frac {14094018321907827923954201611} {2933773379069966367528193600}$, $b_{68}=2933773379069966367528193600$ is not divisible by $3$, but all larger harmonic numbers have denominators divisible by $3$.
You are given $M(7) = 719102$.
Find $M(137)$. | The $n$th harmonic number $H_n$ is defined as the sum of the multiplicative inverses of the first $n$ positive integers, and can be written as a reduced fraction $a_n/b_n$.
$H_n = \displaystyle \sum_{k=1}^n \frac 1 k = \frac {a_n} {b_n}$, with $\gcd(a_n, b_n)=1$.
Let $M(p)$ be the largest value of $n$ such that $b_n$ is not divisible by $p$.
For example, $M(3) = 68$ because $H_{68} = \frac {a_{68}} {b_{68}} = \frac {14094018321907827923954201611} {2933773379069966367528193600}$, $b_{68}=2933773379069966367528193600$ is not divisible by $3$, but all larger harmonic numbers have denominators divisible by $3$.
You are given $M(7) = 719102$.
Find $M(137)$. | <p>The $n$<sup>th</sup> <strong>harmonic number</strong> $H_n$ is defined as the sum of the multiplicative inverses of the first $n$ positive integers, and can be written as a <strong>reduced fraction</strong> $a_n/b_n$.<br/>
$H_n = \displaystyle \sum_{k=1}^n \frac 1 k = \frac {a_n} {b_n}$, with $\gcd(a_n, b_n)=1$.</p>
<p>Let $M(p)$ be the largest value of $n$ such that $b_n$ is not divisible by $p$.</p>
<p>For example, $M(3) = 68$ because $H_{68} = \frac {a_{68}} {b_{68}} = \frac {14094018321907827923954201611} {2933773379069966367528193600}$, $b_{68}=2933773379069966367528193600$ is not divisible by $3$, but all larger harmonic numbers have denominators divisible by $3$.</p>
<p>You are given $M(7) = 719102$.</p>
<p>Find $M(137)$.</p> | 4580726482872451 | Sunday, 3rd January 2016, 10:00 am | 233 | 90% | hard |
268 | At Least Four Distinct Prime Factors Less Than 100 | It can be verified that there are $23$ positive integers less than $1000$ that are divisible by at least four distinct primes less than $100$.
Find how many positive integers less than $10^{16}$ are divisible by at least four distinct primes less than $100$. | It can be verified that there are $23$ positive integers less than $1000$ that are divisible by at least four distinct primes less than $100$.
Find how many positive integers less than $10^{16}$ are divisible by at least four distinct primes less than $100$. | <p>It can be verified that there are $23$ positive integers less than $1000$ that are divisible by at least four distinct primes less than $100$.</p>
<p>Find how many positive integers less than $10^{16}$ are divisible by at least four distinct primes less than $100$.</p> | 785478606870985 | Friday, 11th December 2009, 05:00 pm | 1627 | 70% | hard |
722 | Slowly Converging Series | For a non-negative integer $k$, define
\[
E_k(q) = \sum\limits_{n = 1}^\infty \sigma_k(n)q^n
\]
where $\sigma_k(n) = \sum_{d \mid n} d^k$ is the sum of the $k$-th powers of the positive divisors of $n$.
It can be shown that, for every $k$, the series $E_k(q)$ converges for any $0 < q < 1$.
For example,
$E_1(1 - \frac{1}{2^4}) = 3.872155809243\mathrm e2$
$E_3(1 - \frac{1}{2^8}) = 2.767385314772\mathrm e10$
$E_7(1 - \frac{1}{2^{15}}) = 6.725803486744\mathrm e39$
All the above values are given in scientific notation rounded to twelve digits after the decimal point.
Find the value of $E_{15}(1 - \frac{1}{2^{25}})$.
Give the answer in scientific notation rounded to twelve digits after the decimal point. | For a non-negative integer $k$, define
\[
E_k(q) = \sum\limits_{n = 1}^\infty \sigma_k(n)q^n
\]
where $\sigma_k(n) = \sum_{d \mid n} d^k$ is the sum of the $k$-th powers of the positive divisors of $n$.
It can be shown that, for every $k$, the series $E_k(q)$ converges for any $0 < q < 1$.
For example,
$E_1(1 - \frac{1}{2^4}) = 3.872155809243\mathrm e2$
$E_3(1 - \frac{1}{2^8}) = 2.767385314772\mathrm e10$
$E_7(1 - \frac{1}{2^{15}}) = 6.725803486744\mathrm e39$
All the above values are given in scientific notation rounded to twelve digits after the decimal point.
Find the value of $E_{15}(1 - \frac{1}{2^{25}})$.
Give the answer in scientific notation rounded to twelve digits after the decimal point. | <p>For a non-negative integer $k$, define
\[
E_k(q) = \sum\limits_{n = 1}^\infty \sigma_k(n)q^n
\]
where $\sigma_k(n) = \sum_{d \mid n} d^k$ is the sum of the $k$-th powers of the positive divisors of $n$.</p>
<p>It can be shown that, for every $k$, the series $E_k(q)$ converges for any $0 < q < 1$.</p>
<p>For example,<br/>
$E_1(1 - \frac{1}{2^4}) = 3.872155809243\mathrm e2$<br/>
$E_3(1 - \frac{1}{2^8}) = 2.767385314772\mathrm e10$<br/>
$E_7(1 - \frac{1}{2^{15}}) = 6.725803486744\mathrm e39$<br/>
All the above values are given in scientific notation rounded to twelve digits after the decimal point.</p>
<p>Find the value of $E_{15}(1 - \frac{1}{2^{25}})$.<br/>
Give the answer in scientific notation rounded to twelve digits after the decimal point.</p> | 3.376792776502e132 | Sunday, 28th June 2020, 05:00 am | 571 | 25% | easy |
107 | Minimal Network | The following undirected network consists of seven vertices and twelve edges with a total weight of 243.
The same network can be represented by the matrix below.
ABCDEFG
A-161221---
B16--1720--
C12--28-31-
D211728-181923
E-20-18--11
F--3119--27
G---231127-
However, it is possible to optimise the network by removing some edges and still ensure that all points on the network remain connected. The network which achieves the maximum saving is shown below. It has a weight of 93, representing a saving of 243 − 93 = 150 from the original network.
Using network.txt (right click and 'Save Link/Target As...'), a 6K text file containing a network with forty vertices, and given in matrix form, find the maximum saving which can be achieved by removing redundant edges whilst ensuring that the network remains connected. | The following undirected network consists of seven vertices and twelve edges with a total weight of 243.
The same network can be represented by the matrix below.
ABCDEFG
A-161221---
B16--1720--
C12--28-31-
D211728-181923
E-20-18--11
F--3119--27
G---231127-
However, it is possible to optimise the network by removing some edges and still ensure that all points on the network remain connected. The network which achieves the maximum saving is shown below. It has a weight of 93, representing a saving of 243 − 93 = 150 from the original network.
Using network.txt (right click and 'Save Link/Target As...'), a 6K text file containing a network with forty vertices, and given in matrix form, find the maximum saving which can be achieved by removing redundant edges whilst ensuring that the network remains connected. | <p>The following undirected network consists of seven vertices and twelve edges with a total weight of 243.</p>
<div class="center">
<img alt="" class="dark_img" src="resources/images/0107_1.png?1678992052"/><br/></div>
<p>The same network can be represented by the matrix below.</p>
<table align="center" border="1" cellpadding="5" cellspacing="0"><tr><td> </td><td><b>A</b></td><td><b>B</b></td><td><b>C</b></td><td><b>D</b></td><td><b>E</b></td><td><b>F</b></td><td><b>G</b></td>
</tr><tr><td><b>A</b></td><td>-</td><td>16</td><td>12</td><td>21</td><td>-</td><td>-</td><td>-</td>
</tr><tr><td><b>B</b></td><td>16</td><td>-</td><td>-</td><td>17</td><td>20</td><td>-</td><td>-</td>
</tr><tr><td><b>C</b></td><td>12</td><td>-</td><td>-</td><td>28</td><td>-</td><td>31</td><td>-</td>
</tr><tr><td><b>D</b></td><td>21</td><td>17</td><td>28</td><td>-</td><td>18</td><td>19</td><td>23</td>
</tr><tr><td><b>E</b></td><td>-</td><td>20</td><td>-</td><td>18</td><td>-</td><td>-</td><td>11</td>
</tr><tr><td><b>F</b></td><td>-</td><td>-</td><td>31</td><td>19</td><td>-</td><td>-</td><td>27</td>
</tr><tr><td><b>G</b></td><td>-</td><td>-</td><td>-</td><td>23</td><td>11</td><td>27</td><td>-</td>
</tr></table><p>However, it is possible to optimise the network by removing some edges and still ensure that all points on the network remain connected. The network which achieves the maximum saving is shown below. It has a weight of 93, representing a saving of 243 − 93 = 150 from the original network.</p>
<div class="center">
<img alt="" class="dark_img" src="resources/images/0107_2.png?1678992052"/><br/></div>
<p>Using <a href="resources/documents/0107_network.txt">network.txt</a> (right click and 'Save Link/Target As...'), a 6K text file containing a network with forty vertices, and given in matrix form, find the maximum saving which can be achieved by removing redundant edges whilst ensuring that the network remains connected.</p> | 259679 | Friday, 21st October 2005, 06:00 pm | 12252 | 35% | medium |
123 | Prime Square Remainders | Let $p_n$ be the $n$th prime: $2, 3, 5, 7, 11, \dots$, and let $r$ be the remainder when $(p_n - 1)^n + (p_n + 1)^n$ is divided by $p_n^2$.
For example, when $n = 3$, $p_3 = 5$, and $4^3 + 6^3 = 280 \equiv 5 \mod 25$.
The least value of $n$ for which the remainder first exceeds $10^9$ is $7037$.
Find the least value of $n$ for which the remainder first exceeds $10^{10}$. | Let $p_n$ be the $n$th prime: $2, 3, 5, 7, 11, \dots$, and let $r$ be the remainder when $(p_n - 1)^n + (p_n + 1)^n$ is divided by $p_n^2$.
For example, when $n = 3$, $p_3 = 5$, and $4^3 + 6^3 = 280 \equiv 5 \mod 25$.
The least value of $n$ for which the remainder first exceeds $10^9$ is $7037$.
Find the least value of $n$ for which the remainder first exceeds $10^{10}$. | <p>Let $p_n$ be the $n$th prime: $2, 3, 5, 7, 11, \dots$, and let $r$ be the remainder when $(p_n - 1)^n + (p_n + 1)^n$ is divided by $p_n^2$.</p>
<p>For example, when $n = 3$, $p_3 = 5$, and $4^3 + 6^3 = 280 \equiv 5 \mod 25$.</p>
<p>The least value of $n$ for which the remainder first exceeds $10^9$ is $7037$.</p>
<p>Find the least value of $n$ for which the remainder first exceeds $10^{10}$.</p> | 21035 | Friday, 16th June 2006, 06:00 pm | 12733 | 30% | easy |
397 | Triangle on Parabola | On the parabola $y = x^2/k$, three points $A(a, a^2/k)$, $B(b, b^2/k)$ and $C(c, c^2/k)$ are chosen.
Let $F(K, X)$ be the number of the integer quadruplets $(k, a, b, c)$ such that at least one angle of the triangle $ABC$ is $45$-degree, with $1 \le k \le K$ and $-X \le a \lt b \lt c \le X$.
For example, $F(1, 10) = 41$ and $F(10, 100) = 12492$.
Find $F(10^6, 10^9)$. | On the parabola $y = x^2/k$, three points $A(a, a^2/k)$, $B(b, b^2/k)$ and $C(c, c^2/k)$ are chosen.
Let $F(K, X)$ be the number of the integer quadruplets $(k, a, b, c)$ such that at least one angle of the triangle $ABC$ is $45$-degree, with $1 \le k \le K$ and $-X \le a \lt b \lt c \le X$.
For example, $F(1, 10) = 41$ and $F(10, 100) = 12492$.
Find $F(10^6, 10^9)$. | <p>
On the parabola $y = x^2/k$, three points $A(a, a^2/k)$, $B(b, b^2/k)$ and $C(c, c^2/k)$ are chosen.
</p>
<p>
Let $F(K, X)$ be the number of the integer quadruplets $(k, a, b, c)$ such that at least one angle of the triangle $ABC$ is $45$-degree, with $1 \le k \le K$ and $-X \le a \lt b \lt c \le X$.
</p>
<p>
For example, $F(1, 10) = 41$ and $F(10, 100) = 12492$.<br/>
Find $F(10^6, 10^9)$.
</p> | 141630459461893728 | Sunday, 7th October 2012, 05:00 am | 301 | 70% | hard |
922 | Young's Game A | A Young diagram is a finite collection of (equally-sized) squares in a grid-like arrangement of rows and columns, such that
the left-most squares of all rows are aligned vertically;
the top squares of all columns are aligned horizontally;
the rows are non-increasing in size as we move top to bottom;
the columns are non-increasing in size as we move left to right.
Two examples of Young diagrams are shown below.
Two players Right and Down play a game on several Young diagrams, all disconnected from each other. Initially, a token is placed in the top-left square of each diagram. Then they take alternating turns, starting with Right. On Right's turn, Right selects a token on one diagram and moves it any number of squares to the right. On Down's turn, Down selects a token on one diagram and moves it any number of squares downwards. A player unable to make a legal move on their turn loses the game.
For $a,b,k\geq 1$ we define an $(a,b,k)$-staircase to be the Young diagram where the bottom-right frontier consists of $k$ steps of vertical height $a$ and horizontal length $b$. Shown below are four examples of staircases with $(a,b,k)$ respectively $(1,1,4),$ $(5,1,1),$ $(3,3,2),$ $(2,4,3)$.
Additionally, define the weight of an $(a,b,k)$-staircase to be $a+b+k$.
Let $R(m, w)$ be the number ways of choosing $m$ staircases, each having weight not exceeding $w$, upon which Right (moving first in the game) will win the game assuming optimal play. Different orderings of the same set of staircases are to be counted separately.
For example, $R(2, 4)=7$ is illustrated below, with tokens as grey circles drawn in their initial positions.
You are also given $R(3, 9)=314104$.
Find $R(8, 64)$ giving your answer modulo $10^9+7$. | A Young diagram is a finite collection of (equally-sized) squares in a grid-like arrangement of rows and columns, such that
the left-most squares of all rows are aligned vertically;
the top squares of all columns are aligned horizontally;
the rows are non-increasing in size as we move top to bottom;
the columns are non-increasing in size as we move left to right.
Two examples of Young diagrams are shown below.
Two players Right and Down play a game on several Young diagrams, all disconnected from each other. Initially, a token is placed in the top-left square of each diagram. Then they take alternating turns, starting with Right. On Right's turn, Right selects a token on one diagram and moves it any number of squares to the right. On Down's turn, Down selects a token on one diagram and moves it any number of squares downwards. A player unable to make a legal move on their turn loses the game.
For $a,b,k\geq 1$ we define an $(a,b,k)$-staircase to be the Young diagram where the bottom-right frontier consists of $k$ steps of vertical height $a$ and horizontal length $b$. Shown below are four examples of staircases with $(a,b,k)$ respectively $(1,1,4),$ $(5,1,1),$ $(3,3,2),$ $(2,4,3)$.
Additionally, define the weight of an $(a,b,k)$-staircase to be $a+b+k$.
Let $R(m, w)$ be the number ways of choosing $m$ staircases, each having weight not exceeding $w$, upon which Right (moving first in the game) will win the game assuming optimal play. Different orderings of the same set of staircases are to be counted separately.
For example, $R(2, 4)=7$ is illustrated below, with tokens as grey circles drawn in their initial positions.
You are also given $R(3, 9)=314104$.
Find $R(8, 64)$ giving your answer modulo $10^9+7$. | <p>
A <strong>Young diagram</strong> is a finite collection of (equally-sized) squares in a grid-like arrangement of rows and columns, such that</p>
<ul>
<li>the left-most squares of all rows are aligned vertically;
</li><li>the top squares of all columns are aligned horizontally;
</li><li>the rows are non-increasing in size as we move top to bottom;
</li><li>the columns are non-increasing in size as we move left to right.
</li></ul>
<p>
Two examples of Young diagrams are shown below.</p>
<div style="text-align:center;">
<img alt="0922_youngs_game_diagrams.png" src="resources/images/0922_youngs_game_diagrams.png?1731534949"/></div>
<p>
Two players Right and Down play a game on several Young diagrams, all disconnected from each other. Initially, a token is placed in the top-left square of each diagram. Then they take alternating turns, starting with Right. On Right's turn, Right selects a token on one diagram and moves it <b>any number of squares</b> to the right. On Down's turn, Down selects a token on one diagram and moves it <b>any number of squares</b> downwards. A player unable to make a legal move on their turn loses the game.</p>
<p>
For $a,b,k\geq 1$ we define an <dfn>$(a,b,k)$-staircase</dfn> to be the Young diagram where the bottom-right frontier consists of $k$ <dfn>steps</dfn> of vertical height $a$ and horizontal length $b$. Shown below are four examples of staircases with $(a,b,k)$ respectively $(1,1,4),$ $(5,1,1),$ $(3,3,2),$ $(2,4,3)$.</p>
<div style="text-align:center;">
<img alt="0922_youngs_game_staircases.png" src="resources/images/0922_youngs_game_staircases.png?1731535243"/></div>
<p>
Additionally, define the <dfn>weight</dfn> of an $(a,b,k)$-staircase to be $a+b+k$.</p>
<p>
Let $R(m, w)$ be the number ways of choosing $m$ staircases, each having weight not exceeding $w$, upon which Right (moving first in the game) will win the game assuming optimal play. Different orderings of the same set of staircases are to be counted separately.</p>
<p>
For example, $R(2, 4)=7$ is illustrated below, with tokens as grey circles drawn in their initial positions.</p>
<div style="text-align:center;">
<img alt="0922_youngs_game_example.png" src="resources/images/0922_youngs_game_example.png?1731535375"/></div>
<p>
You are also given $R(3, 9)=314104$.</p>
<p>
Find $R(8, 64)$ giving your answer modulo $10^9+7$.</p> | 858945298 | Saturday, 21st December 2024, 04:00 pm | 118 | 70% | hard |
534 | Weak Queens | The classical eight queens puzzle is the well known problem of placing eight chess queens on an $8 \times 8$ chessboard so that no two queens threaten each other. Allowing configurations to reappear in rotated or mirrored form, a total of $92$ distinct configurations can be found for eight queens. The general case asks for the number of distinct ways of placing $n$ queens on an $n \times n$ board, e.g. you can find $2$ distinct configurations for $n=4$.
Let's define a weak queen on an $n \times n$ board to be a piece which can move any number of squares if moved horizontally, but a maximum of $n - 1 - w$ squares if moved vertically or diagonally, $0 \le w \lt n$ being the "weakness factor". For example, a weak queen on an $n \times n$ board with a weakness factor of $w=1$ located in the bottom row will not be able to threaten any square in the top row as the weak queen would need to move $n - 1$ squares vertically or diagonally to get there, but may only move $n - 2$ squares in these directions. In contrast, the weak queen is not handicapped horizontally, thus threatening every square in its own row, independently from its current position in that row.
Let $Q(n,w)$ be the number of ways $n$ weak queens with weakness factor $w$ can be placed on an $n \times n$ board so that no two queens threaten each other. It can be shown, for example, that $Q(4,0)=2$, $Q(4,2)=16$ and $Q(4,3)=256$.
Let $S(n)=\displaystyle\sum_{w=0}^{n-1} Q(n,w)$.
You are given that $S(4)=276$ and $S(5)=3347$.
Find $S(14)$. | The classical eight queens puzzle is the well known problem of placing eight chess queens on an $8 \times 8$ chessboard so that no two queens threaten each other. Allowing configurations to reappear in rotated or mirrored form, a total of $92$ distinct configurations can be found for eight queens. The general case asks for the number of distinct ways of placing $n$ queens on an $n \times n$ board, e.g. you can find $2$ distinct configurations for $n=4$.
Let's define a weak queen on an $n \times n$ board to be a piece which can move any number of squares if moved horizontally, but a maximum of $n - 1 - w$ squares if moved vertically or diagonally, $0 \le w \lt n$ being the "weakness factor". For example, a weak queen on an $n \times n$ board with a weakness factor of $w=1$ located in the bottom row will not be able to threaten any square in the top row as the weak queen would need to move $n - 1$ squares vertically or diagonally to get there, but may only move $n - 2$ squares in these directions. In contrast, the weak queen is not handicapped horizontally, thus threatening every square in its own row, independently from its current position in that row.
Let $Q(n,w)$ be the number of ways $n$ weak queens with weakness factor $w$ can be placed on an $n \times n$ board so that no two queens threaten each other. It can be shown, for example, that $Q(4,0)=2$, $Q(4,2)=16$ and $Q(4,3)=256$.
Let $S(n)=\displaystyle\sum_{w=0}^{n-1} Q(n,w)$.
You are given that $S(4)=276$ and $S(5)=3347$.
Find $S(14)$. | <p>The classical <b>eight queens puzzle</b> is the well known problem of placing eight chess queens on an $8 \times 8$ chessboard so that no two queens threaten each other. Allowing configurations to reappear in rotated or mirrored form, a total of $92$ distinct configurations can be found for eight queens. The general case asks for the number of distinct ways of placing $n$ queens on an $n \times n$ board, e.g. you can find $2$ distinct configurations for $n=4$.</p>
<p>Let's define a <dfn>weak queen</dfn> on an $n \times n$ board to be a piece which can move any number of squares if moved horizontally, but a maximum of $n - 1 - w$ squares if moved vertically or diagonally, $0 \le w \lt n$ being the "weakness factor". For example, a weak queen on an $n \times n$ board with a weakness factor of $w=1$ located in the bottom row will not be able to threaten any square in the top row as the weak queen would need to move $n - 1$ squares vertically or diagonally to get there, but may only move $n - 2$ squares in these directions. In contrast, the weak queen is not handicapped horizontally, thus threatening every square in its own row, independently from its current position in that row.</p>
<p>Let $Q(n,w)$ be the number of ways $n$ weak queens with weakness factor $w$ can be placed on an $n \times n$ board so that no two queens threaten each other. It can be shown, for example, that $Q(4,0)=2$, $Q(4,2)=16$ and $Q(4,3)=256$.</p>
<p>Let $S(n)=\displaystyle\sum_{w=0}^{n-1} Q(n,w)$.</p>
<p>You are given that $S(4)=276$ and $S(5)=3347$.</p>
<p>Find $S(14)$.</p> | 11726115562784664 | Saturday, 14th November 2015, 01:00 pm | 344 | 55% | medium |
731 | A Stoneham Number | $$A=\sum_{i=1}^{\infty} \frac{1}{3^i 10^{3^i}}$$
Define $A(n)$ to be the $10$ decimal digits from the $n$th digit onward.
For example, $A(100) = 4938271604$ and $A(10^8)=2584642393$.
Find $A(10^{16})$. | $$A=\sum_{i=1}^{\infty} \frac{1}{3^i 10^{3^i}}$$
Define $A(n)$ to be the $10$ decimal digits from the $n$th digit onward.
For example, $A(100) = 4938271604$ and $A(10^8)=2584642393$.
Find $A(10^{16})$. | <p>
$$A=\sum_{i=1}^{\infty} \frac{1}{3^i 10^{3^i}}$$
</p>
<p>
Define $A(n)$ to be the $10$ decimal digits from the $n$th digit onward.
For example, $A(100) = 4938271604$ and $A(10^8)=2584642393$.
</p>
<p>
Find $A(10^{16})$.
</p> | 6086371427 | Sunday, 25th October 2020, 10:00 am | 637 | 20% | easy |
385 | Ellipses Inside Triangles | For any triangle $T$ in the plane, it can be shown that there is a unique ellipse with largest area that is completely inside $T$.
For a given $n$, consider triangles $T$ such that:
- the vertices of $T$ have integer coordinates with absolute value $\le n$, and
- the foci1 of the largest-area ellipse inside $T$ are $(\sqrt{13},0)$ and $(-\sqrt{13},0)$.
Let $A(n)$ be the sum of the areas of all such triangles.
For example, if $n = 8$, there are two such triangles. Their vertices are $(-4,-3),(-4,3),(8,0)$ and $(4,3),(4,-3),(-8,0)$, and the area of each triangle is $36$. Thus $A(8) = 36 + 36 = 72$.
It can be verified that $A(10) = 252$, $A(100) = 34632$ and $A(1000) = 3529008$.
Find $A(1\,000\,000\,000)$.
1The foci (plural of focus) of an ellipse are two points $A$ and $B$ such that for every point $P$ on the boundary of the ellipse, $AP + PB$ is constant. | For any triangle $T$ in the plane, it can be shown that there is a unique ellipse with largest area that is completely inside $T$.
For a given $n$, consider triangles $T$ such that:
- the vertices of $T$ have integer coordinates with absolute value $\le n$, and
- the foci1 of the largest-area ellipse inside $T$ are $(\sqrt{13},0)$ and $(-\sqrt{13},0)$.
Let $A(n)$ be the sum of the areas of all such triangles.
For example, if $n = 8$, there are two such triangles. Their vertices are $(-4,-3),(-4,3),(8,0)$ and $(4,3),(4,-3),(-8,0)$, and the area of each triangle is $36$. Thus $A(8) = 36 + 36 = 72$.
It can be verified that $A(10) = 252$, $A(100) = 34632$ and $A(1000) = 3529008$.
Find $A(1\,000\,000\,000)$.
1The foci (plural of focus) of an ellipse are two points $A$ and $B$ such that for every point $P$ on the boundary of the ellipse, $AP + PB$ is constant. | <p>
For any triangle $T$ in the plane, it can be shown that there is a unique ellipse with largest area that is completely inside $T$.
</p><p align="center">
<img alt="0385_ellipsetriangle.png" src="resources/images/0385_ellipsetriangle.png?1678992053"/></p>
<p>
For a given $n$, consider triangles $T$ such that:<br/>
- the vertices of $T$ have integer coordinates with absolute value $\le n$, and <br/>
- the <strong>foci</strong><sup>1</sup> of the largest-area ellipse inside $T$ are $(\sqrt{13},0)$ and $(-\sqrt{13},0)$.<br/>
Let $A(n)$ be the sum of the areas of all such triangles.
</p>
<p>
For example, if $n = 8$, there are two such triangles. Their vertices are $(-4,-3),(-4,3),(8,0)$ and $(4,3),(4,-3),(-8,0)$, and the area of each triangle is $36$. Thus $A(8) = 36 + 36 = 72$.
</p>
<p>
It can be verified that $A(10) = 252$, $A(100) = 34632$ and $A(1000) = 3529008$.
</p>
<p>
Find $A(1\,000\,000\,000)$.
</p>
<p>
<span style="font-size:smaller;"><sup>1</sup>The <strong>foci</strong> (plural of <strong>focus</strong>) of an ellipse are two points $A$ and $B$ such that for every point $P$ on the boundary of the ellipse, $AP + PB$ is constant.</span>
</p> | 3776957309612153700 | Sunday, 20th May 2012, 05:00 am | 318 | 70% | hard |
106 | Special Subset Sums: Meta-testing | Let $S(A)$ represent the sum of elements in set $A$ of size $n$. We shall call it a special sum set if for any two non-empty disjoint subsets, $B$ and $C$, the following properties are true:
$S(B) \ne S(C)$; that is, sums of subsets cannot be equal.
If $B$ contains more elements than $C$ then $S(B) \gt S(C)$.
For this problem we shall assume that a given set contains $n$ strictly increasing elements and it already satisfies the second rule.
Surprisingly, out of the $25$ possible subset pairs that can be obtained from a set for which $n = 4$, only $1$ of these pairs need to be tested for equality (first rule). Similarly, when $n = 7$, only $70$ out of the $966$ subset pairs need to be tested.
For $n = 12$, how many of the $261625$ subset pairs that can be obtained need to be tested for equality?
NOTE: This problem is related to Problem 103 and Problem 105. | Let $S(A)$ represent the sum of elements in set $A$ of size $n$. We shall call it a special sum set if for any two non-empty disjoint subsets, $B$ and $C$, the following properties are true:
$S(B) \ne S(C)$; that is, sums of subsets cannot be equal.
If $B$ contains more elements than $C$ then $S(B) \gt S(C)$.
For this problem we shall assume that a given set contains $n$ strictly increasing elements and it already satisfies the second rule.
Surprisingly, out of the $25$ possible subset pairs that can be obtained from a set for which $n = 4$, only $1$ of these pairs need to be tested for equality (first rule). Similarly, when $n = 7$, only $70$ out of the $966$ subset pairs need to be tested.
For $n = 12$, how many of the $261625$ subset pairs that can be obtained need to be tested for equality?
NOTE: This problem is related to Problem 103 and Problem 105. | <p>Let $S(A)$ represent the sum of elements in set $A$ of size $n$. We shall call it a special sum set if for any two non-empty disjoint subsets, $B$ and $C$, the following properties are true:</p>
<ol><li>$S(B) \ne S(C)$; that is, sums of subsets cannot be equal.</li>
<li>If $B$ contains more elements than $C$ then $S(B) \gt S(C)$.</li>
</ol><p>For this problem we shall assume that a given set contains $n$ strictly increasing elements and it already satisfies the second rule.</p>
<p>Surprisingly, out of the $25$ possible subset pairs that can be obtained from a set for which $n = 4$, only $1$ of these pairs need to be tested for equality (first rule). Similarly, when $n = 7$, only $70$ out of the $966$ subset pairs need to be tested.</p>
<p>For $n = 12$, how many of the $261625$ subset pairs that can be obtained need to be tested for equality?</p>
<p class="smaller">NOTE: This problem is related to <a href="problem=103">Problem 103</a> and <a href="problem=105">Problem 105</a>.</p> | 21384 | Friday, 7th October 2005, 06:00 pm | 7291 | 50% | medium |
267 | Billionaire | You are given a unique investment opportunity.
Starting with £1 of capital, you can choose a fixed proportion, f, of your capital to bet on a fair coin toss repeatedly for 1000 tosses.
Your return is double your bet for heads and you lose your bet for tails.
For example, if f = 1/4, for the first toss you bet £0.25, and if heads comes up you win £0.5 and so then have £1.5. You then bet £0.375 and if the second toss is tails, you have £1.125.
Choosing f to maximize your chances of having at least £1,000,000,000 after 1,000 flips, what is the chance that you become a billionaire?
All computations are assumed to be exact (no rounding), but give your answer rounded to 12 digits behind the decimal point in the form 0.abcdefghijkl. | You are given a unique investment opportunity.
Starting with £1 of capital, you can choose a fixed proportion, f, of your capital to bet on a fair coin toss repeatedly for 1000 tosses.
Your return is double your bet for heads and you lose your bet for tails.
For example, if f = 1/4, for the first toss you bet £0.25, and if heads comes up you win £0.5 and so then have £1.5. You then bet £0.375 and if the second toss is tails, you have £1.125.
Choosing f to maximize your chances of having at least £1,000,000,000 after 1,000 flips, what is the chance that you become a billionaire?
All computations are assumed to be exact (no rounding), but give your answer rounded to 12 digits behind the decimal point in the form 0.abcdefghijkl. | <p>You are given a unique investment opportunity.</p>
<p>Starting with £1 of capital, you can choose a fixed proportion, <var>f</var>, of your capital to bet on a fair coin toss repeatedly for 1000 tosses.</p>
<p>Your return is double your bet for heads and you lose your bet for tails.</p>
<p>For example, if <var>f</var> = 1/4, for the first toss you bet £0.25, and if heads comes up you win £0.5 and so then have £1.5. You then bet £0.375 and if the second toss is tails, you have £1.125.</p>
<p>Choosing <var>f</var> to maximize your chances of having at least £1,000,000,000 after 1,000 flips, what is the chance that you become a billionaire?</p>
<p>All computations are assumed to be exact (no rounding), but give your answer rounded to 12 digits behind the decimal point in the form 0.abcdefghijkl.</p> | 0.999992836187 | Friday, 4th December 2009, 01:00 pm | 3736 | 50% | medium |
348 | Sum of a Square and a Cube | Many numbers can be expressed as the sum of a square and a cube. Some of them in more than one way.
Consider the palindromic numbers that can be expressed as the sum of a square and a cube, both greater than $1$, in exactly $4$ different ways.
For example, $5229225$ is a palindromic number and it can be expressed in exactly $4$ different ways:
$2285^2 + 20^3$
$2223^2 + 66^3$
$1810^2 + 125^3$
$1197^2 + 156^3$
Find the sum of the five smallest such palindromic numbers. | Many numbers can be expressed as the sum of a square and a cube. Some of them in more than one way.
Consider the palindromic numbers that can be expressed as the sum of a square and a cube, both greater than $1$, in exactly $4$ different ways.
For example, $5229225$ is a palindromic number and it can be expressed in exactly $4$ different ways:
$2285^2 + 20^3$
$2223^2 + 66^3$
$1810^2 + 125^3$
$1197^2 + 156^3$
Find the sum of the five smallest such palindromic numbers. | <p>Many numbers can be expressed as the sum of a square and a cube. Some of them in more than one way.</p>
<p>Consider the palindromic numbers that can be expressed as the sum of a square and a cube, both greater than $1$, in <b>exactly</b> $4$ different ways.<br/>
For example, $5229225$ is a palindromic number and it can be expressed in exactly $4$ different ways:</p>
<p>$2285^2 + 20^3$<br/>
$2223^2 + 66^3$<br/>
$1810^2 + 125^3$<br/>
$1197^2 + 156^3$</p>
<p>Find the sum of the five smallest such palindromic numbers.</p> | 1004195061 | Saturday, 3rd September 2011, 04:00 pm | 3369 | 25% | easy |
191 | Prize Strings | A particular school offers cash rewards to children with good attendance and punctuality. If they are absent for three consecutive days or late on more than one occasion then they forfeit their prize.
During an n-day period a trinary string is formed for each child consisting of L's (late), O's (on time), and A's (absent).
Although there are eighty-one trinary strings for a 4-day period that can be formed, exactly forty-three strings would lead to a prize:
OOOO OOOA OOOL OOAO OOAA OOAL OOLO OOLA OAOO OAOA
OAOL OAAO OAAL OALO OALA OLOO OLOA OLAO OLAA AOOO
AOOA AOOL AOAO AOAA AOAL AOLO AOLA AAOO AAOA AAOL
AALO AALA ALOO ALOA ALAO ALAA LOOO LOOA LOAO LOAA
LAOO LAOA LAAO
How many "prize" strings exist over a 30-day period? | A particular school offers cash rewards to children with good attendance and punctuality. If they are absent for three consecutive days or late on more than one occasion then they forfeit their prize.
During an n-day period a trinary string is formed for each child consisting of L's (late), O's (on time), and A's (absent).
Although there are eighty-one trinary strings for a 4-day period that can be formed, exactly forty-three strings would lead to a prize:
OOOO OOOA OOOL OOAO OOAA OOAL OOLO OOLA OAOO OAOA
OAOL OAAO OAAL OALO OALA OLOO OLOA OLAO OLAA AOOO
AOOA AOOL AOAO AOAA AOAL AOLO AOLA AAOO AAOA AAOL
AALO AALA ALOO ALOA ALAO ALAA LOOO LOOA LOAO LOAA
LAOO LAOA LAAO
How many "prize" strings exist over a 30-day period? | <p>A particular school offers cash rewards to children with good attendance and punctuality. If they are absent for three consecutive days or late on more than one occasion then they forfeit their prize.</p>
<p>During an n-day period a trinary string is formed for each child consisting of L's (late), O's (on time), and A's (absent).</p>
<p>Although there are eighty-one trinary strings for a 4-day period that can be formed, exactly forty-three strings would lead to a prize:</p>
<p style="margin-left:50px;font-family:'Courier New', monospace;">OOOO OOOA OOOL OOAO OOAA OOAL OOLO OOLA OAOO OAOA<br>
OAOL OAAO OAAL OALO OALA OLOO OLOA OLAO OLAA AOOO<br/>
AOOA AOOL AOAO AOAA AOAL AOLO AOLA AAOO AAOA AAOL<br/>
AALO AALA ALOO ALOA ALAO ALAA LOOO LOOA LOAO LOAA<br/>
LAOO LAOA LAAO</br></p>
<p>How many "prize" strings exist over a 30-day period?</p> | 1918080160 | Saturday, 26th April 2008, 01:00 am | 7785 | 35% | medium |
795 | Alternating GCD Sum | For a positive integer $n$, the function $g(n)$ is defined as
$$\displaystyle g(n)=\sum_{i=1}^{n} (-1)^i \gcd \left(n,i^2\right)$$
For example, $g(4) = -\gcd \left(4,1^2\right) + \gcd \left(4,2^2\right) - \gcd \left(4,3^2\right) + \gcd \left(4,4^2\right) = -1+4-1+4=6$.
You are also given $g(1234)=1233$.
Let $\displaystyle G(N) = \sum_{n=1}^N g(n)$. You are given $G(1234) = 2194708$.
Find $G(12345678)$. | For a positive integer $n$, the function $g(n)$ is defined as
$$\displaystyle g(n)=\sum_{i=1}^{n} (-1)^i \gcd \left(n,i^2\right)$$
For example, $g(4) = -\gcd \left(4,1^2\right) + \gcd \left(4,2^2\right) - \gcd \left(4,3^2\right) + \gcd \left(4,4^2\right) = -1+4-1+4=6$.
You are also given $g(1234)=1233$.
Let $\displaystyle G(N) = \sum_{n=1}^N g(n)$. You are given $G(1234) = 2194708$.
Find $G(12345678)$. | <p>
For a positive integer $n$, the function $g(n)$ is defined as
</p>
$$\displaystyle g(n)=\sum_{i=1}^{n} (-1)^i \gcd \left(n,i^2\right)$$
<p>
For example, $g(4) = -\gcd \left(4,1^2\right) + \gcd \left(4,2^2\right) - \gcd \left(4,3^2\right) + \gcd \left(4,4^2\right) = -1+4-1+4=6$.<br>
You are also given $g(1234)=1233$.
</br></p>
<p>
Let $\displaystyle G(N) = \sum_{n=1}^N g(n)$. You are given $G(1234) = 2194708$.
</p>
<p>
Find $G(12345678)$.
</p> | 955892601606483 | Saturday, 23rd April 2022, 02:00 pm | 391 | 30% | easy |
778 | Freshman's Product | If $a,b$ are two nonnegative integers with decimal representations $a=(\dots a_2a_1a_0)$ and $b=(\dots b_2b_1b_0)$ respectively, then the freshman's product of $a$ and $b$, denoted $a\boxtimes b$, is the integer $c$ with decimal representation $c=(\dots c_2c_1c_0)$ such that $c_i$ is the last digit of $a_i\cdot b_i$.
For example, $234 \boxtimes 765 = 480$.
Let $F(R,M)$ be the sum of $x_1 \boxtimes \dots \boxtimes x_R$ for all sequences of integers $(x_1,\dots,x_R)$ with $0\leq x_i \leq M$.
For example, $F(2, 7) = 204$, and $F(23, 76) \equiv 5870548 \pmod{ 1\,000\,000\,009}$.
Find $F(234567,765432)$, give your answer modulo $1\,000\,000\,009$. | If $a,b$ are two nonnegative integers with decimal representations $a=(\dots a_2a_1a_0)$ and $b=(\dots b_2b_1b_0)$ respectively, then the freshman's product of $a$ and $b$, denoted $a\boxtimes b$, is the integer $c$ with decimal representation $c=(\dots c_2c_1c_0)$ such that $c_i$ is the last digit of $a_i\cdot b_i$.
For example, $234 \boxtimes 765 = 480$.
Let $F(R,M)$ be the sum of $x_1 \boxtimes \dots \boxtimes x_R$ for all sequences of integers $(x_1,\dots,x_R)$ with $0\leq x_i \leq M$.
For example, $F(2, 7) = 204$, and $F(23, 76) \equiv 5870548 \pmod{ 1\,000\,000\,009}$.
Find $F(234567,765432)$, give your answer modulo $1\,000\,000\,009$. | <p>
If $a,b$ are two nonnegative integers with decimal representations $a=(\dots a_2a_1a_0)$ and $b=(\dots b_2b_1b_0)$ respectively, then the <i>freshman's product</i> of $a$ and $b$, denoted $a\boxtimes b$, is the integer $c$ with decimal representation $c=(\dots c_2c_1c_0)$ such that $c_i$ is the last digit of $a_i\cdot b_i$.<br/>
For example, $234 \boxtimes 765 = 480$.
</p>
<p>
Let $F(R,M)$ be the sum of $x_1 \boxtimes \dots \boxtimes x_R$ for all sequences of integers $(x_1,\dots,x_R)$ with $0\leq x_i \leq M$.<br/>
For example, $F(2, 7) = 204$, and $F(23, 76) \equiv 5870548 \pmod{ 1\,000\,000\,009}$.
</p>
<p>
Find $F(234567,765432)$, give your answer modulo $1\,000\,000\,009$.
</p> | 146133880 | Sunday, 26th December 2021, 10:00 am | 451 | 30% | easy |
40 | Champernowne's Constant | An irrational decimal fraction is created by concatenating the positive integers:
$$0.12345678910{\color{red}\mathbf 1}112131415161718192021\cdots$$
It can be seen that the $12$th digit of the fractional part is $1$.
If $d_n$ represents the $n$th digit of the fractional part, find the value of the following expression.
$$d_1 \times d_{10} \times d_{100} \times d_{1000} \times d_{10000} \times d_{100000} \times d_{1000000}$$ | An irrational decimal fraction is created by concatenating the positive integers:
$$0.12345678910{\color{red}\mathbf 1}112131415161718192021\cdots$$
It can be seen that the $12$th digit of the fractional part is $1$.
If $d_n$ represents the $n$th digit of the fractional part, find the value of the following expression.
$$d_1 \times d_{10} \times d_{100} \times d_{1000} \times d_{10000} \times d_{100000} \times d_{1000000}$$ | <p>An irrational decimal fraction is created by concatenating the positive integers:
$$0.12345678910{\color{red}\mathbf 1}112131415161718192021\cdots$$</p>
<p>It can be seen that the $12$<sup>th</sup> digit of the fractional part is $1$.</p>
<p>If $d_n$ represents the $n$<sup>th</sup> digit of the fractional part, find the value of the following expression.
$$d_1 \times d_{10} \times d_{100} \times d_{1000} \times d_{10000} \times d_{100000} \times d_{1000000}$$</p> | 210 | Friday, 28th March 2003, 06:00 pm | 87104 | 5% | easy |
340 | Crazy Function | For fixed integers $a, b, c$, define the crazy function $F(n)$ as follows:
$F(n) = n - c$ for all $n \gt b$
$F(n) = F(a + F(a + F(a + F(a + n))))$ for all $n \le b$.
Also, define $S(a, b, c) = \sum \limits_{n = 0}^b F(n)$.
For example, if $a = 50$, $b = 2000$ and $c = 40$, then $F(0) = 3240$ and $F(2000) = 2040$.
Also, $S(50, 2000, 40) = 5204240$.
Find the last $9$ digits of $S(21^7, 7^{21}, 12^7)$. | For fixed integers $a, b, c$, define the crazy function $F(n)$ as follows:
$F(n) = n - c$ for all $n \gt b$
$F(n) = F(a + F(a + F(a + F(a + n))))$ for all $n \le b$.
Also, define $S(a, b, c) = \sum \limits_{n = 0}^b F(n)$.
For example, if $a = 50$, $b = 2000$ and $c = 40$, then $F(0) = 3240$ and $F(2000) = 2040$.
Also, $S(50, 2000, 40) = 5204240$.
Find the last $9$ digits of $S(21^7, 7^{21}, 12^7)$. | <p>
For fixed integers $a, b, c$, define the <dfn>crazy function</dfn> $F(n)$ as follows:<br/>
$F(n) = n - c$ for all $n \gt b$<br/>
$F(n) = F(a + F(a + F(a + F(a + n))))$ for all $n \le b$.
</p>
<p>Also, define $S(a, b, c) = \sum \limits_{n = 0}^b F(n)$.</p>
<p>
For example, if $a = 50$, $b = 2000$ and $c = 40$, then $F(0) = 3240$ and $F(2000) = 2040$.<br/>
Also, $S(50, 2000, 40) = 5204240$.
</p>
<p>
Find the last $9$ digits of $S(21^7, 7^{21}, 12^7)$.
</p> | 291504964 | Sunday, 29th May 2011, 07:00 am | 1239 | 30% | easy |
189 | Tri-colouring a Triangular Grid | Consider the following configuration of $64$ triangles:
We wish to colour the interior of each triangle with one of three colours: red, green or blue, so that no two neighbouring triangles have the same colour. Such a colouring shall be called valid. Here, two triangles are said to be neighbouring if they share an edge.
Note: if they only share a vertex, then they are not neighbours.
For example, here is a valid colouring of the above grid:
A colouring $C^\prime$ which is obtained from a colouring $C$ by rotation or reflection is considered distinct from $C$ unless the two are identical.
How many distinct valid colourings are there for the above configuration? | Consider the following configuration of $64$ triangles:
We wish to colour the interior of each triangle with one of three colours: red, green or blue, so that no two neighbouring triangles have the same colour. Such a colouring shall be called valid. Here, two triangles are said to be neighbouring if they share an edge.
Note: if they only share a vertex, then they are not neighbours.
For example, here is a valid colouring of the above grid:
A colouring $C^\prime$ which is obtained from a colouring $C$ by rotation or reflection is considered distinct from $C$ unless the two are identical.
How many distinct valid colourings are there for the above configuration? | <p>Consider the following configuration of $64$ triangles:</p>
<div class="center"><img alt="" class="dark_img" src="resources/images/0189_grid.gif?1678992055"/></div>
<p>We wish to colour the interior of each triangle with one of three colours: red, green or blue, so that no two neighbouring triangles have the same colour. Such a colouring shall be called valid. Here, two triangles are said to be neighbouring if they share an edge.<br/>
Note: if they only share a vertex, then they are not neighbours.</p>
<p>For example, here is a valid colouring of the above grid:</p>
<div class="center"><img alt="" class="dark_img" src="resources/images/0189_colours.gif?1678992055"/></div>
<p>A colouring $C^\prime$ which is obtained from a colouring $C$ by rotation or reflection is considered <i>distinct</i> from $C$ unless the two are identical.</p>
<p>How many distinct valid colourings are there for the above configuration?</p> | 10834893628237824 | Friday, 11th April 2008, 05:00 pm | 2332 | 70% | hard |
404 | Crisscross Ellipses | $E_a$ is an ellipse with an equation of the form $x^2 + 4y^2 = 4a^2$.
$E_a^\prime$ is the rotated image of $E_a$ by $\theta$ degrees counterclockwise around the origin $O(0, 0)$ for $0^\circ \lt \theta \lt 90^\circ$.
$b$ is the distance to the origin of the two intersection points closest to the origin and $c$ is the distance of the two other intersection points.
We call an ordered triplet $(a, b, c)$ a canonical ellipsoidal triplet if $a, b$ and $c$ are positive integers.
For example, $(209, 247, 286)$ is a canonical ellipsoidal triplet.
Let $C(N)$ be the number of distinct canonical ellipsoidal triplets $(a, b, c)$ for $a \leq N$.
It can be verified that $C(10^3) = 7$, $C(10^4) = 106$ and $C(10^6) = 11845$.
Find $C(10^{17})$. | $E_a$ is an ellipse with an equation of the form $x^2 + 4y^2 = 4a^2$.
$E_a^\prime$ is the rotated image of $E_a$ by $\theta$ degrees counterclockwise around the origin $O(0, 0)$ for $0^\circ \lt \theta \lt 90^\circ$.
$b$ is the distance to the origin of the two intersection points closest to the origin and $c$ is the distance of the two other intersection points.
We call an ordered triplet $(a, b, c)$ a canonical ellipsoidal triplet if $a, b$ and $c$ are positive integers.
For example, $(209, 247, 286)$ is a canonical ellipsoidal triplet.
Let $C(N)$ be the number of distinct canonical ellipsoidal triplets $(a, b, c)$ for $a \leq N$.
It can be verified that $C(10^3) = 7$, $C(10^4) = 106$ and $C(10^6) = 11845$.
Find $C(10^{17})$. | <p>
$E_a$ is an ellipse with an equation of the form $x^2 + 4y^2 = 4a^2$.<br/>
$E_a^\prime$ is the rotated image of $E_a$ by $\theta$ degrees counterclockwise around the origin $O(0, 0)$ for $0^\circ \lt \theta \lt 90^\circ$.
</p>
<div align="center">
<img alt="0404_c_ellipse.gif" src="resources/images/0404_c_ellipse.gif?1678992056"/></div>
<p>
$b$ is the distance to the origin of the two intersection points closest to the origin and $c$ is the distance of the two other intersection points.<br/>
We call an ordered triplet $(a, b, c)$ a <dfn>canonical ellipsoidal triplet</dfn> if $a, b$ and $c$ are positive integers.<br/>
For example, $(209, 247, 286)$ is a canonical ellipsoidal triplet.
</p>
<p>
Let $C(N)$ be the number of distinct canonical ellipsoidal triplets $(a, b, c)$ for $a \leq N$.<br/>
It can be verified that $C(10^3) = 7$, $C(10^4) = 106$ and $C(10^6) = 11845$.
</p>
<p>
Find $C(10^{17})$.
</p> | 1199215615081353 | Sunday, 2nd December 2012, 01:00 am | 359 | 60% | hard |
526 | Largest Prime Factors of Consecutive Numbers | Let $f(n)$ be the largest prime factor of $n$.
Let $g(n) = f(n) + f(n + 1) + f(n + 2) + f(n + 3) + f(n + 4) + f(n + 5) + f(n + 6) + f(n + 7) + f(n + 8)$, the sum of the largest prime factor of each of nine consecutive numbers starting with $n$.
Let $h(n)$ be the maximum value of $g(k)$ for $2 \le k \le n$.
You are given:
$f(100) = 5$
$f(101) = 101$
$g(100) = 409$
$h(100) = 417$
$h(10^9) = 4896292593$
Find $h(10^{16})$. | Let $f(n)$ be the largest prime factor of $n$.
Let $g(n) = f(n) + f(n + 1) + f(n + 2) + f(n + 3) + f(n + 4) + f(n + 5) + f(n + 6) + f(n + 7) + f(n + 8)$, the sum of the largest prime factor of each of nine consecutive numbers starting with $n$.
Let $h(n)$ be the maximum value of $g(k)$ for $2 \le k \le n$.
You are given:
$f(100) = 5$
$f(101) = 101$
$g(100) = 409$
$h(100) = 417$
$h(10^9) = 4896292593$
Find $h(10^{16})$. | <p>Let $f(n)$ be the largest prime factor of $n$.</p>
<p>Let $g(n) = f(n) + f(n + 1) + f(n + 2) + f(n + 3) + f(n + 4) + f(n + 5) + f(n + 6) + f(n + 7) + f(n + 8)$, the sum of the largest prime factor of each of nine consecutive numbers starting with $n$.</p>
<p>Let $h(n)$ be the maximum value of $g(k)$ for $2 \le k \le n$.</p>
<p>You are given:</p>
<ul><li>$f(100) = 5$</li>
<li>$f(101) = 101$</li>
<li>$g(100) = 409$</li>
<li>$h(100) = 417$</li>
<li>$h(10^9) = 4896292593$</li></ul>
<p>Find $h(10^{16})$.</p> | 49601160286750947 | Saturday, 19th September 2015, 01:00 pm | 348 | 60% | hard |
190 | Maximising a Weighted Product | Let $S_m = (x_1, x_2, \dots , x_m)$ be the $m$-tuple of positive real numbers with $x_1 + x_2 + \cdots + x_m = m$ for which $P_m = x_1 \cdot x_2^2 \cdot \cdots \cdot x_m^m$ is maximised.
For example, it can be verified that $\lfloor P_{10}\rfloor = 4112$ ($\lfloor \, \rfloor$ is the integer part function).
Find $\sum\limits_{m = 2}^{15} \lfloor P_m \rfloor$. | Let $S_m = (x_1, x_2, \dots , x_m)$ be the $m$-tuple of positive real numbers with $x_1 + x_2 + \cdots + x_m = m$ for which $P_m = x_1 \cdot x_2^2 \cdot \cdots \cdot x_m^m$ is maximised.
For example, it can be verified that $\lfloor P_{10}\rfloor = 4112$ ($\lfloor \, \rfloor$ is the integer part function).
Find $\sum\limits_{m = 2}^{15} \lfloor P_m \rfloor$. | <p>Let $S_m = (x_1, x_2, \dots , x_m)$ be the $m$-tuple of positive real numbers with $x_1 + x_2 + \cdots + x_m = m$ for which $P_m = x_1 \cdot x_2^2 \cdot \cdots \cdot x_m^m$ is maximised.</p>
<p>For example, it can be verified that $\lfloor P_{10}\rfloor = 4112$ ($\lfloor \, \rfloor$ is the integer part function).</p>
<p>Find $\sum\limits_{m = 2}^{15} \lfloor P_m \rfloor$.</p> | 371048281 | Friday, 18th April 2008, 10:00 pm | 4583 | 50% | medium |
88 | Product-sum Numbers | A natural number, $N$, that can be written as the sum and product of a given set of at least two natural numbers, $\{a_1, a_2, \dots, a_k\}$ is called a product-sum number: $N = a_1 + a_2 + \cdots + a_k = a_1 \times a_2 \times \cdots \times a_k$.
For example, $6 = 1 + 2 + 3 = 1 \times 2 \times 3$.
For a given set of size, $k$, we shall call the smallest $N$ with this property a minimal product-sum number. The minimal product-sum numbers for sets of size, $k = 2, 3, 4, 5$, and $6$ are as follows.
$k=2$: $4 = 2 \times 2 = 2 + 2$
$k=3$: $6 = 1 \times 2 \times 3 = 1 + 2 + 3$
$k=4$: $8 = 1 \times 1 \times 2 \times 4 = 1 + 1 + 2 + 4$
$k=5$: $8 = 1 \times 1 \times 2 \times 2 \times 2 = 1 + 1 + 2 + 2 + 2$$k=6$: $12 = 1 \times 1 \times 1 \times 1 \times 2 \times 6 = 1 + 1 + 1 + 1 + 2 + 6$
Hence for $2 \le k \le 6$, the sum of all the minimal product-sum numbers is $4+6+8+12 = 30$; note that $8$ is only counted once in the sum.
In fact, as the complete set of minimal product-sum numbers for $2 \le k \le 12$ is $\{4, 6, 8, 12, 15, 16\}$, the sum is $61$.
What is the sum of all the minimal product-sum numbers for $2 \le k \le 12000$? | A natural number, $N$, that can be written as the sum and product of a given set of at least two natural numbers, $\{a_1, a_2, \dots, a_k\}$ is called a product-sum number: $N = a_1 + a_2 + \cdots + a_k = a_1 \times a_2 \times \cdots \times a_k$.
For example, $6 = 1 + 2 + 3 = 1 \times 2 \times 3$.
For a given set of size, $k$, we shall call the smallest $N$ with this property a minimal product-sum number. The minimal product-sum numbers for sets of size, $k = 2, 3, 4, 5$, and $6$ are as follows.
$k=2$: $4 = 2 \times 2 = 2 + 2$
$k=3$: $6 = 1 \times 2 \times 3 = 1 + 2 + 3$
$k=4$: $8 = 1 \times 1 \times 2 \times 4 = 1 + 1 + 2 + 4$
$k=5$: $8 = 1 \times 1 \times 2 \times 2 \times 2 = 1 + 1 + 2 + 2 + 2$$k=6$: $12 = 1 \times 1 \times 1 \times 1 \times 2 \times 6 = 1 + 1 + 1 + 1 + 2 + 6$
Hence for $2 \le k \le 6$, the sum of all the minimal product-sum numbers is $4+6+8+12 = 30$; note that $8$ is only counted once in the sum.
In fact, as the complete set of minimal product-sum numbers for $2 \le k \le 12$ is $\{4, 6, 8, 12, 15, 16\}$, the sum is $61$.
What is the sum of all the minimal product-sum numbers for $2 \le k \le 12000$? | <p>A natural number, $N$, that can be written as the sum and product of a given set of at least two natural numbers, $\{a_1, a_2, \dots, a_k\}$ is called a product-sum number: $N = a_1 + a_2 + \cdots + a_k = a_1 \times a_2 \times \cdots \times a_k$.</p>
<p>For example, $6 = 1 + 2 + 3 = 1 \times 2 \times 3$.</p>
<p>For a given set of size, $k$, we shall call the smallest $N$ with this property a minimal product-sum number. The minimal product-sum numbers for sets of size, $k = 2, 3, 4, 5$, and $6$ are as follows.</p>
<ul style="list-style-type:none;">
<li>$k=2$: $4 = 2 \times 2 = 2 + 2$</li>
<li>$k=3$: $6 = 1 \times 2 \times 3 = 1 + 2 + 3$</li>
<li>$k=4$: $8 = 1 \times 1 \times 2 \times 4 = 1 + 1 + 2 + 4$</li>
<li>$k=5$: $8 = 1 \times 1 \times 2 \times 2 \times 2 = 1 + 1 + 2 + 2 + 2$</li><li>$k=6$: $12 = 1 \times 1 \times 1 \times 1 \times 2 \times 6 = 1 + 1 + 1 + 1 + 2 + 6$</li></ul>
<p>Hence for $2 \le k \le 6$, the sum of all the minimal product-sum numbers is $4+6+8+12 = 30$; note that $8$ is only counted once in the sum.</p>
<p>In fact, as the complete set of minimal product-sum numbers for $2 \le k \le 12$ is $\{4, 6, 8, 12, 15, 16\}$, the sum is $61$.</p>
<p>What is the sum of all the minimal product-sum numbers for $2 \le k \le 12000$?</p> | 7587457 | Friday, 4th February 2005, 06:00 pm | 11591 | 40% | medium |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.