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 |
---|---|---|---|---|---|---|---|---|---|
344 | Silver Dollar Game | One variant of N.G. de Bruijn's silver dollar game can be described as follows:
On a strip of squares a number of coins are placed, at most one coin per square. Only one coin, called the silver dollar, has any value. Two players take turns making moves. At each turn a player must make either a regular or a special move.
A regular move consists of selecting one coin and moving it one or more squares to the left. The coin cannot move out of the strip or jump on or over another coin.
Alternatively, the player can choose to make the special move of pocketing the leftmost coin rather than making a regular move. If no regular moves are possible, the player is forced to pocket the leftmost coin.
The winner is the player who pockets the silver dollar.
A winning configuration is an arrangement of coins on the strip where the first player can force a win no matter what the second player does.
Let $W(n,c)$ be the number of winning configurations for a strip of $n$ squares, $c$ worthless coins and one silver dollar.
You are given that $W(10,2) = 324$ and $W(100,10) = 1514704946113500$.
Find $W(1\,000\,000, 100)$ modulo the semiprime $1000\,036\,000\,099$ ($= 1\,000\,003 \cdot 1\,000\,033$). | One variant of N.G. de Bruijn's silver dollar game can be described as follows:
On a strip of squares a number of coins are placed, at most one coin per square. Only one coin, called the silver dollar, has any value. Two players take turns making moves. At each turn a player must make either a regular or a special move.
A regular move consists of selecting one coin and moving it one or more squares to the left. The coin cannot move out of the strip or jump on or over another coin.
Alternatively, the player can choose to make the special move of pocketing the leftmost coin rather than making a regular move. If no regular moves are possible, the player is forced to pocket the leftmost coin.
The winner is the player who pockets the silver dollar.
A winning configuration is an arrangement of coins on the strip where the first player can force a win no matter what the second player does.
Let $W(n,c)$ be the number of winning configurations for a strip of $n$ squares, $c$ worthless coins and one silver dollar.
You are given that $W(10,2) = 324$ and $W(100,10) = 1514704946113500$.
Find $W(1\,000\,000, 100)$ modulo the semiprime $1000\,036\,000\,099$ ($= 1\,000\,003 \cdot 1\,000\,033$). | <p>One variant of N.G. de Bruijn's <strong>silver dollar</strong> game can be described as follows:</p>
<p>On a strip of squares a number of coins are placed, at most one coin per square. Only one coin, called the <strong>silver dollar</strong>, has any value. Two players take turns making moves. At each turn a player must make either a <dfn>regular</dfn> or a <dfn>special</dfn> move.</p>
<p>A <dfn>regular</dfn> move consists of selecting one coin and moving it one or more squares to the left. The coin cannot move out of the strip or jump on or over another coin.</p>
<p>Alternatively, the player can choose to make the <dfn>special</dfn> move of pocketing the leftmost coin rather than making a regular move. If no regular moves are possible, the player is forced to pocket the leftmost coin.</p>
<p>The winner is the player who pockets the silver dollar.</p>
<div align="center">
<img alt="0344_silverdollar.gif" src="resources/images/0344_silverdollar.gif?1678992056"/><br/></div>
<p>A <dfn>winning configuration</dfn> is an arrangement of coins on the strip where the first player can force a win no matter what the second player does.</p>
<p>Let $W(n,c)$ be the number of winning configurations for a strip of $n$ squares, $c$ worthless coins and one silver dollar.</p>
<p>You are given that $W(10,2) = 324$ and $W(100,10) = 1514704946113500$.</p>
<p>Find $W(1\,000\,000, 100)$ modulo the semiprime $1000\,036\,000\,099$ ($= 1\,000\,003 \cdot 1\,000\,033$).
</p> | 65579304332 | Saturday, 25th June 2011, 07:00 pm | 374 | 100% | hard |
179 | Consecutive Positive Divisors | Find the number of integers $1 \lt n \lt 10^7$, for which $n$ and $n + 1$ have the same number of positive divisors. For example, $14$ has the positive divisors $1, 2, 7, 14$ while $15$ has $1, 3, 5, 15$. | Find the number of integers $1 \lt n \lt 10^7$, for which $n$ and $n + 1$ have the same number of positive divisors. For example, $14$ has the positive divisors $1, 2, 7, 14$ while $15$ has $1, 3, 5, 15$. | <p>Find the number of integers $1 \lt n \lt 10^7$, for which $n$ and $n + 1$ have the same number of positive divisors. For example, $14$ has the positive divisors $1, 2, 7, 14$ while $15$ has $1, 3, 5, 15$.</p> | 986262 | Saturday, 26th January 2008, 05:00 am | 12240 | 25% | easy |
728 | Circle of Coins | Consider $n$ coins arranged in a circle where each coin shows heads or tails. A move consists of turning over $k$ consecutive coins: tail-head or head-tail. Using a sequence of these moves the objective is to get all the coins showing heads.
Consider the example, shown below, where $n=8$ and $k=3$ and the initial state is one coin showing tails (black). The example shows a solution for this state.
For given values of $n$ and $k$ not all states are solvable. Let $F(n,k)$ be the number of states that are solvable. You are given that $F(3,2) = 4$, $F(8,3) = 256$ and $F(9,3) = 128$.
Further define:
$$S(N) = \sum_{n=1}^N\sum_{k=1}^n F(n,k).$$
You are also given that $S(3) = 22$, $S(10) = 10444$ and $S(10^3) \equiv 853837042 \pmod{1\,000\,000\,007}$
Find $S(10^7)$. Give your answer modulo $1\,000\,000\,007$. | Consider $n$ coins arranged in a circle where each coin shows heads or tails. A move consists of turning over $k$ consecutive coins: tail-head or head-tail. Using a sequence of these moves the objective is to get all the coins showing heads.
Consider the example, shown below, where $n=8$ and $k=3$ and the initial state is one coin showing tails (black). The example shows a solution for this state.
For given values of $n$ and $k$ not all states are solvable. Let $F(n,k)$ be the number of states that are solvable. You are given that $F(3,2) = 4$, $F(8,3) = 256$ and $F(9,3) = 128$.
Further define:
$$S(N) = \sum_{n=1}^N\sum_{k=1}^n F(n,k).$$
You are also given that $S(3) = 22$, $S(10) = 10444$ and $S(10^3) \equiv 853837042 \pmod{1\,000\,000\,007}$
Find $S(10^7)$. Give your answer modulo $1\,000\,000\,007$. | <p>Consider $n$ coins arranged in a circle where each coin shows heads or tails. A move consists of turning over $k$ consecutive coins: tail-head or head-tail. Using a sequence of these moves the objective is to get all the coins showing heads.</p>
<p>Consider the example, shown below, where $n=8$ and $k=3$ and the initial state is one coin showing tails (black). The example shows a solution for this state.</p>
<div class="center">
<img alt="" class="dark_img" src="resources/images/0728_coin_circle.jpg?1678992055"/></div>
<p>For given values of $n$ and $k$ not all states are solvable. Let $F(n,k)$ be the number of states that are solvable. You are given that $F(3,2) = 4$, $F(8,3) = 256$ and $F(9,3) = 128$.</p>
<p>Further define:
$$S(N) = \sum_{n=1}^N\sum_{k=1}^n F(n,k).$$</p>
<p>You are also given that $S(3) = 22$, $S(10) = 10444$ and $S(10^3) \equiv 853837042 \pmod{1\,000\,000\,007}$</p>
<p>Find $S(10^7)$. Give your answer modulo $1\,000\,000\,007$.</p> | 709874991 | Sunday, 4th October 2020, 02:00 am | 305 | 40% | medium |
274 | Divisibility Multipliers | For each integer $p \gt 1$ coprime to $10$ there is a positive divisibility multiplier $m \lt p$ which preserves divisibility by $p$ for the following function on any positive integer, $n$:
$f(n) = (\text{all but the last digit of }n) + (\text{the last digit of }n) \cdot m$.
That is, if $m$ is the divisibility multiplier for $p$, then $f(n)$ is divisible by $p$ if and only if $n$ is divisible by $p$.
(When $n$ is much larger than $p$, $f(n)$ will be less than $n$ and repeated application of $f$ provides a multiplicative divisibility test for $p$.)
For example, the divisibility multiplier for $113$ is $34$.
$f(76275) = 7627 + 5 \cdot 34 = 7797$: $76275$ and $7797$ are both divisible by $113$.$f(12345) = 1234 + 5 \cdot 34 = 1404$: $12345$ and $1404$ are both not divisible by $113$.
The sum of the divisibility multipliers for the primes that are coprime to $10$ and less than $1000$ is $39517$. What is the sum of the divisibility multipliers for the primes that are coprime to $10$ and less than $10^7$? | For each integer $p \gt 1$ coprime to $10$ there is a positive divisibility multiplier $m \lt p$ which preserves divisibility by $p$ for the following function on any positive integer, $n$:
$f(n) = (\text{all but the last digit of }n) + (\text{the last digit of }n) \cdot m$.
That is, if $m$ is the divisibility multiplier for $p$, then $f(n)$ is divisible by $p$ if and only if $n$ is divisible by $p$.
(When $n$ is much larger than $p$, $f(n)$ will be less than $n$ and repeated application of $f$ provides a multiplicative divisibility test for $p$.)
For example, the divisibility multiplier for $113$ is $34$.
$f(76275) = 7627 + 5 \cdot 34 = 7797$: $76275$ and $7797$ are both divisible by $113$.$f(12345) = 1234 + 5 \cdot 34 = 1404$: $12345$ and $1404$ are both not divisible by $113$.
The sum of the divisibility multipliers for the primes that are coprime to $10$ and less than $1000$ is $39517$. What is the sum of the divisibility multipliers for the primes that are coprime to $10$ and less than $10^7$? | <p>For each integer $p \gt 1$ coprime to $10$ there is a positive <dfn>divisibility multiplier</dfn> $m \lt p$ which preserves divisibility by $p$ for the following function on any positive integer, $n$:</p>
<p>$f(n) = (\text{all but the last digit of }n) + (\text{the last digit of }n) \cdot m$.</p>
<p>That is, if $m$ is the divisibility multiplier for $p$, then $f(n)$ is divisible by $p$ if and only if $n$ is divisible by $p$.</p>
<p>(When $n$ is much larger than $p$, $f(n)$ will be less than $n$ and repeated application of $f$ provides a multiplicative divisibility test for $p$.)</p>
<p>For example, the divisibility multiplier for $113$ is $34$.</p>
<p>$f(76275) = 7627 + 5 \cdot 34 = 7797$: $76275$ and $7797$ are both divisible by $113$.<br/>$f(12345) = 1234 + 5 \cdot 34 = 1404$: $12345$ and $1404$ are both not divisible by $113$.</p>
<p>The sum of the divisibility multipliers for the primes that are coprime to $10$ and less than $1000$ is $39517$. What is the sum of the divisibility multipliers for the primes that are coprime to $10$ and less than $10^7$?</p> | 1601912348822 | Friday, 15th January 2010, 01:00 pm | 1568 | 65% | hard |
619 | Square Subsets | For a set of positive integers $\{a, a+1, a+2, \dots , b\}$, let $C(a,b)$ be the number of non-empty subsets in which the product of all elements is a perfect square.
For example $C(5,10)=3$, since the products of all elements of $\{5, 8, 10\}$, $\{5, 8, 9, 10\}$ and $\{9\}$ are perfect squares, and no other subsets of $\{5, 6, 7, 8, 9, 10\}$ have this property.
You are given that $C(40,55) =15$, and $C(1000,1234) \bmod 1000000007=975523611$.
Find $C(1000000,1234567) \bmod 1000000007$. | For a set of positive integers $\{a, a+1, a+2, \dots , b\}$, let $C(a,b)$ be the number of non-empty subsets in which the product of all elements is a perfect square.
For example $C(5,10)=3$, since the products of all elements of $\{5, 8, 10\}$, $\{5, 8, 9, 10\}$ and $\{9\}$ are perfect squares, and no other subsets of $\{5, 6, 7, 8, 9, 10\}$ have this property.
You are given that $C(40,55) =15$, and $C(1000,1234) \bmod 1000000007=975523611$.
Find $C(1000000,1234567) \bmod 1000000007$. | <p>For a set of positive integers $\{a, a+1, a+2, \dots , b\}$, let $C(a,b)$ be the number of non-empty subsets in which the product of all elements is a perfect square.</p>
<p>For example $C(5,10)=3$, since the products of all elements of $\{5, 8, 10\}$, $\{5, 8, 9, 10\}$ and $\{9\}$ are perfect squares, and no other subsets of $\{5, 6, 7, 8, 9, 10\}$ have this property.</p>
<p>You are given that $C(40,55) =15$, and $C(1000,1234) \bmod 1000000007=975523611$.</p>
<p>Find $C(1000000,1234567) \bmod 1000000007$.</p> | 857810883 | Saturday, 27th January 2018, 10:00 pm | 445 | 45% | medium |
911 | Khinchin Exceptions | An irrational number $x$ can be uniquely expressed as a continued fraction $[a_0; a_1,a_2,a_3,\dots]$:
$$
x=a_{0}+\cfrac{1}{a_1+\cfrac{1}{a_2+\cfrac{1}{a_3+{_\ddots}}}}
$$where $a_0$ is an integer and $a_1,a_2,a_3,\dots$ are positive integers.
Define $k_j(x)$ to be the geometric mean of $a_1,a_2,\dots,a_j$. That is, $k_j(x)=(a_1a_2 \cdots a_j)^{1/j}$. Also define $k_\infty(x)=\lim_{j\to \infty} k_j(x)$.
Khinchin proved that almost all irrational numbers $x$ have the same value of $k_\infty(x)\approx2.685452\dots$ known as Khinchin's constant. However, there are some exceptions to this rule.
For $n\geq 0$ define
$$\rho_n = \sum_{i=0}^{\infty} \frac{2^n}{2^{2^i}}
$$For example $\rho_2$, with continued fraction beginning $[3; 3, 1, 3, 4, 3, 1, 3,\dots]$, has $k_\infty(\rho_2)\approx2.059767$.
Find the geometric mean of $k_{\infty}(\rho_n)$ for $0\leq n\leq 50$, giving your answer rounded to six digits after the decimal point. | An irrational number $x$ can be uniquely expressed as a continued fraction $[a_0; a_1,a_2,a_3,\dots]$:
$$
x=a_{0}+\cfrac{1}{a_1+\cfrac{1}{a_2+\cfrac{1}{a_3+{_\ddots}}}}
$$where $a_0$ is an integer and $a_1,a_2,a_3,\dots$ are positive integers.
Define $k_j(x)$ to be the geometric mean of $a_1,a_2,\dots,a_j$. That is, $k_j(x)=(a_1a_2 \cdots a_j)^{1/j}$. Also define $k_\infty(x)=\lim_{j\to \infty} k_j(x)$.
Khinchin proved that almost all irrational numbers $x$ have the same value of $k_\infty(x)\approx2.685452\dots$ known as Khinchin's constant. However, there are some exceptions to this rule.
For $n\geq 0$ define
$$\rho_n = \sum_{i=0}^{\infty} \frac{2^n}{2^{2^i}}
$$For example $\rho_2$, with continued fraction beginning $[3; 3, 1, 3, 4, 3, 1, 3,\dots]$, has $k_\infty(\rho_2)\approx2.059767$.
Find the geometric mean of $k_{\infty}(\rho_n)$ for $0\leq n\leq 50$, giving your answer rounded to six digits after the decimal point. | <p>
An irrational number $x$ can be uniquely expressed as a <b>continued fraction</b> $[a_0; a_1,a_2,a_3,\dots]$:
$$
x=a_{0}+\cfrac{1}{a_1+\cfrac{1}{a_2+\cfrac{1}{a_3+{_\ddots}}}}
$$where $a_0$ is an integer and $a_1,a_2,a_3,\dots$ are positive integers.
</p>
<p>
Define $k_j(x)$ to be the <b>geometric mean</b> of $a_1,a_2,\dots,a_j$.<br/> That is, $k_j(x)=(a_1a_2 \cdots a_j)^{1/j}$.<br/> Also define $k_\infty(x)=\lim_{j\to \infty} k_j(x)$.
</p>
<p>
Khinchin proved that <b>almost all</b> irrational numbers $x$ have the same value of $k_\infty(x)\approx2.685452\dots$ known as <b>Khinchin's constant</b>. However, there are some exceptions to this rule.
</p>
<p>
For $n\geq 0$ define
$$\rho_n = \sum_{i=0}^{\infty} \frac{2^n}{2^{2^i}}
$$For example $\rho_2$, with continued fraction beginning $[3; 3, 1, 3, 4, 3, 1, 3,\dots]$, has $k_\infty(\rho_2)\approx2.059767$.
</p>
<p>
Find the geometric mean of $k_{\infty}(\rho_n)$ for $0\leq n\leq 50$, giving your answer rounded to six digits after the decimal point.
</p> | 5679.934966 | Sunday, 6th October 2024, 08:00 am | 172 | 50% | medium |
909 | L-expressions I | An L-expression is defined as any one of the following:
a natural number;
the symbol $A$;
the symbol $Z$;
the symbol $S$;
a pair of L-expressions $u, v$, which is written as $u(v)$.
An L-expression can be transformed according to the following rules:
$A(x) \to x + 1$ for any natural number $x$;
$Z(u)(v) \to v$ for any L-expressions $u, v$;
$S(u)(v)(w) \to v(u(v)(w))$ for any L-expressions $u, v, w$.
For example, after applying all possible rules, the L-expression $S(Z)(A)(0)$ is transformed to the number $1$:
$$S(Z)(A)(0) \to A(Z(A)(0)) \to A(0) \to 1.$$
Similarly, the L-expression $S(S)(S(S))(S(Z))(A)(0)$ is transformed to the number $6$ after applying all possible rules.
Find the result of the L-expression $S(S)(S(S))(S(S))(S(Z))(A)(0)$ after applying all possible rules. Give the last nine digits as your answer.
Note: it can be proved that the L-expression in question can only be transformed a finite number of times, and the final result does not depend on the order of the transformations. | An L-expression is defined as any one of the following:
a natural number;
the symbol $A$;
the symbol $Z$;
the symbol $S$;
a pair of L-expressions $u, v$, which is written as $u(v)$.
An L-expression can be transformed according to the following rules:
$A(x) \to x + 1$ for any natural number $x$;
$Z(u)(v) \to v$ for any L-expressions $u, v$;
$S(u)(v)(w) \to v(u(v)(w))$ for any L-expressions $u, v, w$.
For example, after applying all possible rules, the L-expression $S(Z)(A)(0)$ is transformed to the number $1$:
$$S(Z)(A)(0) \to A(Z(A)(0)) \to A(0) \to 1.$$
Similarly, the L-expression $S(S)(S(S))(S(Z))(A)(0)$ is transformed to the number $6$ after applying all possible rules.
Find the result of the L-expression $S(S)(S(S))(S(S))(S(Z))(A)(0)$ after applying all possible rules. Give the last nine digits as your answer.
Note: it can be proved that the L-expression in question can only be transformed a finite number of times, and the final result does not depend on the order of the transformations. | <p>
An <dfn>L-expression</dfn> is defined as any one of the following:</p>
<ul>
<li>a natural number;</li>
<li>the symbol $A$;</li>
<li>the symbol $Z$;</li>
<li>the symbol $S$;</li>
<li>a pair of L-expressions $u, v$, which is written as $u(v)$.</li>
</ul>
<p>
An L-expression can be transformed according to the following rules:</p>
<ul>
<li>$A(x) \to x + 1$ for any natural number $x$;</li>
<li>$Z(u)(v) \to v$ for any L-expressions $u, v$;</li>
<li>$S(u)(v)(w) \to v(u(v)(w))$ for any L-expressions $u, v, w$.</li>
</ul>
<p>
For example, after applying all possible rules, the L-expression $S(Z)(A)(0)$ is transformed to the number $1$:
$$S(Z)(A)(0) \to A(Z(A)(0)) \to A(0) \to 1.$$
Similarly, the L-expression $S(S)(S(S))(S(Z))(A)(0)$ is transformed to the number $6$ after applying all possible rules.</p>
<p>
Find the result of the L-expression $S(S)(S(S))(S(S))(S(Z))(A)(0)$ after applying all possible rules. Give the last nine digits as your answer.</p>
<p class="note"><b>Note:</b> it can be proved that the L-expression in question can only be transformed a finite number of times, and the final result does not depend on the order of the transformations.</p> | 399885292 | Sunday, 29th September 2024, 05:00 am | 150 | 70% | hard |
230 | Fibonacci Words | For any two strings of digits, $A$ and $B$, we define $F_{A, B}$ to be the sequence $(A,B,AB,BAB,ABBAB,\dots)$ in which each term is the concatenation of the previous two.
Further, we define $D_{A, B}(n)$ to be the $n$th digit in the first term of $F_{A, B}$ that contains at least $n$ digits.
Example:
Let $A=1415926535$, $B=8979323846$. We wish to find $D_{A, B}(35)$, say.
The first few terms of $F_{A, B}$ are:
$1415926535$
$8979323846$
$14159265358979323846$
$897932384614159265358979323846$
$1415926535897932384689793238461415{\color{red}\mathbf 9}265358979323846$
Then $D_{A, B}(35)$ is the $35$th digit in the fifth term, which is $9$.
Now we use for $A$ the first $100$ digits of $\pi$ behind the decimal point:
$14159265358979323846264338327950288419716939937510$
$58209749445923078164062862089986280348253421170679$
and for $B$ the next hundred digits:
$82148086513282306647093844609550582231725359408128$
$48111745028410270193852110555964462294895493038196$.
Find $\sum_{n = 0}^{17} 10^n \times D_{A,B}((127+19n) \times 7^n)$. | For any two strings of digits, $A$ and $B$, we define $F_{A, B}$ to be the sequence $(A,B,AB,BAB,ABBAB,\dots)$ in which each term is the concatenation of the previous two.
Further, we define $D_{A, B}(n)$ to be the $n$th digit in the first term of $F_{A, B}$ that contains at least $n$ digits.
Example:
Let $A=1415926535$, $B=8979323846$. We wish to find $D_{A, B}(35)$, say.
The first few terms of $F_{A, B}$ are:
$1415926535$
$8979323846$
$14159265358979323846$
$897932384614159265358979323846$
$1415926535897932384689793238461415{\color{red}\mathbf 9}265358979323846$
Then $D_{A, B}(35)$ is the $35$th digit in the fifth term, which is $9$.
Now we use for $A$ the first $100$ digits of $\pi$ behind the decimal point:
$14159265358979323846264338327950288419716939937510$
$58209749445923078164062862089986280348253421170679$
and for $B$ the next hundred digits:
$82148086513282306647093844609550582231725359408128$
$48111745028410270193852110555964462294895493038196$.
Find $\sum_{n = 0}^{17} 10^n \times D_{A,B}((127+19n) \times 7^n)$. | <p>For any two strings of digits, $A$ and $B$, we define $F_{A, B}$ to be the sequence $(A,B,AB,BAB,ABBAB,\dots)$ in which each term is the concatenation of the previous two.</p>
<p>Further, we define $D_{A, B}(n)$ to be the $n$<sup>th</sup> digit in the first term of $F_{A, B}$ that contains at least $n$ digits.</p>
<p>Example:</p>
<p>Let $A=1415926535$, $B=8979323846$. We wish to find $D_{A, B}(35)$, say.</p>
<p>The first few terms of $F_{A, B}$ are:<br/>
$1415926535$<br/>
$8979323846$<br/>
$14159265358979323846$<br/>
$897932384614159265358979323846$<br/>
$1415926535897932384689793238461415{\color{red}\mathbf 9}265358979323846$<br/></p>
<p>Then $D_{A, B}(35)$ is the $35$<sup>th</sup> digit in the fifth term, which is $9$.</p>
<p>Now we use for $A$ the first $100$ digits of $\pi$ behind the decimal point:</p>
<p>$14159265358979323846264338327950288419716939937510$<br/>
$58209749445923078164062862089986280348253421170679$</p>
<p>and for $B$ the next hundred digits:</p>
<p>$82148086513282306647093844609550582231725359408128$<br/>
$48111745028410270193852110555964462294895493038196$.</p>
<p>Find $\sum_{n = 0}^{17} 10^n \times D_{A,B}((127+19n) \times 7^n)$.</p> | 850481152593119296 | Saturday, 31st January 2009, 01:00 pm | 3131 | 50% | medium |
354 | Distances in a Bee's Honeycomb | Consider a honey bee's honeycomb where each cell is a perfect regular hexagon with side length $1$.
One particular cell is occupied by the queen bee.
For a positive real number $L$, let $\text{B}(L)$ count the cells with distance $L$ from the queen bee cell (all distances are measured from centre to centre); you may assume that the honeycomb is large enough to accommodate for any distance we wish to consider.
For example, $\text{B}(\sqrt 3)=6$, $\text{B}(\sqrt {21}) = 12$ and $\text{B}(111\,111\,111) = 54$.
Find the number of $L \le 5 \times 10^{11}$ such that $\text{B}(L) = 450$. | Consider a honey bee's honeycomb where each cell is a perfect regular hexagon with side length $1$.
One particular cell is occupied by the queen bee.
For a positive real number $L$, let $\text{B}(L)$ count the cells with distance $L$ from the queen bee cell (all distances are measured from centre to centre); you may assume that the honeycomb is large enough to accommodate for any distance we wish to consider.
For example, $\text{B}(\sqrt 3)=6$, $\text{B}(\sqrt {21}) = 12$ and $\text{B}(111\,111\,111) = 54$.
Find the number of $L \le 5 \times 10^{11}$ such that $\text{B}(L) = 450$. | <p>Consider a honey bee's honeycomb where each cell is a perfect regular hexagon with side length $1$.</p>
<div align="center">
<img alt="p354_bee_honeycomb.png" src="project/images/p354_bee_honeycomb.png"/></div>
<p>
One particular cell is occupied by the queen bee.<br>
For a positive real number $L$, let $\text{B}(L)$ count the cells with distance $L$ from the queen bee cell (all distances are measured from centre to centre); you may assume that the honeycomb is large enough to accommodate for any distance we wish to consider. <br/>
For example, $\text{B}(\sqrt 3)=6$, $\text{B}(\sqrt {21}) = 12$ and $\text{B}(111\,111\,111) = 54$.</br></p>
<p>Find the number of $L \le 5 \times 10^{11}$ such that $\text{B}(L) = 450$.</p> | 58065134 | Sunday, 16th October 2011, 07:00 am | 499 | 65% | hard |
627 | Counting Products | Consider the set $S$ of all possible products of $n$ positive integers not exceeding $m$, that is
$S=\{ x_1x_2\cdots x_n \mid 1 \le x_1, x_2, \dots, x_n \le m \}$.
Let $F(m,n)$ be the number of the distinct elements of the set $S$.
For example, $F(9, 2) = 36$ and $F(30,2)=308$.
Find $F(30, 10001) \bmod 1\,000\,000\,007$. | Consider the set $S$ of all possible products of $n$ positive integers not exceeding $m$, that is
$S=\{ x_1x_2\cdots x_n \mid 1 \le x_1, x_2, \dots, x_n \le m \}$.
Let $F(m,n)$ be the number of the distinct elements of the set $S$.
For example, $F(9, 2) = 36$ and $F(30,2)=308$.
Find $F(30, 10001) \bmod 1\,000\,000\,007$. | <p>Consider the set $S$ of all possible products of $n$ positive integers not exceeding $m$, that is<br/>
$S=\{ x_1x_2\cdots x_n \mid 1 \le x_1, x_2, \dots, x_n \le m \}$.<br/>
Let $F(m,n)$ be the number of the distinct elements of the set $S$.<br/>
For example, $F(9, 2) = 36$ and $F(30,2)=308$.</p>
<p>Find $F(30, 10001) \bmod 1\,000\,000\,007$.</p> | 220196142 | Saturday, 19th May 2018, 10:00 pm | 260 | 60% | hard |
893 | Matchsticks | Define $M(n)$ to be the minimum number of matchsticks needed to represent the number $n$.
A number can be represented in digit form or as an expression involving addition and/or multiplication. Also order of operations must be followed, that is multiplication binding tighter than addition. Any other symbols or operations, such as brackets, subtraction, division or exponentiation, are not allowed.
The valid digits and symbols are shown below:
For example, $28$ needs $12$ matchsticks to represent it in digit form but representing it as $4\times 7$ would only need $9$ matchsticks and as there is no way using fewer matchsticks $M(28) = 9$.
Define $\displaystyle T(N) = \sum_{n=1}^N M(n)$. You are given $T(100) = 916$.
Find $T(10^6)$. | Define $M(n)$ to be the minimum number of matchsticks needed to represent the number $n$.
A number can be represented in digit form or as an expression involving addition and/or multiplication. Also order of operations must be followed, that is multiplication binding tighter than addition. Any other symbols or operations, such as brackets, subtraction, division or exponentiation, are not allowed.
The valid digits and symbols are shown below:
For example, $28$ needs $12$ matchsticks to represent it in digit form but representing it as $4\times 7$ would only need $9$ matchsticks and as there is no way using fewer matchsticks $M(28) = 9$.
Define $\displaystyle T(N) = \sum_{n=1}^N M(n)$. You are given $T(100) = 916$.
Find $T(10^6)$. | <p>
Define $M(n)$ to be the minimum number of matchsticks needed to represent the number $n$.</p>
<p>
A number can be represented in digit form or as an expression involving addition and/or multiplication. Also order of operations must be followed, that is multiplication binding tighter than addition. Any other symbols or operations, such as brackets, subtraction, division or exponentiation, are not allowed.</p>
<p>
The valid digits and symbols are shown below:</p>
<div style="text-align:center;">
<img alt="0893_DigitDiagram.jpg" height="433" src="resources/images/0893_DigitDiagram.jpg?1714876316" width="668"/></div>
<p>
For example, $28$ needs $12$ matchsticks to represent it in digit form but representing it as $4\times 7$ would only need $9$ matchsticks and as there is no way using fewer matchsticks $M(28) = 9$.</p>
<p>
Define $\displaystyle T(N) = \sum_{n=1}^N M(n)$. You are given $T(100) = 916$.</p>
<p>
Find $T(10^6)$.</p> | 26688208 | Sunday, 2nd June 2024, 11:00 am | 609 | 15% | easy |
799 | Pentagonal Puzzle | Pentagonal numbers are generated by the formula: $P_n = \tfrac 12n(3n-1)$ giving the sequence:
$$1,5,12,22,35, 51,70,92,\ldots $$
Some pentagonal numbers can be expressed as the sum of two other pentagonal numbers.
For example:
$$P_8 = 92 = 22 + 70 = P_4 + P_7$$
3577 is the smallest pentagonal number that can be expressed as the sum of two pentagonal numbers in two different ways
$$
\begin{align}
P_{49} = 3577 & = 3432 + 145 = P_{48} + P_{10} \\
& = 3290 + 287 = P_{47}+P_{14}
\end{align}
$$
107602 is the smallest pentagonal number that can be expressed as the sum of two pentagonal numbers in three different ways.
Find the smallest pentagonal number that can be expressed as the sum of two pentagonal numbers in over 100 different ways. | Pentagonal numbers are generated by the formula: $P_n = \tfrac 12n(3n-1)$ giving the sequence:
$$1,5,12,22,35, 51,70,92,\ldots $$
Some pentagonal numbers can be expressed as the sum of two other pentagonal numbers.
For example:
$$P_8 = 92 = 22 + 70 = P_4 + P_7$$
3577 is the smallest pentagonal number that can be expressed as the sum of two pentagonal numbers in two different ways
$$
\begin{align}
P_{49} = 3577 & = 3432 + 145 = P_{48} + P_{10} \\
& = 3290 + 287 = P_{47}+P_{14}
\end{align}
$$
107602 is the smallest pentagonal number that can be expressed as the sum of two pentagonal numbers in three different ways.
Find the smallest pentagonal number that can be expressed as the sum of two pentagonal numbers in over 100 different ways. | <p>
Pentagonal numbers are generated by the formula: $P_n = \tfrac 12n(3n-1)$ giving the sequence:
</p>
$$1,5,12,22,35, 51,70,92,\ldots $$
<p>
Some pentagonal numbers can be expressed as the sum of two other pentagonal numbers.<br>
For example:
</br></p>
$$P_8 = 92 = 22 + 70 = P_4 + P_7$$
<p>
3577 is the smallest pentagonal number that can be expressed as the sum of two pentagonal numbers in two different ways
</p>
$$
\begin{align}
P_{49} = 3577 & = 3432 + 145 = P_{48} + P_{10} \\
& = 3290 + 287 = P_{47}+P_{14}
\end{align}
$$
<p>
107602 is the smallest pentagonal number that can be expressed as the sum of two pentagonal numbers in three different ways.
</p>
<p>
Find the smallest pentagonal number that can be expressed as the sum of two pentagonal numbers in over 100 different ways.
</p> | 1096910149053902 | Sunday, 22nd May 2022, 02:00 am | 248 | 50% | medium |
85 | Counting Rectangles | By counting carefully it can be seen that a rectangular grid measuring $3$ by $2$ contains eighteen rectangles:
Although there exists no rectangular grid that contains exactly two million rectangles, find the area of the grid with the nearest solution. | By counting carefully it can be seen that a rectangular grid measuring $3$ by $2$ contains eighteen rectangles:
Although there exists no rectangular grid that contains exactly two million rectangles, find the area of the grid with the nearest solution. | <p>By counting carefully it can be seen that a rectangular grid measuring $3$ by $2$ contains eighteen rectangles:</p>
<div class="center">
<img alt="" class="dark_img" src="resources/images/0085.png?1678992052"/></div>
<p>Although there exists no rectangular grid that contains exactly two million rectangles, find the area of the grid with the nearest solution.</p> | 2772 | Friday, 17th December 2004, 06:00 pm | 27355 | 15% | easy |
609 | $\pi$ Sequences | For every $n \ge 1$ the prime-counting function $\pi(n)$ is equal to the number of primes
not exceeding $n$.
E.g. $\pi(6)=3$ and $\pi(100)=25$.
We say that a sequence of integers $u = (u_0,\cdots,u_m)$ is a $\pi$ sequence if
$u_n \ge 1$ for every $n$
$u_{n+1}= \pi(u_n)$
$u$ has two or more elements
For $u_0=10$ there are three distinct $\pi$ sequences: $(10,4)$, $(10,4,2)$ and $(10,4,2,1)$.
Let $c(u)$ be the number of elements of $u$ that are not prime.
Let $p(n,k)$ be the number of $\pi$ sequences $u$ for which $u_0\le n$ and $c(u)=k$.
Let $P(n)$ be the product of all $p(n,k)$ that are larger than $0$.
You are given: $P(10)=3 \times 8 \times 9 \times 3=648$ and $P(100)=31038676032$.
Find $P(10^8)$. Give your answer modulo $1000000007$. | For every $n \ge 1$ the prime-counting function $\pi(n)$ is equal to the number of primes
not exceeding $n$.
E.g. $\pi(6)=3$ and $\pi(100)=25$.
We say that a sequence of integers $u = (u_0,\cdots,u_m)$ is a $\pi$ sequence if
$u_n \ge 1$ for every $n$
$u_{n+1}= \pi(u_n)$
$u$ has two or more elements
For $u_0=10$ there are three distinct $\pi$ sequences: $(10,4)$, $(10,4,2)$ and $(10,4,2,1)$.
Let $c(u)$ be the number of elements of $u$ that are not prime.
Let $p(n,k)$ be the number of $\pi$ sequences $u$ for which $u_0\le n$ and $c(u)=k$.
Let $P(n)$ be the product of all $p(n,k)$ that are larger than $0$.
You are given: $P(10)=3 \times 8 \times 9 \times 3=648$ and $P(100)=31038676032$.
Find $P(10^8)$. Give your answer modulo $1000000007$. | <p>
For every $n \ge 1$ the <strong>prime-counting</strong> function $\pi(n)$ is equal to the number of primes
not exceeding $n$.<br/>
E.g. $\pi(6)=3$ and $\pi(100)=25$.
</p>
<p>
We say that a sequence of integers $u = (u_0,\cdots,u_m)$ is a <dfn>$\pi$ sequence</dfn> if
</p><ul>
<li> $u_n \ge 1$ for every $n$
</li><li> $u_{n+1}= \pi(u_n)$
</li><li> $u$ has two or more elements
</li></ul>
<p>
For $u_0=10$ there are three distinct $\pi$ sequences: $(10,4)$, $(10,4,2)$ and $(10,4,2,1)$.
</p>
<p>
Let $c(u)$ be the number of elements of $u$ that are not prime.<br/>
Let $p(n,k)$ be the number of $\pi$ sequences $u$ for which $u_0\le n$ and $c(u)=k$.<br/>
Let $P(n)$ be the product of all $p(n,k)$ that are larger than $0$.<br/>
You are given: $P(10)=3 \times 8 \times 9 \times 3=648$ and $P(100)=31038676032$.
</p>
<p>
Find $P(10^8)$. Give your answer modulo $1000000007$.
</p> | 172023848 | Saturday, 9th September 2017, 04:00 pm | 1033 | 20% | easy |
697 | Randomly Decaying Sequence | Given a fixed real number $c$, define a random sequence $(X_n)_{n\ge 0}$ by the following random process:
$X_0 = c$ (with probability 1).
For $n>0$, $X_n = U_n X_{n-1}$ where $U_n$ is a real number chosen at random between zero and one, uniformly, and independently of all previous choices $(U_m)_{m<n}$.
If we desire there to be precisely a 25% probability that $X_{100}<1$, then this can be arranged by fixing $c$ such that $\log_{10} c \approx 46.27$.
Suppose now that $c$ is set to a different value, so that there is precisely a 25% probability that $X_{10\,000\,000}<1$.
Find $\log_{10} c$ and give your answer rounded to two places after the decimal point. | Given a fixed real number $c$, define a random sequence $(X_n)_{n\ge 0}$ by the following random process:
$X_0 = c$ (with probability 1).
For $n>0$, $X_n = U_n X_{n-1}$ where $U_n$ is a real number chosen at random between zero and one, uniformly, and independently of all previous choices $(U_m)_{m<n}$.
If we desire there to be precisely a 25% probability that $X_{100}<1$, then this can be arranged by fixing $c$ such that $\log_{10} c \approx 46.27$.
Suppose now that $c$ is set to a different value, so that there is precisely a 25% probability that $X_{10\,000\,000}<1$.
Find $\log_{10} c$ and give your answer rounded to two places after the decimal point. | <p>Given a fixed real number $c$, define a random sequence $(X_n)_{n\ge 0}$ by the following random process:</p>
<ul><li>$X_0 = c$ (with probability 1).</li>
<li>For $n>0$, $X_n = U_n X_{n-1}$ where $U_n$ is a real number chosen at random between zero and one, uniformly, and independently of all previous choices $(U_m)_{m<n}$.</li>
</ul><p>If we desire there to be precisely a 25% probability that $X_{100}<1$, then this can be arranged by fixing $c$ such that $\log_{10} c \approx 46.27$.</p>
<p>Suppose now that $c$ is set to a different value, so that there is precisely a 25% probability that $X_{10\,000\,000}<1$.</p>
<p>Find $\log_{10} c$ and give your answer rounded to two places after the decimal point.</p> | 4343871.06 | Sunday, 12th January 2020, 04:00 am | 639 | 30% | easy |
462 | Permutation of 3-smooth Numbers | A $3$-smooth number is an integer which has no prime factor larger than $3$. For an integer $N$, we define $S(N)$ as the set of $3$-smooth numbers less than or equal to $N$. For example, $S(20) = \{ 1, 2, 3, 4, 6, 8, 9, 12, 16, 18 \}$.
We define $F(N)$ as the number of permutations of $S(N)$ in which each element comes after all of its proper divisors.
This is one of the possible permutations for $N = 20$.
- $1, 2, 4, 3, 9, 8, 16, 6, 18, 12.$
This is not a valid permutation because $12$ comes before its divisor $6$.
- $1, 2, 4, 3, 9, 8, \boldsymbol{12}, 16, \boldsymbol 6, 18$.
We can verify that $F(6) = 5$, $F(8) = 9$, $F(20) = 450$ and $F(1000) \approx 8.8521816557\mathrm e21$.
Find $F(10^{18})$. Give as your answer its scientific notation rounded to ten digits after the decimal point.
When giving your answer, use a lowercase e to separate mantissa and exponent. E.g. if the answer is $112\,233\,445\,566\,778\,899$ then the answer format would be 1.1223344557e17. | A $3$-smooth number is an integer which has no prime factor larger than $3$. For an integer $N$, we define $S(N)$ as the set of $3$-smooth numbers less than or equal to $N$. For example, $S(20) = \{ 1, 2, 3, 4, 6, 8, 9, 12, 16, 18 \}$.
We define $F(N)$ as the number of permutations of $S(N)$ in which each element comes after all of its proper divisors.
This is one of the possible permutations for $N = 20$.
- $1, 2, 4, 3, 9, 8, 16, 6, 18, 12.$
This is not a valid permutation because $12$ comes before its divisor $6$.
- $1, 2, 4, 3, 9, 8, \boldsymbol{12}, 16, \boldsymbol 6, 18$.
We can verify that $F(6) = 5$, $F(8) = 9$, $F(20) = 450$ and $F(1000) \approx 8.8521816557\mathrm e21$.
Find $F(10^{18})$. Give as your answer its scientific notation rounded to ten digits after the decimal point.
When giving your answer, use a lowercase e to separate mantissa and exponent. E.g. if the answer is $112\,233\,445\,566\,778\,899$ then the answer format would be 1.1223344557e17. | <p>
A <strong>$3$-smooth number</strong> is an integer which has no prime factor larger than $3$. For an integer $N$, we define $S(N)$ as the set of <span style="white-space:nowrap;">$3$-smooth</span> numbers less than or equal to $N$. For example, $S(20) = \{ 1, 2, 3, 4, 6, 8, 9, 12, 16, 18 \}$.
</p>
<p>
We define $F(N)$ as the number of permutations of $S(N)$ in which each element comes after all of its proper divisors.
</p>
<p>
This is one of the possible permutations for $N = 20$.<br/>
- $1, 2, 4, 3, 9, 8, 16, 6, 18, 12.$<br/>
This is not a valid permutation because $12$ comes before its divisor $6$.<br/>
- $1, 2, 4, 3, 9, 8, \boldsymbol{12}, 16, \boldsymbol 6, 18$.
</p>
<p>
We can verify that $F(6) = 5$, $F(8) = 9$, $F(20) = 450$ and $F(1000) \approx 8.8521816557\mathrm e21$.<br/>
Find $F(10^{18})$. Give as your answer its scientific notation rounded to ten digits after the decimal point.<br/>
When giving your answer, use a lowercase e to separate mantissa and exponent. E.g. if the answer is $112\,233\,445\,566\,778\,899$ then the answer format would be 1.1223344557e17.
</p> | 5.5350769703e1512 | Saturday, 8th March 2014, 07:00 pm | 360 | 60% | hard |
80 | Square Root Digital Expansion | It is well known that if the square root of a natural number is not an integer, then it is irrational. The decimal expansion of such square roots is infinite without any repeating pattern at all.
The square root of two is $1.41421356237309504880\cdots$, and the digital sum of the first one hundred decimal digits is $475$.
For the first one hundred natural numbers, find the total of the digital sums of the first one hundred decimal digits for all the irrational square roots. | It is well known that if the square root of a natural number is not an integer, then it is irrational. The decimal expansion of such square roots is infinite without any repeating pattern at all.
The square root of two is $1.41421356237309504880\cdots$, and the digital sum of the first one hundred decimal digits is $475$.
For the first one hundred natural numbers, find the total of the digital sums of the first one hundred decimal digits for all the irrational square roots. | <p>It is well known that if the square root of a natural number is not an integer, then it is irrational. The decimal expansion of such square roots is infinite without any repeating pattern at all.</p>
<p>The square root of two is $1.41421356237309504880\cdots$, and the digital sum of the first one hundred decimal digits is $475$.</p>
<p>For the first one hundred natural numbers, find the total of the digital sums of the first one hundred decimal digits for all the irrational square roots.</p> | 40886 | Friday, 8th October 2004, 06:00 pm | 22158 | 20% | easy |
374 | Maximum Integer Partition Product | An integer partition of a number $n$ is a way of writing $n$ as a sum of positive integers.
Partitions that differ only in the order of their summands are considered the same.
A partition of $n$ into distinct parts is a partition of $n$ in which every part occurs at most once.
The partitions of $5$ into distinct parts are:
$5$, $4+1$ and $3+2$.
Let $f(n)$ be the maximum product of the parts of any such partition of $n$ into distinct parts and let $m(n)$ be the number of elements of any such partition of $n$ with that product.
So $f(5)=6$ and $m(5)=2$.
For $n=10$ the partition with the largest product is $10=2+3+5$, which gives $f(10)=30$ and $m(10)=3$.
And their product, $f(10) \cdot m(10) = 30 \cdot 3 = 90$.
It can be verified that
$\sum f(n) \cdot m(n)$ for $1 \le n \le 100 = 1683550844462$.
Find $\sum f(n) \cdot m(n)$ for $1 \le n \le 10^{14}$.
Give your answer modulo $982451653$, the $50$ millionth prime. | An integer partition of a number $n$ is a way of writing $n$ as a sum of positive integers.
Partitions that differ only in the order of their summands are considered the same.
A partition of $n$ into distinct parts is a partition of $n$ in which every part occurs at most once.
The partitions of $5$ into distinct parts are:
$5$, $4+1$ and $3+2$.
Let $f(n)$ be the maximum product of the parts of any such partition of $n$ into distinct parts and let $m(n)$ be the number of elements of any such partition of $n$ with that product.
So $f(5)=6$ and $m(5)=2$.
For $n=10$ the partition with the largest product is $10=2+3+5$, which gives $f(10)=30$ and $m(10)=3$.
And their product, $f(10) \cdot m(10) = 30 \cdot 3 = 90$.
It can be verified that
$\sum f(n) \cdot m(n)$ for $1 \le n \le 100 = 1683550844462$.
Find $\sum f(n) \cdot m(n)$ for $1 \le n \le 10^{14}$.
Give your answer modulo $982451653$, the $50$ millionth prime. | <p>An integer partition of a number $n$ is a way of writing $n$ as a sum of positive integers.</p>
<p>Partitions that differ only in the order of their summands are considered the same.
A partition of $n$ into <b>distinct parts</b> is a partition of $n$ in which every part occurs at most once.</p>
<p>The partitions of $5$ into distinct parts are:
<br/>$5$, $4+1$ and $3+2$.</p>
<p>Let $f(n)$ be the maximum product of the parts of any such partition of $n$ into distinct parts and let $m(n)$ be the number of elements of any such partition of $n$ with that product.</p>
<p>So $f(5)=6$ and $m(5)=2$.</p>
<p>For $n=10$ the partition with the largest product is $10=2+3+5$, which gives $f(10)=30$ and $m(10)=3$.
<br/>And their product, $f(10) \cdot m(10) = 30 \cdot 3 = 90$.</p>
<p>It can be verified that
<br/>$\sum f(n) \cdot m(n)$ for $1 \le n \le 100 = 1683550844462$.</p>
<p>Find $\sum f(n) \cdot m(n)$ for $1 \le n \le 10^{14}$.
<br/>Give your answer modulo $982451653$, the $50$ millionth prime.</p> | 334420941 | Saturday, 3rd March 2012, 07:00 pm | 757 | 40% | medium |
589 | Poohsticks Marathon | Christopher Robin and Pooh Bear love the game of Poohsticks so much that they invented a new version which allows them to play for longer before one of them wins and they have to go home for tea. The game starts as normal with both dropping a stick simultaneously on the upstream side of a bridge. But rather than the game ending when one of the sticks emerges on the downstream side, instead they fish their sticks out of the water, and drop them back in again on the upstream side. The game only ends when one of the sticks emerges from under the bridge ahead of the other one having also 'lapped' the other stick - that is, having made one additional journey under the bridge compared to the other stick.
On a particular day when playing this game, the time taken for a stick to travel under the bridge varies between a minimum of 30 seconds, and a maximum of 60 seconds. The time taken to fish a stick out of the water and drop it back in again on the other side is 5 seconds. The current under the bridge has the unusual property that the sticks' journey time is always an integral number of seconds, and it is equally likely to emerge at any of the possible times between 30 and 60 seconds (inclusive). It turns out that under these circumstances, the expected time for playing a single game is 1036.15 seconds (rounded to 2 decimal places). This time is measured from the point of dropping the sticks for the first time, to the point where the winning stick emerges from under the bridge having lapped the other.
The stream flows at different rates each day, but maintains the property that the journey time in seconds is equally distributed amongst the integers from a minimum, $n$, to a maximum, $m$, inclusive. Let the expected time of play in seconds be $E(m,n)$. Hence $E(60,30)=1036.15...$
Let $S(k)=\sum_{m=2}^k\sum_{n=1}^{m-1}E(m,n)$.
For example $S(5)=7722.82$ rounded to 2 decimal places.
Find $S(100)$ and give your answer rounded to 2 decimal places. | Christopher Robin and Pooh Bear love the game of Poohsticks so much that they invented a new version which allows them to play for longer before one of them wins and they have to go home for tea. The game starts as normal with both dropping a stick simultaneously on the upstream side of a bridge. But rather than the game ending when one of the sticks emerges on the downstream side, instead they fish their sticks out of the water, and drop them back in again on the upstream side. The game only ends when one of the sticks emerges from under the bridge ahead of the other one having also 'lapped' the other stick - that is, having made one additional journey under the bridge compared to the other stick.
On a particular day when playing this game, the time taken for a stick to travel under the bridge varies between a minimum of 30 seconds, and a maximum of 60 seconds. The time taken to fish a stick out of the water and drop it back in again on the other side is 5 seconds. The current under the bridge has the unusual property that the sticks' journey time is always an integral number of seconds, and it is equally likely to emerge at any of the possible times between 30 and 60 seconds (inclusive). It turns out that under these circumstances, the expected time for playing a single game is 1036.15 seconds (rounded to 2 decimal places). This time is measured from the point of dropping the sticks for the first time, to the point where the winning stick emerges from under the bridge having lapped the other.
The stream flows at different rates each day, but maintains the property that the journey time in seconds is equally distributed amongst the integers from a minimum, $n$, to a maximum, $m$, inclusive. Let the expected time of play in seconds be $E(m,n)$. Hence $E(60,30)=1036.15...$
Let $S(k)=\sum_{m=2}^k\sum_{n=1}^{m-1}E(m,n)$.
For example $S(5)=7722.82$ rounded to 2 decimal places.
Find $S(100)$ and give your answer rounded to 2 decimal places. | <p>
Christopher Robin and Pooh Bear love the game of Poohsticks so much that they invented a new version which allows them to play for longer before one of them wins and they have to go home for tea. The game starts as normal with both dropping a stick simultaneously on the upstream side of a bridge. But rather than the game ending when one of the sticks emerges on the downstream side, instead they fish their sticks out of the water, and drop them back in again on the upstream side. The game only ends when one of the sticks emerges from under the bridge ahead of the other one having also 'lapped' the other stick - that is, having made one additional journey under the bridge compared to the other stick.
</p>
<p>
On a particular day when playing this game, the time taken for a stick to travel under the bridge varies between a minimum of 30 seconds, and a maximum of 60 seconds. The time taken to fish a stick out of the water and drop it back in again on the other side is 5 seconds. The current under the bridge has the unusual property that the sticks' journey time is always an integral number of seconds, and it is equally likely to emerge at any of the possible times between 30 and 60 seconds (inclusive). It turns out that under these circumstances, the expected time for playing a single game is 1036.15 seconds (rounded to 2 decimal places). This time is measured from the point of dropping the sticks for the first time, to the point where the winning stick emerges from under the bridge having lapped the other.
</p>
<p>
The stream flows at different rates each day, but maintains the property that the journey time in seconds is equally distributed amongst the integers from a minimum, $n$, to a maximum, $m$, inclusive. Let the expected time of play in seconds be $E(m,n)$. Hence $E(60,30)=1036.15...$
</p>
<p>
Let $S(k)=\sum_{m=2}^k\sum_{n=1}^{m-1}E(m,n)$.
</p>
<p>
For example $S(5)=7722.82$ rounded to 2 decimal places.
</p>
<p>
Find $S(100)$ and give your answer rounded to 2 decimal places.
</p> | 131776959.25 | Sunday, 5th February 2017, 07:00 am | 227 | 95% | hard |
48 | Self Powers | The series, $1^1 + 2^2 + 3^3 + \cdots + 10^{10} = 10405071317$.
Find the last ten digits of the series, $1^1 + 2^2 + 3^3 + \cdots + 1000^{1000}$. | The series, $1^1 + 2^2 + 3^3 + \cdots + 10^{10} = 10405071317$.
Find the last ten digits of the series, $1^1 + 2^2 + 3^3 + \cdots + 1000^{1000}$. | <p>The series, $1^1 + 2^2 + 3^3 + \cdots + 10^{10} = 10405071317$.</p>
<p>Find the last ten digits of the series, $1^1 + 2^2 + 3^3 + \cdots + 1000^{1000}$.</p> | 9110846700 | Friday, 18th July 2003, 06:00 pm | 120934 | 5% | easy |
164 | Three Consecutive Digital Sum Limit | How many $20$ digit numbers $n$ (without any leading zero) exist such that no three consecutive digits of $n$ have a sum greater than $9$? | How many $20$ digit numbers $n$ (without any leading zero) exist such that no three consecutive digits of $n$ have a sum greater than $9$? | <p>How many $20$ digit numbers $n$ (without any leading zero) exist such that no three consecutive digits of $n$ have a sum greater than $9$?</p> | 378158756814587 | Saturday, 20th October 2007, 06:00 am | 6369 | 45% | medium |
378 | Triangle Triples | Let $T(n)$ be the nth triangle number, so $T(n) = \dfrac{n(n + 1)}{2}$.
Let $dT(n)$ be the number of divisors of $T(n)$.
E.g.: $T(7) = 28$ and $dT(7) = 6$.
Let $Tr(n)$ be the number of triples $(i, j, k)$ such that $1 \le i \lt j \lt k \le n$ and $dT(i) \gt dT(j) \gt dT(k)$.
$Tr(20) = 14$, $Tr(100) = 5772$, and $Tr(1000) = 11174776$.
Find $Tr(60 000 000)$.
Give the last 18 digits of your answer. | Let $T(n)$ be the nth triangle number, so $T(n) = \dfrac{n(n + 1)}{2}$.
Let $dT(n)$ be the number of divisors of $T(n)$.
E.g.: $T(7) = 28$ and $dT(7) = 6$.
Let $Tr(n)$ be the number of triples $(i, j, k)$ such that $1 \le i \lt j \lt k \le n$ and $dT(i) \gt dT(j) \gt dT(k)$.
$Tr(20) = 14$, $Tr(100) = 5772$, and $Tr(1000) = 11174776$.
Find $Tr(60 000 000)$.
Give the last 18 digits of your answer. | <p>Let $T(n)$ be the n<sup>th</sup> triangle number, so $T(n) = \dfrac{n(n + 1)}{2}$.</p>
<p>Let $dT(n)$ be the number of divisors of $T(n)$.<br>
E.g.: $T(7) = 28$ and $dT(7) = 6$.</br></p>
<p>Let $Tr(n)$ be the number of triples $(i, j, k)$ such that $1 \le i \lt j \lt k \le n$ and $dT(i) \gt dT(j) \gt dT(k)$.<br/>
$Tr(20) = 14$, $Tr(100) = 5772$, and $Tr(1000) = 11174776$.</p>
<p>Find $Tr(60 000 000)$. <br/>
Give the last 18 digits of your answer.</p> | 147534623725724718 | Sunday, 1st April 2012, 07:00 am | 981 | 35% | medium |
796 | A Grand Shuffle | A standard $52$ card deck comprises thirteen ranks in four suits. However, modern decks have two additional Jokers, which neither have a suit nor a rank, for a total of $54$ cards. If we shuffle such a deck and draw cards without replacement, then we would need, on average, approximately $29.05361725$ cards so that we have at least one card for each rank.
Now, assume you have $10$ such decks, each with a different back design. We shuffle all $10 \times 54$ cards together and draw cards without replacement. What is the expected number of cards needed so every suit, rank and deck design have at least one card?
Give your answer rounded to eight places after the decimal point. | A standard $52$ card deck comprises thirteen ranks in four suits. However, modern decks have two additional Jokers, which neither have a suit nor a rank, for a total of $54$ cards. If we shuffle such a deck and draw cards without replacement, then we would need, on average, approximately $29.05361725$ cards so that we have at least one card for each rank.
Now, assume you have $10$ such decks, each with a different back design. We shuffle all $10 \times 54$ cards together and draw cards without replacement. What is the expected number of cards needed so every suit, rank and deck design have at least one card?
Give your answer rounded to eight places after the decimal point. | <p>A standard $52$ card deck comprises thirteen ranks in four suits. However, modern decks have two additional Jokers, which neither have a suit nor a rank, for a total of $54$ cards. If we shuffle such a deck and draw cards without replacement, then we would need, on average, approximately $29.05361725$ cards so that we have at least one card for each rank.</p>
<p>Now, assume you have $10$ such decks, each with a different back design. We shuffle all $10 \times 54$ cards together and draw cards without replacement. What is the expected number of cards needed so every suit, rank and deck design have at least one card?</p>
<p>Give your answer rounded to eight places after the decimal point.</p> | 43.20649061 | Saturday, 30th April 2022, 05:00 pm | 219 | 55% | medium |
624 | Two Heads Are Better Than One | An unbiased coin is tossed repeatedly until two consecutive heads are obtained. Suppose these occur on the $(M-1)$th and $M$th toss.
Let $P(n)$ be the probability that $M$ is divisible by $n$. For example, the outcomes HH, HTHH, and THTTHH all count towards $P(2)$, but THH and HTTHH do not.
You are given that $P(2) =\frac 3 5$ and $P(3)=\frac 9 {31}$. Indeed, it can be shown that $P(n)$ is always a rational number.
For a prime $p$ and a fully reduced fraction $\frac a b$, define $Q(\frac a b,p)$ to be the smallest positive $q$ for which $a \equiv b q \pmod{p}$.
For example $Q(P(2), 109) = Q(\frac 3 5, 109) = 66$, because $5 \cdot 66 = 330 \equiv 3 \pmod{109}$ and $66$ is the smallest positive such number.
Similarly $Q(P(3),109) = 46$.
Find $Q(P(10^{18}),1\,000\,000\,009)$. | An unbiased coin is tossed repeatedly until two consecutive heads are obtained. Suppose these occur on the $(M-1)$th and $M$th toss.
Let $P(n)$ be the probability that $M$ is divisible by $n$. For example, the outcomes HH, HTHH, and THTTHH all count towards $P(2)$, but THH and HTTHH do not.
You are given that $P(2) =\frac 3 5$ and $P(3)=\frac 9 {31}$. Indeed, it can be shown that $P(n)$ is always a rational number.
For a prime $p$ and a fully reduced fraction $\frac a b$, define $Q(\frac a b,p)$ to be the smallest positive $q$ for which $a \equiv b q \pmod{p}$.
For example $Q(P(2), 109) = Q(\frac 3 5, 109) = 66$, because $5 \cdot 66 = 330 \equiv 3 \pmod{109}$ and $66$ is the smallest positive such number.
Similarly $Q(P(3),109) = 46$.
Find $Q(P(10^{18}),1\,000\,000\,009)$. | <p>
An unbiased coin is tossed repeatedly until two consecutive heads are obtained. Suppose these occur on the $(M-1)$th and $M$th toss.<br/>
Let $P(n)$ be the probability that $M$ is divisible by $n$. For example, the outcomes HH, HTHH, and THTTHH all count towards $P(2)$, but THH and HTTHH do not.</p>
<p>
You are given that $P(2) =\frac 3 5$ and $P(3)=\frac 9 {31}$. Indeed, it can be shown that $P(n)$ is always a rational number.</p>
<p>
For a prime $p$ and a fully reduced fraction $\frac a b$, define $Q(\frac a b,p)$ to be the smallest positive $q$ for which $a \equiv b q \pmod{p}$.<br/>
For example $Q(P(2), 109) = Q(\frac 3 5, 109) = 66$, because $5 \cdot 66 = 330 \equiv 3 \pmod{109}$ and $66$ is the smallest positive such number.<br/>
Similarly $Q(P(3),109) = 46$.</p>
<p>
Find $Q(P(10^{18}),1\,000\,000\,009)$.</p> | 984524441 | Saturday, 7th April 2018, 01:00 pm | 703 | 30% | easy |
568 | Reciprocal Games II | Tom has built a random generator that is connected to a row of $n$ light bulbs. Whenever the random generator is activated each of the $n$ lights is turned on with the probability of $\frac 1 2$, independently of its former state or the state of the other light bulbs.
While discussing with his friend Jerry how to use his generator, they invent two different games, they call the reciprocal games:
Both games consist of $n$ turns. Each turn is started by choosing a number $k$ randomly between (and including) $1$ and $n$, with equal probability of $\frac 1 n$ for each number, while the possible win for that turn is the reciprocal of $k$, that is $\frac 1 k$.
In game A, Tom activates his random generator once in each turn. If the number of lights turned on is the same as the previously chosen number $k$, Jerry wins and gets $\frac 1 k$, otherwise he will receive nothing for that turn. Jerry's expected win after playing the total game A consisting of $n$ turns is called $J_A(n)$. For example $J_A(6)=0.39505208$, rounded to $8$ decimal places.
For each turn in game B, after $k$ has been randomly selected, Tom keeps reactivating his random generator until exactly $k$ lights are turned on. After that Jerry takes over and reactivates the random generator until he, too, has generated a pattern with exactly $k$ lights turned on. If this pattern is identical to Tom's last pattern, Jerry wins and gets $\frac 1 k$, otherwise he will receive nothing. Jerry's expected win after the total game B consisting of $n$ turns is called $J_B(n)$. For example $J_B(6)=0.43333333$, rounded to $8$ decimal places.
Let $D(n)=J_B(n)−J_A(n)$. For example, $D(6) = 0.03828125$.
Find the $7$ most significant digits of $D(123456789)$ after removing all leading zeros.
(If, for example, we had asked for the $7$ most significant digits of $D(6)$, the answer would have been 3828125.) | Tom has built a random generator that is connected to a row of $n$ light bulbs. Whenever the random generator is activated each of the $n$ lights is turned on with the probability of $\frac 1 2$, independently of its former state or the state of the other light bulbs.
While discussing with his friend Jerry how to use his generator, they invent two different games, they call the reciprocal games:
Both games consist of $n$ turns. Each turn is started by choosing a number $k$ randomly between (and including) $1$ and $n$, with equal probability of $\frac 1 n$ for each number, while the possible win for that turn is the reciprocal of $k$, that is $\frac 1 k$.
In game A, Tom activates his random generator once in each turn. If the number of lights turned on is the same as the previously chosen number $k$, Jerry wins and gets $\frac 1 k$, otherwise he will receive nothing for that turn. Jerry's expected win after playing the total game A consisting of $n$ turns is called $J_A(n)$. For example $J_A(6)=0.39505208$, rounded to $8$ decimal places.
For each turn in game B, after $k$ has been randomly selected, Tom keeps reactivating his random generator until exactly $k$ lights are turned on. After that Jerry takes over and reactivates the random generator until he, too, has generated a pattern with exactly $k$ lights turned on. If this pattern is identical to Tom's last pattern, Jerry wins and gets $\frac 1 k$, otherwise he will receive nothing. Jerry's expected win after the total game B consisting of $n$ turns is called $J_B(n)$. For example $J_B(6)=0.43333333$, rounded to $8$ decimal places.
Let $D(n)=J_B(n)−J_A(n)$. For example, $D(6) = 0.03828125$.
Find the $7$ most significant digits of $D(123456789)$ after removing all leading zeros.
(If, for example, we had asked for the $7$ most significant digits of $D(6)$, the answer would have been 3828125.) | <p>Tom has built a random generator that is connected to a row of $n$ light bulbs. Whenever the random generator is activated each of the $n$ lights is turned on with the probability of $\frac 1 2$, independently of its former state or the state of the other light bulbs.</p>
<p>While discussing with his friend Jerry how to use his generator, they invent two different games, they call the <dfn>reciprocal games</dfn>:<br/>
Both games consist of $n$ turns. Each turn is started by choosing a number $k$ randomly between (and including) $1$ and $n$, with equal probability of $\frac 1 n$ for each number, while the possible win for that turn is the reciprocal of $k$, that is $\frac 1 k$.</p>
<p>In game A, Tom activates his random generator once in each turn. If the number of lights turned on is the same as the previously chosen number $k$, Jerry wins and gets $\frac 1 k$, otherwise he will receive nothing for that turn. Jerry's expected win after playing the total game A consisting of $n$ turns is called $J_A(n)$. For example $J_A(6)=0.39505208$, rounded to $8$ decimal places.</p>
<p>For each turn in game B, after $k$ has been randomly selected, Tom keeps reactivating his random generator until exactly $k$ lights are turned on. After that Jerry takes over and reactivates the random generator until he, too, has generated a pattern with exactly $k$ lights turned on. If this pattern is identical to Tom's last pattern, Jerry wins and gets $\frac 1 k$, otherwise he will receive nothing. Jerry's expected win after the total game B consisting of $n$ turns is called $J_B(n)$. For example $J_B(6)=0.43333333$, rounded to $8$ decimal places.</p>
<p>Let $D(n)=J_B(n)−J_A(n)$. For example, $D(6) = 0.03828125$.</p>
<p>Find the $7$ most significant digits of $D(123456789)$ after removing all leading zeros.<br/>
(If, for example, we had asked for the $7$ most significant digits of $D(6)$, the answer would have been 3828125.)</p> | 4228020 | Saturday, 3rd September 2016, 04:00 pm | 320 | 55% | medium |
283 | Integer Sided Triangles with Integral Area/perimeter Ratio | Consider the triangle with sides $6$, $8$, and $10$. It can be seen that the perimeter and the area are both equal to $24$.
So the area/perimeter ratio is equal to $1$.
Consider also the triangle with sides $13$, $14$ and $15$. The perimeter equals $42$ while the area is equal to $84$.
So for this triangle the area/perimeter ratio is equal to $2$.
Find the sum of the perimeters of all integer sided triangles for which the area/perimeter ratios are equal to positive integers not exceeding $1000$. | Consider the triangle with sides $6$, $8$, and $10$. It can be seen that the perimeter and the area are both equal to $24$.
So the area/perimeter ratio is equal to $1$.
Consider also the triangle with sides $13$, $14$ and $15$. The perimeter equals $42$ while the area is equal to $84$.
So for this triangle the area/perimeter ratio is equal to $2$.
Find the sum of the perimeters of all integer sided triangles for which the area/perimeter ratios are equal to positive integers not exceeding $1000$. | <p>
Consider the triangle with sides $6$, $8$, and $10$. It can be seen that the perimeter and the area are both equal to $24$.
So the area/perimeter ratio is equal to $1$.<br/>
Consider also the triangle with sides $13$, $14$ and $15$. The perimeter equals $42$ while the area is equal to $84$.
So for this triangle the area/perimeter ratio is equal to $2$.
</p>
<p>
Find the sum of the perimeters of all integer sided triangles for which the area/perimeter ratios are equal to positive integers not exceeding $1000$.
</p> | 28038042525570324 | Friday, 19th March 2010, 09:00 pm | 711 | 75% | hard |
839 | Beans in Bowls | The sequence $S_n$ is defined by $S_0 = 290797$ and $S_n = S_{n - 1}^2 \bmod 50515093$ for $n > 0$.
There are $N$ bowls indexed $0,1,\dots ,N-1$. Initially there are $S_n$ beans in bowl $n$.
At each step, the smallest index $n$ is found such that bowl $n$ has strictly more beans than bowl $n+1$. Then one bean is moved from bowl $n$ to bowl $n+1$.
Let $B(N)$ be the number of steps needed to sort the bowls into non-descending order.
For example, $B(5) = 0$, $B(6) = 14263289$ and $B(100)=3284417556$.
Find $B(10^7)$. | The sequence $S_n$ is defined by $S_0 = 290797$ and $S_n = S_{n - 1}^2 \bmod 50515093$ for $n > 0$.
There are $N$ bowls indexed $0,1,\dots ,N-1$. Initially there are $S_n$ beans in bowl $n$.
At each step, the smallest index $n$ is found such that bowl $n$ has strictly more beans than bowl $n+1$. Then one bean is moved from bowl $n$ to bowl $n+1$.
Let $B(N)$ be the number of steps needed to sort the bowls into non-descending order.
For example, $B(5) = 0$, $B(6) = 14263289$ and $B(100)=3284417556$.
Find $B(10^7)$. | <p>
The sequence $S_n$ is defined by $S_0 = 290797$ and $S_n = S_{n - 1}^2 \bmod 50515093$ for $n > 0$.</p>
<p>There are $N$ bowls indexed $0,1,\dots ,N-1$. Initially there are $S_n$ beans in bowl $n$.</p>
<p>
At each step, the smallest index $n$ is found such that bowl $n$ has strictly more beans than bowl $n+1$. Then one bean is moved from bowl $n$ to bowl $n+1$.</p>
<p>
Let $B(N)$ be the number of steps needed to sort the bowls into non-descending order.<br/>
For example, $B(5) = 0$, $B(6) = 14263289$ and $B(100)=3284417556$.</p>
<p>
Find $B(10^7)$.</p> | 150893234438294408 | Saturday, 15th April 2023, 11:00 pm | 374 | 30% | easy |
259 | Reachable Numbers | A positive integer will be called reachable if it can result from an arithmetic expression obeying the following rules:
Uses the digits $1$ through $9$, in that order and exactly once each.
Any successive digits can be concatenated (for example, using the digits $2$, $3$ and $4$ we obtain the number $234$).
Only the four usual binary arithmetic operations (addition, subtraction, multiplication and division) are allowed.
Each operation can be used any number of times, or not at all.
Unary minusA minus sign applied to a single operand (as opposed to a subtraction operator between two operands) is not allowed.
Any number of (possibly nested) parentheses may be used to define the order of operations.
For example, $42$ is reachable, since $(1 / 23) \times ((4 \times 5) - 6) \times (78 - 9) = 42$.
What is the sum of all positive reachable integers? | A positive integer will be called reachable if it can result from an arithmetic expression obeying the following rules:
Uses the digits $1$ through $9$, in that order and exactly once each.
Any successive digits can be concatenated (for example, using the digits $2$, $3$ and $4$ we obtain the number $234$).
Only the four usual binary arithmetic operations (addition, subtraction, multiplication and division) are allowed.
Each operation can be used any number of times, or not at all.
Unary minusA minus sign applied to a single operand (as opposed to a subtraction operator between two operands) is not allowed.
Any number of (possibly nested) parentheses may be used to define the order of operations.
For example, $42$ is reachable, since $(1 / 23) \times ((4 \times 5) - 6) \times (78 - 9) = 42$.
What is the sum of all positive reachable integers? | <p>A positive integer will be called <dfn>reachable</dfn> if it can result from an arithmetic expression obeying the following rules:</p>
<ul><li>Uses the digits $1$ through $9$, in that order and exactly once each.</li>
<li>Any successive digits can be concatenated (for example, using the digits $2$, $3$ and $4$ we obtain the number $234$).</li>
<li>Only the four usual binary arithmetic operations (addition, subtraction, multiplication and division) are allowed.</li>
<li>Each operation can be used any number of times, or not at all.</li>
<li><strong class="tooltip">Unary minus<span class="tooltiptext">A minus sign applied to a single operand (as opposed to a subtraction operator between two operands)</span></strong> is not allowed.</li>
<li>Any number of (possibly nested) parentheses may be used to define the order of operations.</li>
</ul><p>For example, $42$ is reachable, since $(1 / 23) \times ((4 \times 5) - 6) \times (78 - 9) = 42$.</p>
<p>What is the sum of all positive reachable integers?</p> | 20101196798 | Saturday, 10th October 2009, 01:00 pm | 1680 | 70% | hard |
439 | Sum of Sum of Divisors | Let $d(k)$ be the sum of all divisors of $k$.
We define the function $S(N) = \sum_{i=1}^N \sum_{j=1}^Nd(i \cdot j)$.
For example, $S(3) = d(1) + d(2) + d(3) + d(2) + d(4) + d(6) + d(3) + d(6) + d(9) = 59$.
You are given that $S(10^3) = 563576517282$ and $S(10^5) \bmod 10^9 = 215766508$.
Find $S(10^{11}) \bmod 10^9$. | Let $d(k)$ be the sum of all divisors of $k$.
We define the function $S(N) = \sum_{i=1}^N \sum_{j=1}^Nd(i \cdot j)$.
For example, $S(3) = d(1) + d(2) + d(3) + d(2) + d(4) + d(6) + d(3) + d(6) + d(9) = 59$.
You are given that $S(10^3) = 563576517282$ and $S(10^5) \bmod 10^9 = 215766508$.
Find $S(10^{11}) \bmod 10^9$. | <p>Let $d(k)$ be the sum of all divisors of $k$.<br/>
We define the function $S(N) = \sum_{i=1}^N \sum_{j=1}^Nd(i \cdot j)$.<br/>
For example, $S(3) = d(1) + d(2) + d(3) + d(2) + d(4) + d(6) + d(3) + d(6) + d(9) = 59$.</p>
<p>You are given that $S(10^3) = 563576517282$ and $S(10^5) \bmod 10^9 = 215766508$.<br/>
Find $S(10^{11}) \bmod 10^9$.</p> | 968697378 | Sunday, 6th October 2013, 04:00 am | 448 | 100% | hard |
161 | Triominoes | A triomino is a shape consisting of three squares joined via the edges.
There are two basic forms:
If all possible orientations are taken into account there are six:
Any $n$ by $m$ grid for which $n \times m$ is divisible by $3$ can be tiled with triominoes.
If we consider tilings that can be obtained by reflection or rotation from another tiling as different there are $41$ ways a $2$ by $9$ grid can be tiled with triominoes:
In how many ways can a $9$ by $12$ grid be tiled in this way by triominoes? | A triomino is a shape consisting of three squares joined via the edges.
There are two basic forms:
If all possible orientations are taken into account there are six:
Any $n$ by $m$ grid for which $n \times m$ is divisible by $3$ can be tiled with triominoes.
If we consider tilings that can be obtained by reflection or rotation from another tiling as different there are $41$ ways a $2$ by $9$ grid can be tiled with triominoes:
In how many ways can a $9$ by $12$ grid be tiled in this way by triominoes? | <p>A triomino is a shape consisting of three squares joined via the edges.
There are two basic forms:</p>
<p class="center"><img alt="" class="dark_img" src="resources/images/0161_trio1.gif?1678992055"/></p>
<p>If all possible orientations are taken into account there are six:</p>
<p class="center"><img alt="" class="dark_img" src="resources/images/0161_trio3.gif?1678992055"/></p>
<p>Any $n$ by $m$ grid for which $n \times m$ is divisible by $3$ can be tiled with triominoes.<br/>
If we consider tilings that can be obtained by reflection or rotation from another tiling as different there are $41$ ways a $2$ by $9$ grid can be tiled with triominoes:</p>
<p class="center"><img alt="" class="dark_img" src="resources/images/0161_k9.gif?1678992055"/></p>
<p>In how many ways can a $9$ by $12$ grid be tiled in this way by triominoes?</p> | 20574308184277971 | Friday, 21st September 2007, 06:00 pm | 2430 | 70% | hard |
75 | Singular Integer Right Triangles | It turns out that $\pu{12 cm}$ is the smallest length of wire that can be bent to form an integer sided right angle triangle in exactly one way, but there are many more examples.
$\pu{\mathbf{12} \mathbf{cm}}$: $(3,4,5)$
$\pu{\mathbf{24} \mathbf{cm}}$: $(6,8,10)$
$\pu{\mathbf{30} \mathbf{cm}}$: $(5,12,13)$
$\pu{\mathbf{36} \mathbf{cm}}$: $(9,12,15)$
$\pu{\mathbf{40} \mathbf{cm}}$: $(8,15,17)$
$\pu{\mathbf{48} \mathbf{cm}}$: $(12,16,20)$
In contrast, some lengths of wire, like $\pu{20 cm}$, cannot be bent to form an integer sided right angle triangle, and other lengths allow more than one solution to be found; for example, using $\pu{120 cm}$ it is possible to form exactly three different integer sided right angle triangles.
$\pu{\mathbf{120} \mathbf{cm}}$: $(30,40,50)$, $(20,48,52)$, $(24,45,51)$
Given that $L$ is the length of the wire, for how many values of $L \le 1\,500\,000$ can exactly one integer sided right angle triangle be formed? | It turns out that $\pu{12 cm}$ is the smallest length of wire that can be bent to form an integer sided right angle triangle in exactly one way, but there are many more examples.
$\pu{\mathbf{12} \mathbf{cm}}$: $(3,4,5)$
$\pu{\mathbf{24} \mathbf{cm}}$: $(6,8,10)$
$\pu{\mathbf{30} \mathbf{cm}}$: $(5,12,13)$
$\pu{\mathbf{36} \mathbf{cm}}$: $(9,12,15)$
$\pu{\mathbf{40} \mathbf{cm}}$: $(8,15,17)$
$\pu{\mathbf{48} \mathbf{cm}}$: $(12,16,20)$
In contrast, some lengths of wire, like $\pu{20 cm}$, cannot be bent to form an integer sided right angle triangle, and other lengths allow more than one solution to be found; for example, using $\pu{120 cm}$ it is possible to form exactly three different integer sided right angle triangles.
$\pu{\mathbf{120} \mathbf{cm}}$: $(30,40,50)$, $(20,48,52)$, $(24,45,51)$
Given that $L$ is the length of the wire, for how many values of $L \le 1\,500\,000$ can exactly one integer sided right angle triangle be formed? | <p>It turns out that $\pu{12 cm}$ is the smallest length of wire that can be bent to form an integer sided right angle triangle in exactly one way, but there are many more examples.</p>
<ul style="list-style-type:none;">
<li>$\pu{\mathbf{12} \mathbf{cm}}$: $(3,4,5)$</li>
<li>$\pu{\mathbf{24} \mathbf{cm}}$: $(6,8,10)$</li>
<li>$\pu{\mathbf{30} \mathbf{cm}}$: $(5,12,13)$</li>
<li>$\pu{\mathbf{36} \mathbf{cm}}$: $(9,12,15)$</li>
<li>$\pu{\mathbf{40} \mathbf{cm}}$: $(8,15,17)$</li>
<li>$\pu{\mathbf{48} \mathbf{cm}}$: $(12,16,20)$</li></ul>
<p>In contrast, some lengths of wire, like $\pu{20 cm}$, cannot be bent to form an integer sided right angle triangle, and other lengths allow more than one solution to be found; for example, using $\pu{120 cm}$ it is possible to form exactly three different integer sided right angle triangles.</p>
<ul style="list-style-type:none;">
<li>$\pu{\mathbf{120} \mathbf{cm}}$: $(30,40,50)$, $(20,48,52)$, $(24,45,51)$</li></ul>
<p>Given that $L$ is the length of the wire, for how many values of $L \le 1\,500\,000$ can exactly one integer sided right angle triangle be formed?</p> | 161667 | Friday, 30th July 2004, 06:00 pm | 20294 | 25% | easy |
653 | Frictionless Tube | Consider a horizontal frictionless tube with length $L$ millimetres, and a diameter of 20 millimetres. The east end of the tube is open, while the west end is sealed. The tube contains $N$ marbles of diameter 20 millimetres at designated starting locations, each one initially moving either westward or eastward with common speed $v$.
Since there are marbles moving in opposite directions, there are bound to be some collisions. We assume that the collisions are perfectly elastic, so both marbles involved instantly change direction and continue with speed $v$ away from the collision site. Similarly, if the west-most marble collides with the sealed end of the tube, it instantly changes direction and continues eastward at speed $v$. On the other hand, once a marble reaches the unsealed east end, it exits the tube and has no further interaction with the remaining marbles.
To obtain the starting positions and initial directions, we use the pseudo-random sequence $r_j$ defined by:
$r_1 = 6\,563\,116$
$r_{j+1} = r_j^2 \bmod 32\,745\,673$
The west-most marble is initially positioned with a gap of $(r_1 \bmod 1000) + 1$ millimetres between it and the sealed end of the tube, measured from the west-most point of the surface of the marble. Then, for $2\le j\le N$, counting from the west, the gap between the $(j-1)$th and $j$th marbles, as measured from their closest points, is given by $(r_j \bmod 1000) + 1$ millimetres.
Furthermore, the $j$th marble is initially moving eastward if $r_j \le 10\,000\,000$, and westward if $r_j > 10\,000\,000$.
For example, with $N=3$, the sequence specifies gaps of 117, 432, and 173 millimetres. The marbles' centres are therefore 127, 579, and 772 millimetres from the sealed west end of the tube. The west-most marble initially moves eastward, while the other two initially move westward.
Under this setup, and with a five metre tube ($L=5000$), it turns out that the middle (second) marble travels 5519 millimetres before its centre reaches the east-most end of the tube.
Let $d(L, N, j)$ be the distance in millimetres that the $j$th marble travels before its centre reaches the eastern end of the tube. So $d(5000, 3, 2) = 5519$. You are also given that $d(10\,000, 11, 6) = 11\,780$ and $d(100\,000, 101, 51) = 114\,101$.
Find $d(1\,000\,000\,000, 1\,000\,001, 500\,001)$. | Consider a horizontal frictionless tube with length $L$ millimetres, and a diameter of 20 millimetres. The east end of the tube is open, while the west end is sealed. The tube contains $N$ marbles of diameter 20 millimetres at designated starting locations, each one initially moving either westward or eastward with common speed $v$.
Since there are marbles moving in opposite directions, there are bound to be some collisions. We assume that the collisions are perfectly elastic, so both marbles involved instantly change direction and continue with speed $v$ away from the collision site. Similarly, if the west-most marble collides with the sealed end of the tube, it instantly changes direction and continues eastward at speed $v$. On the other hand, once a marble reaches the unsealed east end, it exits the tube and has no further interaction with the remaining marbles.
To obtain the starting positions and initial directions, we use the pseudo-random sequence $r_j$ defined by:
$r_1 = 6\,563\,116$
$r_{j+1} = r_j^2 \bmod 32\,745\,673$
The west-most marble is initially positioned with a gap of $(r_1 \bmod 1000) + 1$ millimetres between it and the sealed end of the tube, measured from the west-most point of the surface of the marble. Then, for $2\le j\le N$, counting from the west, the gap between the $(j-1)$th and $j$th marbles, as measured from their closest points, is given by $(r_j \bmod 1000) + 1$ millimetres.
Furthermore, the $j$th marble is initially moving eastward if $r_j \le 10\,000\,000$, and westward if $r_j > 10\,000\,000$.
For example, with $N=3$, the sequence specifies gaps of 117, 432, and 173 millimetres. The marbles' centres are therefore 127, 579, and 772 millimetres from the sealed west end of the tube. The west-most marble initially moves eastward, while the other two initially move westward.
Under this setup, and with a five metre tube ($L=5000$), it turns out that the middle (second) marble travels 5519 millimetres before its centre reaches the east-most end of the tube.
Let $d(L, N, j)$ be the distance in millimetres that the $j$th marble travels before its centre reaches the eastern end of the tube. So $d(5000, 3, 2) = 5519$. You are also given that $d(10\,000, 11, 6) = 11\,780$ and $d(100\,000, 101, 51) = 114\,101$.
Find $d(1\,000\,000\,000, 1\,000\,001, 500\,001)$. | <p>Consider a horizontal frictionless tube with length $L$ millimetres, and a diameter of 20 millimetres. The east end of the tube is open, while the west end is sealed. The tube contains $N$ marbles of diameter 20 millimetres at designated starting locations, each one initially moving either westward or eastward with common speed $v$.</p>
<p>Since there are marbles moving in opposite directions, there are bound to be some collisions. We assume that the collisions are perfectly elastic, so both marbles involved instantly change direction and continue with speed $v$ away from the collision site. Similarly, if the west-most marble collides with the sealed end of the tube, it instantly changes direction and continues eastward at speed $v$. On the other hand, once a marble reaches the unsealed east end, it exits the tube and has no further interaction with the remaining marbles.</p>
<p>To obtain the starting positions and initial directions, we use the pseudo-random sequence $r_j$ defined by:<br>
$r_1 = 6\,563\,116$<br/>
$r_{j+1} = r_j^2 \bmod 32\,745\,673$<br/>
The west-most marble is initially positioned with a gap of $(r_1 \bmod 1000) + 1$ millimetres between it and the sealed end of the tube, measured from the west-most point of the surface of the marble. Then, for $2\le j\le N$, counting from the west, the gap between the $(j-1)$th and $j$th marbles, as measured from their closest points, is given by $(r_j \bmod 1000) + 1$ millimetres.
Furthermore, the $j$th marble is initially moving eastward if $r_j \le 10\,000\,000$, and westward if $r_j > 10\,000\,000$.</br></p>
<p>For example, with $N=3$, the sequence specifies gaps of 117, 432, and 173 millimetres. The marbles' <i>centres</i> are therefore 127, 579, and 772 millimetres from the sealed west end of the tube. The west-most marble initially moves eastward, while the other two initially move westward.</p>
<p>Under this setup, and with a five metre tube ($L=5000$), it turns out that the middle (second) marble travels 5519 millimetres before its centre reaches the east-most end of the tube.</p>
<p>Let $d(L, N, j)$ be the distance in millimetres that the $j$th marble travels before its centre reaches the eastern end of the tube. So $d(5000, 3, 2) = 5519$. You are also given that $d(10\,000, 11, 6) = 11\,780$ and $d(100\,000, 101, 51) = 114\,101$.</p>
<p>Find $d(1\,000\,000\,000, 1\,000\,001, 500\,001)$.</p> | 1130658687 | Sunday, 27th January 2019, 01:00 am | 347 | 45% | medium |
560 | Coprime Nim | Coprime Nim is just like ordinary normal play Nim, but the players may only remove a number of stones from a pile that is coprime with the current size of the pile. Two players remove stones in turn. The player who removes the last stone wins.
Let $L(n, k)$ be the number of losing starting positions for the first player, assuming perfect play, when the game is played with $k$ piles, each having between $1$ and $n - 1$ stones inclusively.
For example, $L(5, 2) = 6$ since the losing initial positions are $(1, 1)$, $(2, 2)$, $(2, 4)$, $(3, 3)$, $(4, 2)$ and $(4, 4)$.
You are also given $L(10, 5) = 9964$, $L(10, 10) = 472400303$, $L(10^3, 10^3) \bmod 1\,000\,000\,007 = 954021836$.
Find $L(10^7, 10^7)\bmod 1\,000\,000\,007$. | Coprime Nim is just like ordinary normal play Nim, but the players may only remove a number of stones from a pile that is coprime with the current size of the pile. Two players remove stones in turn. The player who removes the last stone wins.
Let $L(n, k)$ be the number of losing starting positions for the first player, assuming perfect play, when the game is played with $k$ piles, each having between $1$ and $n - 1$ stones inclusively.
For example, $L(5, 2) = 6$ since the losing initial positions are $(1, 1)$, $(2, 2)$, $(2, 4)$, $(3, 3)$, $(4, 2)$ and $(4, 4)$.
You are also given $L(10, 5) = 9964$, $L(10, 10) = 472400303$, $L(10^3, 10^3) \bmod 1\,000\,000\,007 = 954021836$.
Find $L(10^7, 10^7)\bmod 1\,000\,000\,007$. | <p>Coprime Nim is just like ordinary normal play Nim, but the players may only remove a number of stones from a pile that is <strong>coprime</strong> with the current size of the pile. Two players remove stones in turn. The player who removes the last stone wins.</p>
<p>Let $L(n, k)$ be the number of <strong>losing</strong> starting positions for the first player, assuming perfect play, when the game is played with $k$ piles, each having between $1$ and $n - 1$ stones inclusively.</p>
<p>For example, $L(5, 2) = 6$ since the losing initial positions are $(1, 1)$, $(2, 2)$, $(2, 4)$, $(3, 3)$, $(4, 2)$ and $(4, 4)$.<br/>
You are also given $L(10, 5) = 9964$, $L(10, 10) = 472400303$, $L(10^3, 10^3) \bmod 1\,000\,000\,007 = 954021836$.</p>
<p>Find $L(10^7, 10^7)\bmod 1\,000\,000\,007$.</p> | 994345168 | Saturday, 14th May 2016, 07:00 pm | 371 | 75% | hard |
897 | Maximal $n$-gon in a region | Let $G(n)$ denote the largest possible area of an $n$-gona polygon with $n$ sides contained in the region $\{(x, y) \in \Bbb R^2: x^4 \leq y \leq 1\}$.
For example, $G(3) = 1$ and $G(5)\approx 1.477309771$.
Find $G(101)$ rounded to nine digits after the decimal point. | Let $G(n)$ denote the largest possible area of an $n$-gona polygon with $n$ sides contained in the region $\{(x, y) \in \Bbb R^2: x^4 \leq y \leq 1\}$.
For example, $G(3) = 1$ and $G(5)\approx 1.477309771$.
Find $G(101)$ rounded to nine digits after the decimal point. | <p>
Let $G(n)$ denote the largest possible area of an <strong class="tooltip">$n$-gon<span class="tooltiptext">a polygon with $n$ sides</span></strong> contained in the region $\{(x, y) \in \Bbb R^2: x^4 \leq y \leq 1\}$.<br/>
For example, $G(3) = 1$ and $G(5)\approx 1.477309771$.<br/>
Find $G(101)$ rounded to nine digits after the decimal point.</p> | 1.599827123 | Saturday, 29th June 2024, 11:00 pm | 405 | 25% | easy |
201 | Subsets with a Unique Sum | For any set $A$ of numbers, let $\operatorname{sum}(A)$ be the sum of the elements of $A$.
Consider the set $B = \{1,3,6,8,10,11\}$. There are $20$ subsets of $B$ containing three elements, and their sums are:
\begin{align}
\operatorname{sum}(\{1,3,6\}) &= 10,\\
\operatorname{sum}(\{1,3,8\}) &= 12,\\
\operatorname{sum}(\{1,3,10\}) &= 14,\\
\operatorname{sum}(\{1,3,11\}) &= 15,\\
\operatorname{sum}(\{1,6,8\}) &= 15,\\
\operatorname{sum}(\{1,6,10\}) &= 17,\\
\operatorname{sum}(\{1,6,11\}) &= 18,\\
\operatorname{sum}(\{1,8,10\}) &= 19,\\
\operatorname{sum}(\{1,8,11\}) &= 20,\\
\operatorname{sum}(\{1,10,11\}) &= 22,\\
\operatorname{sum}(\{3,6,8\}) &= 17,\\
\operatorname{sum}(\{3,6,10\}) &= 19,\\
\operatorname{sum}(\{3,6,11\}) &= 20,\\
\operatorname{sum}(\{3,8,10\}) &= 21,\\
\operatorname{sum}(\{3,8,11\}) &= 22,\\
\operatorname{sum}(\{3,10,11\}) &= 24,\\
\operatorname{sum}(\{6,8,10\}) &= 24,\\
\operatorname{sum}(\{6,8,11\}) &= 25,\\
\operatorname{sum}(\{6,10,11\}) &= 27,\\
\operatorname{sum}(\{8,10,11\}) &= 29.
\end{align}
Some of these sums occur more than once, others are unique.
For a set $A$, let $U(A,k)$ be the set of unique sums of $k$-element subsets of $A$, in our example we find $U(B,3) = \{10,12,14,18,21,25,27,29\}$ and $\operatorname{sum}(U(B,3)) = 156$.
Now consider the $100$-element set $S = \{1^2, 2^2, \dots, 100^2\}$.
S has $100891344545564193334812497256$ $50$-element subsets.
Determine the sum of all integers which are the sum of exactly one of the $50$-element subsets of $S$, i.e. find $\operatorname{sum}(U(S,50))$. | For any set $A$ of numbers, let $\operatorname{sum}(A)$ be the sum of the elements of $A$.
Consider the set $B = \{1,3,6,8,10,11\}$. There are $20$ subsets of $B$ containing three elements, and their sums are:
\begin{align}
\operatorname{sum}(\{1,3,6\}) &= 10,\\
\operatorname{sum}(\{1,3,8\}) &= 12,\\
\operatorname{sum}(\{1,3,10\}) &= 14,\\
\operatorname{sum}(\{1,3,11\}) &= 15,\\
\operatorname{sum}(\{1,6,8\}) &= 15,\\
\operatorname{sum}(\{1,6,10\}) &= 17,\\
\operatorname{sum}(\{1,6,11\}) &= 18,\\
\operatorname{sum}(\{1,8,10\}) &= 19,\\
\operatorname{sum}(\{1,8,11\}) &= 20,\\
\operatorname{sum}(\{1,10,11\}) &= 22,\\
\operatorname{sum}(\{3,6,8\}) &= 17,\\
\operatorname{sum}(\{3,6,10\}) &= 19,\\
\operatorname{sum}(\{3,6,11\}) &= 20,\\
\operatorname{sum}(\{3,8,10\}) &= 21,\\
\operatorname{sum}(\{3,8,11\}) &= 22,\\
\operatorname{sum}(\{3,10,11\}) &= 24,\\
\operatorname{sum}(\{6,8,10\}) &= 24,\\
\operatorname{sum}(\{6,8,11\}) &= 25,\\
\operatorname{sum}(\{6,10,11\}) &= 27,\\
\operatorname{sum}(\{8,10,11\}) &= 29.
\end{align}
Some of these sums occur more than once, others are unique.
For a set $A$, let $U(A,k)$ be the set of unique sums of $k$-element subsets of $A$, in our example we find $U(B,3) = \{10,12,14,18,21,25,27,29\}$ and $\operatorname{sum}(U(B,3)) = 156$.
Now consider the $100$-element set $S = \{1^2, 2^2, \dots, 100^2\}$.
S has $100891344545564193334812497256$ $50$-element subsets.
Determine the sum of all integers which are the sum of exactly one of the $50$-element subsets of $S$, i.e. find $\operatorname{sum}(U(S,50))$. | <p>For any set $A$ of numbers, let $\operatorname{sum}(A)$ be the sum of the elements of $A$.<br/>
Consider the set $B = \{1,3,6,8,10,11\}$.<br/> There are $20$ subsets of $B$ containing three elements, and their sums are:</p>
\begin{align}
\operatorname{sum}(\{1,3,6\}) &= 10,\\
\operatorname{sum}(\{1,3,8\}) &= 12,\\
\operatorname{sum}(\{1,3,10\}) &= 14,\\
\operatorname{sum}(\{1,3,11\}) &= 15,\\
\operatorname{sum}(\{1,6,8\}) &= 15,\\
\operatorname{sum}(\{1,6,10\}) &= 17,\\
\operatorname{sum}(\{1,6,11\}) &= 18,\\
\operatorname{sum}(\{1,8,10\}) &= 19,\\
\operatorname{sum}(\{1,8,11\}) &= 20,\\
\operatorname{sum}(\{1,10,11\}) &= 22,\\
\operatorname{sum}(\{3,6,8\}) &= 17,\\
\operatorname{sum}(\{3,6,10\}) &= 19,\\
\operatorname{sum}(\{3,6,11\}) &= 20,\\
\operatorname{sum}(\{3,8,10\}) &= 21,\\
\operatorname{sum}(\{3,8,11\}) &= 22,\\
\operatorname{sum}(\{3,10,11\}) &= 24,\\
\operatorname{sum}(\{6,8,10\}) &= 24,\\
\operatorname{sum}(\{6,8,11\}) &= 25,\\
\operatorname{sum}(\{6,10,11\}) &= 27,\\
\operatorname{sum}(\{8,10,11\}) &= 29.
\end{align}
<p>Some of these sums occur more than once, others are unique.<br/>
For a set $A$, let $U(A,k)$ be the set of unique sums of $k$-element subsets of $A$, in our example we find $U(B,3) = \{10,12,14,18,21,25,27,29\}$ and $\operatorname{sum}(U(B,3)) = 156$.</p>
<p>Now consider the $100$-element set $S = \{1^2, 2^2, \dots, 100^2\}$.<br/>
S has $100891344545564193334812497256$ $50$-element subsets.</p>
<p>Determine the sum of all integers which are the sum of exactly one of the $50$-element subsets of $S$, i.e. find $\operatorname{sum}(U(S,50))$.</p> | 115039000 | Saturday, 5th July 2008, 02:00 pm | 2635 | 65% | hard |
689 | Binary Series | For $0 \le x \lt 1$, define $d_i(x)$ to be the $i$th digit after the binary point of the binary representation of $x$.
For example $d_2(0.25) = 1$, $d_i(0.25) = 0$ for $i \ne 2$.
Let $f(x) = \displaystyle{\sum_{i=1}^{\infty}\frac{d_i(x)}{i^2}}$.
Let $p(a)$ be probability that $f(x) \gt a$, given that $x$ is uniformly distributed between $0$ and $1$.
Find $p(0.5)$. Give your answer rounded to $8$ digits after the decimal point. | For $0 \le x \lt 1$, define $d_i(x)$ to be the $i$th digit after the binary point of the binary representation of $x$.
For example $d_2(0.25) = 1$, $d_i(0.25) = 0$ for $i \ne 2$.
Let $f(x) = \displaystyle{\sum_{i=1}^{\infty}\frac{d_i(x)}{i^2}}$.
Let $p(a)$ be probability that $f(x) \gt a$, given that $x$ is uniformly distributed between $0$ and $1$.
Find $p(0.5)$. Give your answer rounded to $8$ digits after the decimal point. | <p>For $0 \le x \lt 1$, define $d_i(x)$ to be the $i$th digit after the binary point of the binary representation of $x$.<br/>
For example $d_2(0.25) = 1$, $d_i(0.25) = 0$ for $i \ne 2$.</p>
<p>Let $f(x) = \displaystyle{\sum_{i=1}^{\infty}\frac{d_i(x)}{i^2}}$.</p>
<p>Let $p(a)$ be probability that $f(x) \gt a$, given that $x$ is uniformly distributed between $0$ and $1$.</p>
<p>Find $p(0.5)$. Give your answer rounded to $8$ digits after the decimal point.</p> | 0.56565454 | Sunday, 17th November 2019, 04:00 am | 245 | 60% | hard |
518 | Prime Triples and Geometric Sequences | Let $S(n) = \sum a + b + c$ over all triples $(a, b, c)$ such that:
$a$, $b$ and $c$ are prime numbers.
$a \lt b \lt c \lt n$.
$a+1$, $b+1$, and $c+1$ form a geometric sequence.
For example, $S(100) = 1035$ with the following triples:
$(2, 5, 11)$, $(2, 11, 47)$, $(5, 11, 23)$, $(5, 17, 53)$, $(7, 11, 17)$, $(7, 23, 71)$, $(11, 23, 47)$, $(17, 23, 31)$, $(17, 41, 97)$, $(31, 47, 71)$, $(71, 83, 97)$
Find $S(10^8)$. | Let $S(n) = \sum a + b + c$ over all triples $(a, b, c)$ such that:
$a$, $b$ and $c$ are prime numbers.
$a \lt b \lt c \lt n$.
$a+1$, $b+1$, and $c+1$ form a geometric sequence.
For example, $S(100) = 1035$ with the following triples:
$(2, 5, 11)$, $(2, 11, 47)$, $(5, 11, 23)$, $(5, 17, 53)$, $(7, 11, 17)$, $(7, 23, 71)$, $(11, 23, 47)$, $(17, 23, 31)$, $(17, 41, 97)$, $(31, 47, 71)$, $(71, 83, 97)$
Find $S(10^8)$. | <p>Let $S(n) = \sum a + b + c$ over all triples $(a, b, c)$ such that:</p>
<ul style="list-style-type:disc;"><li>$a$, $b$ and $c$ are prime numbers.</li>
<li>$a \lt b \lt c \lt n$.</li>
<li>$a+1$, $b+1$, and $c+1$ form a <strong>geometric sequence</strong>.</li>
</ul><p>For example, $S(100) = 1035$ with the following triples: </p>
<p>$(2, 5, 11)$, $(2, 11, 47)$, $(5, 11, 23)$, $(5, 17, 53)$, $(7, 11, 17)$, $(7, 23, 71)$, $(11, 23, 47)$, $(17, 23, 31)$, $(17, 41, 97)$, $(31, 47, 71)$, $(71, 83, 97)$</p>
<p>Find $S(10^8)$.</p> | 100315739184392 | Saturday, 30th May 2015, 04:00 pm | 1764 | 20% | easy |
708 | Twos Are All You Need | A positive integer, $n$, is factorised into prime factors. We define $f(n)$ to be the product when each prime factor is replaced with $2$. In addition we define $f(1)=1$.
For example, $90 = 2\times 3\times 3\times 5$, then replacing the primes, $2\times 2\times 2\times 2 = 16$, hence $f(90) = 16$.
Let $\displaystyle S(N)=\sum_{n=1}^{N} f(n)$. You are given $S(10^8)=9613563919$.
Find $S(10^{14})$. | A positive integer, $n$, is factorised into prime factors. We define $f(n)$ to be the product when each prime factor is replaced with $2$. In addition we define $f(1)=1$.
For example, $90 = 2\times 3\times 3\times 5$, then replacing the primes, $2\times 2\times 2\times 2 = 16$, hence $f(90) = 16$.
Let $\displaystyle S(N)=\sum_{n=1}^{N} f(n)$. You are given $S(10^8)=9613563919$.
Find $S(10^{14})$. | <p>A positive integer, $n$, is factorised into prime factors. We define $f(n)$ to be the product when each prime factor is replaced with $2$. In addition we define $f(1)=1$.</p>
<p>For example, $90 = 2\times 3\times 3\times 5$, then replacing the primes, $2\times 2\times 2\times 2 = 16$, hence $f(90) = 16$.</p>
<p>Let $\displaystyle S(N)=\sum_{n=1}^{N} f(n)$. You are given $S(10^8)=9613563919$.</p>
<p>Find $S(10^{14})$.</p> | 28874142998632109 | Saturday, 28th March 2020, 01:00 pm | 348 | 50% | medium |
907 | Stacking Cups | An infant's toy consists of $n$ cups, labelled $C_1,\dots,C_n$ in increasing order of size.
The cups may be stacked in various combinations and orientations to form towers. The cups are shaped such that the following means of stacking are possible:
Nesting: $C_k$ may sit snugly inside $C_{k+1}$.
Base-to-base: $C_{k+2}$ or $C_{k-2}$ may sit, right-way-up, on top of an up-side-down $C_k$, with their bottoms fitting together snugly.
Rim-to-rim: $C_{k+2}$ or $C_{k-2}$ may sit, up-side-down, on top of a right-way-up $C_k$, with their tops fitting together snugly.
For the purposes of this problem, it is not permitted to stack both $C_{k+2}$ and $C_{k-2}$ rim-to-rim on top of $C_k$, despite the schematic diagrams appearing to allow it:
Define $S(n)$ to be the number of ways to build a single tower using all $n$ cups according to the above rules.
You are given $S(4)=12$, $S(8)=58$, and $S(20)=5560$.
Find $S(10^7)$, giving your answer modulo $1\,000\,000\,007$. | An infant's toy consists of $n$ cups, labelled $C_1,\dots,C_n$ in increasing order of size.
The cups may be stacked in various combinations and orientations to form towers. The cups are shaped such that the following means of stacking are possible:
Nesting: $C_k$ may sit snugly inside $C_{k+1}$.
Base-to-base: $C_{k+2}$ or $C_{k-2}$ may sit, right-way-up, on top of an up-side-down $C_k$, with their bottoms fitting together snugly.
Rim-to-rim: $C_{k+2}$ or $C_{k-2}$ may sit, up-side-down, on top of a right-way-up $C_k$, with their tops fitting together snugly.
For the purposes of this problem, it is not permitted to stack both $C_{k+2}$ and $C_{k-2}$ rim-to-rim on top of $C_k$, despite the schematic diagrams appearing to allow it:
Define $S(n)$ to be the number of ways to build a single tower using all $n$ cups according to the above rules.
You are given $S(4)=12$, $S(8)=58$, and $S(20)=5560$.
Find $S(10^7)$, giving your answer modulo $1\,000\,000\,007$. | <p>
An infant's toy consists of $n$ cups, labelled $C_1,\dots,C_n$ in increasing order of size.
</p>
<img alt="0907_four_cups.png" height="162" src="resources/images/0907_four_cups.png?1723769212"/>
<p>
The cups may be stacked in various combinations and orientations to form towers. The cups are shaped such that the following means of stacking are possible:
</p>
<ul>
<li>Nesting: $C_k$ may sit snugly inside $C_{k+1}$.<br/>
<img alt="0907_nesting.png" height="150" src="resources/images/0907_nesting.png?1723769266"/>
</li>
<li>Base-to-base: $C_{k+2}$ or $C_{k-2}$ may sit, right-way-up, on top of an up-side-down $C_k$, with their bottoms fitting together snugly.<br/>
<img alt="0907_base_to_base.png" height="198" src="resources/images/0907_base_to_base.png?1723769276"/>
</li>
<li>Rim-to-rim: $C_{k+2}$ or $C_{k-2}$ may sit, up-side-down, on top of a right-way-up $C_k$, with their tops fitting together snugly.<br/>
<img alt="0907_rim_to_rim.png" height="198" src="resources/images/0907_rim_to_rim.png?1723769283"/>
</li>
<li>For the purposes of this problem, it is <b>not</b> permitted to stack <b>both</b> $C_{k+2}$ and $C_{k-2}$ rim-to-rim on top of $C_k$, despite the schematic diagrams appearing to allow it:<br/>
<img alt="0907_rim_to_rim_counter_example.png" height="267" src="resources/images/0907_rim_to_rim_counter_example.png?1740699245"/><br/>
</li></ul>
<p>
Define $S(n)$ to be the number of ways to build a single tower using all $n$ cups according to the above rules.<br/>
You are given $S(4)=12$, $S(8)=58$, and $S(20)=5560$.
</p>
<p>
Find $S(10^7)$, giving your answer modulo $1\,000\,000\,007$.
</p> | 196808901 | Saturday, 14th September 2024, 11:00 pm | 257 | 35% | medium |
296 | Angular Bisector and Tangent | Given is an integer sided triangle $ABC$ with $BC \le AC \le AB$.$k$ is the angular bisector of angle $ACB$.$m$ is the tangent at $C$ to the circumscribed circle of $ABC$.$n$ is a line parallel to $m$ through $B$.
The intersection of $n$ and $k$ is called $E$.
How many triangles $ABC$ with a perimeter not exceeding $100\,000$ exist such that $BE$ has integral length? | Given is an integer sided triangle $ABC$ with $BC \le AC \le AB$.$k$ is the angular bisector of angle $ACB$.$m$ is the tangent at $C$ to the circumscribed circle of $ABC$.$n$ is a line parallel to $m$ through $B$.
The intersection of $n$ and $k$ is called $E$.
How many triangles $ABC$ with a perimeter not exceeding $100\,000$ exist such that $BE$ has integral length? | <p>
Given is an integer sided triangle $ABC$ with $BC \le AC \le AB$.<br/>$k$ is the angular bisector of angle $ACB$.<br/>$m$ is the tangent at $C$ to the circumscribed circle of $ABC$.<br/>$n$ is a line parallel to $m$ through $B$.<br/>
The intersection of $n$ and $k$ is called $E$.
</p>
<div align="center"><img alt="0296_bisector.gif" class="dark_img" src="resources/images/0296_bisector.gif?1678992056"/></div>
<p>
How many triangles $ABC$ with a perimeter not exceeding $100\,000$ exist such that $BE$ has integral length?
</p> | 1137208419 | Friday, 11th June 2010, 01:00 pm | 668 | 60% | hard |
424 | Kakuro | The above is an example of a cryptic kakuro (also known as cross sums, or even sums cross) puzzle, with its final solution on the right. (The common rules of kakuro puzzles can be found easily on numerous internet sites. Other related information can also be currently found at krazydad.com whose author has provided the puzzle data for this challenge.)
The downloadable text file (kakuro200.txt) contains the description of 200 such puzzles, a mix of 5x5 and 6x6 types. The first puzzle in the file is the above example which is coded as follows:
6,X,X,(vCC),(vI),X,X,X,(hH),B,O,(vCA),(vJE),X,(hFE,vD),O,O,O,O,(hA),O,I,(hJC,vB),O,O,(hJC),H,O,O,O,X,X,X,(hJE),O,O,X
The first character is a numerical digit indicating the size of the information grid. It would be either a 6 (for a 5x5 kakuro puzzle) or a 7 (for a 6x6 puzzle) followed by a comma (,). The extra top line and left column are needed to insert information.
The content of each cell is then described and followed by a comma, going left to right and starting with the top line.
X = Gray cell, not required to be filled by a digit.
O (upper case letter)= White empty cell to be filled by a digit.
A = Or any one of the upper case letters from A to J to be replaced by its equivalent digit in the solved puzzle.
( ) = Location of the encrypted sums. Horizontal sums are preceded by a lower case "h" and vertical sums are preceded by a lower case "v". Those are followed by one or two upper case letters depending if the sum is a single digit or double digit one. For double digit sums, the first letter would be for the "tens" and the second one for the "units". When the cell must contain information for both a horizontal and a vertical sum, the first one is always for the horizontal sum and the two are separated by a comma within the same set of brackets, ex.: (hFE,vD). Each set of brackets is also immediately followed by a comma.
The description of the last cell is followed by a Carriage Return/Line Feed (CRLF) instead of a comma.
The required answer to each puzzle is based on the value of each letter necessary to arrive at the solution and according to the alphabetical order. As indicated under the example puzzle, its answer would be 8426039571. At least 9 out of the 10 encrypting letters are always part of the problem description. When only 9 are given, the missing one must be assigned the remaining digit.
You are given that the sum of the answers for the first 10 puzzles in the file is 64414157580.
Find the sum of the answers for the 200 puzzles. | The above is an example of a cryptic kakuro (also known as cross sums, or even sums cross) puzzle, with its final solution on the right. (The common rules of kakuro puzzles can be found easily on numerous internet sites. Other related information can also be currently found at krazydad.com whose author has provided the puzzle data for this challenge.)
The downloadable text file (kakuro200.txt) contains the description of 200 such puzzles, a mix of 5x5 and 6x6 types. The first puzzle in the file is the above example which is coded as follows:
6,X,X,(vCC),(vI),X,X,X,(hH),B,O,(vCA),(vJE),X,(hFE,vD),O,O,O,O,(hA),O,I,(hJC,vB),O,O,(hJC),H,O,O,O,X,X,X,(hJE),O,O,X
The first character is a numerical digit indicating the size of the information grid. It would be either a 6 (for a 5x5 kakuro puzzle) or a 7 (for a 6x6 puzzle) followed by a comma (,). The extra top line and left column are needed to insert information.
The content of each cell is then described and followed by a comma, going left to right and starting with the top line.
X = Gray cell, not required to be filled by a digit.
O (upper case letter)= White empty cell to be filled by a digit.
A = Or any one of the upper case letters from A to J to be replaced by its equivalent digit in the solved puzzle.
( ) = Location of the encrypted sums. Horizontal sums are preceded by a lower case "h" and vertical sums are preceded by a lower case "v". Those are followed by one or two upper case letters depending if the sum is a single digit or double digit one. For double digit sums, the first letter would be for the "tens" and the second one for the "units". When the cell must contain information for both a horizontal and a vertical sum, the first one is always for the horizontal sum and the two are separated by a comma within the same set of brackets, ex.: (hFE,vD). Each set of brackets is also immediately followed by a comma.
The description of the last cell is followed by a Carriage Return/Line Feed (CRLF) instead of a comma.
The required answer to each puzzle is based on the value of each letter necessary to arrive at the solution and according to the alphabetical order. As indicated under the example puzzle, its answer would be 8426039571. At least 9 out of the 10 encrypting letters are always part of the problem description. When only 9 are given, the missing one must be assigned the remaining digit.
You are given that the sum of the answers for the first 10 puzzles in the file is 64414157580.
Find the sum of the answers for the 200 puzzles. | <div class="center"><img alt="p424_kakuro1.gif" class="dark_img" src="project/images/p424_kakuro1.gif"/></div>
<p>The above is an example of a cryptic kakuro (also known as cross sums, or even sums cross) puzzle, with its final solution on the right. (The common rules of kakuro puzzles can be found easily on numerous internet sites. Other related information can also be currently found at <a href="http://krazydad.com/">krazydad.com</a> whose author has provided the puzzle data for this challenge.)</p>
<p>The downloadable text file (<a href="project/resources/p424_kakuro200.txt">kakuro200.txt</a>) contains the description of 200 such puzzles, a mix of 5x5 and 6x6 types. The first puzzle in the file is the above example which is coded as follows:</p>
<p>6,X,X,(vCC),(vI),X,X,X,(hH),B,O,(vCA),(vJE),X,(hFE,vD),O,O,O,O,(hA),O,I,(hJC,vB),O,O,(hJC),H,O,O,O,X,X,X,(hJE),O,O,X</p>
<p>The first character is a numerical digit indicating the size of the information grid. It would be either a 6 (for a 5x5 kakuro puzzle) or a 7 (for a 6x6 puzzle) followed by a comma (,). The extra top line and left column are needed to insert information.</p>
<p>The content of each cell is then described and followed by a comma, going left to right and starting with the top line.<br>
X = Gray cell, not required to be filled by a digit.<br/>
O (upper case letter)= White empty cell to be filled by a digit.<br/>
A = Or any one of the upper case letters from A to J to be replaced by its equivalent digit in the solved puzzle.<br/>
( ) = Location of the encrypted sums. Horizontal sums are preceded by a lower case "h" and vertical sums are preceded by a lower case "v". Those are followed by one or two upper case letters depending if the sum is a single digit or double digit one. For double digit sums, the first letter would be for the "tens" and the second one for the "units". When the cell must contain information for both a horizontal and a vertical sum, the first one is always for the horizontal sum and the two are separated by a comma within the same set of brackets, ex.: (hFE,vD). Each set of brackets is also immediately followed by a comma.</br></p>
<p>The description of the last cell is followed by a Carriage Return/Line Feed (CRLF) instead of a comma.</p>
<p>The required answer to each puzzle is based on the value of each letter necessary to arrive at the solution and according to the alphabetical order. As indicated under the example puzzle, its answer would be 8426039571. At least 9 out of the 10 encrypting letters are always part of the problem description. When only 9 are given, the missing one must be assigned the remaining digit.</p>
<p>You are given that the sum of the answers for the first 10 puzzles in the file is 64414157580.</p>
<p>Find the sum of the answers for the 200 puzzles.</p> | 1059760019628 | Saturday, 20th April 2013, 01:00 pm | 452 | 60% | hard |
119 | Digit Power Sum | The number $512$ is interesting because it is equal to the sum of its digits raised to some power: $5 + 1 + 2 = 8$, and $8^3 = 512$. Another example of a number with this property is $614656 = 28^4$.
We shall define $a_n$ to be the $n$th term of this sequence and insist that a number must contain at least two digits to have a sum.
You are given that $a_2 = 512$ and $a_{10} = 614656$.
Find $a_{30}$. | The number $512$ is interesting because it is equal to the sum of its digits raised to some power: $5 + 1 + 2 = 8$, and $8^3 = 512$. Another example of a number with this property is $614656 = 28^4$.
We shall define $a_n$ to be the $n$th term of this sequence and insist that a number must contain at least two digits to have a sum.
You are given that $a_2 = 512$ and $a_{10} = 614656$.
Find $a_{30}$. | <p>The number $512$ is interesting because it is equal to the sum of its digits raised to some power: $5 + 1 + 2 = 8$, and $8^3 = 512$. Another example of a number with this property is $614656 = 28^4$.</p>
<p>We shall define $a_n$ to be the $n$th term of this sequence and insist that a number must contain at least two digits to have a sum.</p>
<p>You are given that $a_2 = 512$ and $a_{10} = 614656$.</p>
<p>Find $a_{30}$.</p> | 248155780267521 | Friday, 7th April 2006, 06:00 pm | 13664 | 30% | easy |
338 | Cutting Rectangular Grid Paper | A rectangular sheet of grid paper with integer dimensions $w \times h$ is given. Its grid spacing is $1$.
When we cut the sheet along the grid lines into two pieces and rearrange those pieces without overlap, we can make new rectangles with different dimensions.
For example, from a sheet with dimensions $9 \times 4$, we can make rectangles with dimensions $18 \times 2$, $12 \times 3$ and $6 \times 6$ by cutting and rearranging as below:
Similarly, from a sheet with dimensions $9 \times 8$, we can make rectangles with dimensions $18 \times 4$ and $12 \times 6$.
For a pair $w$ and $h$, let $F(w, h)$ be the number of distinct rectangles that can be made from a sheet with dimensions $w \times h$.
For example, $F(2,1) = 0$, $F(2,2) = 1$, $F(9,4) = 3$ and $F(9,8) = 2$.
Note that rectangles congruent to the initial one are not counted in $F(w, h)$.
Note also that rectangles with dimensions $w \times h$ and dimensions $h \times w$ are not considered distinct.
For an integer $N$, let $G(N)$ be the sum of $F(w, h)$ for all pairs $w$ and $h$ which satisfy $0 \lt h \le w \le N$.
We can verify that $G(10) = 55$, $G(10^3) = 971745$ and $G(10^5) = 9992617687$.
Find $G(10^{12})$. Give your answer modulo $10^8$. | A rectangular sheet of grid paper with integer dimensions $w \times h$ is given. Its grid spacing is $1$.
When we cut the sheet along the grid lines into two pieces and rearrange those pieces without overlap, we can make new rectangles with different dimensions.
For example, from a sheet with dimensions $9 \times 4$, we can make rectangles with dimensions $18 \times 2$, $12 \times 3$ and $6 \times 6$ by cutting and rearranging as below:
Similarly, from a sheet with dimensions $9 \times 8$, we can make rectangles with dimensions $18 \times 4$ and $12 \times 6$.
For a pair $w$ and $h$, let $F(w, h)$ be the number of distinct rectangles that can be made from a sheet with dimensions $w \times h$.
For example, $F(2,1) = 0$, $F(2,2) = 1$, $F(9,4) = 3$ and $F(9,8) = 2$.
Note that rectangles congruent to the initial one are not counted in $F(w, h)$.
Note also that rectangles with dimensions $w \times h$ and dimensions $h \times w$ are not considered distinct.
For an integer $N$, let $G(N)$ be the sum of $F(w, h)$ for all pairs $w$ and $h$ which satisfy $0 \lt h \le w \le N$.
We can verify that $G(10) = 55$, $G(10^3) = 971745$ and $G(10^5) = 9992617687$.
Find $G(10^{12})$. Give your answer modulo $10^8$. | <p>A rectangular sheet of grid paper with integer dimensions $w \times h$ is given. Its grid spacing is $1$.<br/>
When we cut the sheet along the grid lines into two pieces and rearrange those pieces without overlap, we can make new rectangles with different dimensions.</p>
<p>For example, from a sheet with dimensions $9 \times 4$, we can make rectangles with dimensions $18 \times 2$, $12 \times 3$ and $6 \times 6$ by cutting and rearranging as below:</p>
<div align="center">
<img alt="0338_gridpaper.gif" src="resources/images/0338_gridpaper.gif?1678992056"/><br/></div>
<p>Similarly, from a sheet with dimensions $9 \times 8$, we can make rectangles with dimensions $18 \times 4$ and $12 \times 6$.</p>
<p>For a pair $w$ and $h$, let $F(w, h)$ be the number of distinct rectangles that can be made from a sheet with dimensions $w \times h$.<br/>
For example, $F(2,1) = 0$, $F(2,2) = 1$, $F(9,4) = 3$ and $F(9,8) = 2$. <br/>
Note that rectangles congruent to the initial one are not counted in $F(w, h)$.<br/>
Note also that rectangles with dimensions $w \times h$ and dimensions $h \times w$ are not considered distinct.</p>
<p>For an integer $N$, let $G(N)$ be the sum of $F(w, h)$ for all pairs $w$ and $h$ which satisfy $0 \lt h \le w \le N$.<br/>
We can verify that $G(10) = 55$, $G(10^3) = 971745$ and $G(10^5) = 9992617687$.</p>
<p>Find $G(10^{12})$. Give your answer modulo $10^8$.</p> | 15614292 | Sunday, 15th May 2011, 01:00 am | 371 | 95% | hard |
874 | Maximal Prime Score | Let $p(t)$ denote the $(t+1)$th prime number. So that $p(0) = 2$, $p(1) = 3$, etc.
We define the prime score of a list of nonnegative integers $[a_1, \dots, a_n]$ as the sum $\sum_{i = 1}^n p(a_i)$.
Let $M(k, n)$ be the maximal prime score among all lists $[a_1, \dots, a_n]$ such that:
$0 \leq a_i < k$ for each $i$;
the sum $\sum_{i = 1}^n a_i$ is a multiple of $k$.
For example, $M(2, 5) = 14$ as $[0, 1, 1, 1, 1]$ attains a maximal prime score of $14$.
Find $M(7000, p(7000))$. | Let $p(t)$ denote the $(t+1)$th prime number. So that $p(0) = 2$, $p(1) = 3$, etc.
We define the prime score of a list of nonnegative integers $[a_1, \dots, a_n]$ as the sum $\sum_{i = 1}^n p(a_i)$.
Let $M(k, n)$ be the maximal prime score among all lists $[a_1, \dots, a_n]$ such that:
$0 \leq a_i < k$ for each $i$;
the sum $\sum_{i = 1}^n a_i$ is a multiple of $k$.
For example, $M(2, 5) = 14$ as $[0, 1, 1, 1, 1]$ attains a maximal prime score of $14$.
Find $M(7000, p(7000))$. | <p>
Let $p(t)$ denote the $(t+1)$th prime number. So that $p(0) = 2$, $p(1) = 3$, etc.<br/>
We define the <dfn>prime score</dfn> of a list of nonnegative integers $[a_1, \dots, a_n]$ as the sum $\sum_{i = 1}^n p(a_i)$.<br/>
Let $M(k, n)$ be the maximal prime score among all lists $[a_1, \dots, a_n]$ such that:</p>
<ul>
<li> $0 \leq a_i < k$ for each $i$;
</li><li> the sum $\sum_{i = 1}^n a_i$ is a multiple of $k$.
</li></ul>
<p>
For example, $M(2, 5) = 14$ as $[0, 1, 1, 1, 1]$ attains a maximal prime score of $14$.</p>
<p>
Find $M(7000, p(7000))$.</p> | 4992775389 | Sunday, 28th January 2024, 04:00 am | 538 | 15% | easy |
216 | The Primality of $2n^2 - 1$ | Consider numbers $t(n)$ of the form $t(n) = 2n^2 - 1$ with $n \gt 1$.
The first such numbers are $7, 17, 31, 49, 71, 97, 127$ and $161$.
It turns out that only $49 = 7 \cdot 7$ and $161 = 7 \cdot 23$ are not prime.
For $n \le 10000$ there are $2202$ numbers $t(n)$ that are prime.
How many numbers $t(n)$ are prime for $n \le 50\,000\,000$? | Consider numbers $t(n)$ of the form $t(n) = 2n^2 - 1$ with $n \gt 1$.
The first such numbers are $7, 17, 31, 49, 71, 97, 127$ and $161$.
It turns out that only $49 = 7 \cdot 7$ and $161 = 7 \cdot 23$ are not prime.
For $n \le 10000$ there are $2202$ numbers $t(n)$ that are prime.
How many numbers $t(n)$ are prime for $n \le 50\,000\,000$? | <p>Consider numbers $t(n)$ of the form $t(n) = 2n^2 - 1$ with $n \gt 1$.<br/>
The first such numbers are $7, 17, 31, 49, 71, 97, 127$ and $161$.<br/>
It turns out that only $49 = 7 \cdot 7$ and $161 = 7 \cdot 23$ are not prime.<br/>
For $n \le 10000$ there are $2202$ numbers $t(n)$ that are prime.</p>
<p>How many numbers $t(n)$ are prime for $n \le 50\,000\,000$?</p> | 5437849 | Friday, 7th November 2008, 05:00 pm | 4604 | 45% | medium |
850 | Fractions of Powers | Any positive real number $x$ can be decomposed into integer and fractional parts $\lfloor x \rfloor + \{x\}$, where $\lfloor x \rfloor$ (the floor function) is an integer, and $0\le \{x\} < 1$.
For positive integers $k$ and $n$, define the function
\begin{align}
f_k(n) = \sum_{i=1}^{n}\left\{ \frac{i^k}{n} \right\}
\end{align}
For example, $f_5(10)=4.5$ and $f_7(1234)=616.5$.
Let
\begin{align}
S(N) = \sum_{\substack{k=1 \\ k\text{ odd}}}^{N} \sum_{n=1}^{N} f_k(n)
\end{align}
You are given that $S(10)=100.5$ and $S(10^3)=123687804$.
Find $\lfloor S(33557799775533) \rfloor$. Give your answer modulo 977676779. | Any positive real number $x$ can be decomposed into integer and fractional parts $\lfloor x \rfloor + \{x\}$, where $\lfloor x \rfloor$ (the floor function) is an integer, and $0\le \{x\} < 1$.
For positive integers $k$ and $n$, define the function
\begin{align}
f_k(n) = \sum_{i=1}^{n}\left\{ \frac{i^k}{n} \right\}
\end{align}
For example, $f_5(10)=4.5$ and $f_7(1234)=616.5$.
Let
\begin{align}
S(N) = \sum_{\substack{k=1 \\ k\text{ odd}}}^{N} \sum_{n=1}^{N} f_k(n)
\end{align}
You are given that $S(10)=100.5$ and $S(10^3)=123687804$.
Find $\lfloor S(33557799775533) \rfloor$. Give your answer modulo 977676779. | <p>Any positive real number $x$ can be decomposed into integer and fractional parts $\lfloor x \rfloor + \{x\}$, where $\lfloor x \rfloor$ (the floor function) is an integer, and $0\le \{x\} < 1$.</p>
<p>For positive integers $k$ and $n$, define the function
\begin{align}
f_k(n) = \sum_{i=1}^{n}\left\{ \frac{i^k}{n} \right\}
\end{align}
For example, $f_5(10)=4.5$ and $f_7(1234)=616.5$.</p>
<p>Let
\begin{align}
S(N) = \sum_{\substack{k=1 \\ k\text{ odd}}}^{N} \sum_{n=1}^{N} f_k(n)
\end{align}
You are given that $S(10)=100.5$ and $S(10^3)=123687804$.</p>
<p>Find $\lfloor S(33557799775533) \rfloor$. Give your answer modulo 977676779.</p> | 878255725 | Sunday, 2nd July 2023, 08:00 am | 134 | 85% | hard |
55 | Lychrel Numbers | If we take $47$, reverse and add, $47 + 74 = 121$, which is palindromic.
Not all numbers produce palindromes so quickly. For example,
\begin{align}
349 + 943 &= 1292\\
1292 + 2921 &= 4213\\
4213 + 3124 &= 7337
\end{align}
That is, $349$ took three iterations to arrive at a palindrome.
Although no one has proved it yet, it is thought that some numbers, like $196$, never produce a palindrome. A number that never forms a palindrome through the reverse and add process is called a Lychrel number. Due to the theoretical nature of these numbers, and for the purpose of this problem, we shall assume that a number is Lychrel until proven otherwise. In addition you are given that for every number below ten-thousand, it will either (i) become a palindrome in less than fifty iterations, or, (ii) no one, with all the computing power that exists, has managed so far to map it to a palindrome. In fact, $10677$ is the first number to be shown to require over fifty iterations before producing a palindrome: $4668731596684224866951378664$ ($53$ iterations, $28$-digits).
Surprisingly, there are palindromic numbers that are themselves Lychrel numbers; the first example is $4994$.
How many Lychrel numbers are there below ten-thousand?
NOTE: Wording was modified slightly on 24 April 2007 to emphasise the theoretical nature of Lychrel numbers. | If we take $47$, reverse and add, $47 + 74 = 121$, which is palindromic.
Not all numbers produce palindromes so quickly. For example,
\begin{align}
349 + 943 &= 1292\\
1292 + 2921 &= 4213\\
4213 + 3124 &= 7337
\end{align}
That is, $349$ took three iterations to arrive at a palindrome.
Although no one has proved it yet, it is thought that some numbers, like $196$, never produce a palindrome. A number that never forms a palindrome through the reverse and add process is called a Lychrel number. Due to the theoretical nature of these numbers, and for the purpose of this problem, we shall assume that a number is Lychrel until proven otherwise. In addition you are given that for every number below ten-thousand, it will either (i) become a palindrome in less than fifty iterations, or, (ii) no one, with all the computing power that exists, has managed so far to map it to a palindrome. In fact, $10677$ is the first number to be shown to require over fifty iterations before producing a palindrome: $4668731596684224866951378664$ ($53$ iterations, $28$-digits).
Surprisingly, there are palindromic numbers that are themselves Lychrel numbers; the first example is $4994$.
How many Lychrel numbers are there below ten-thousand?
NOTE: Wording was modified slightly on 24 April 2007 to emphasise the theoretical nature of Lychrel numbers. | <p>If we take $47$, reverse and add, $47 + 74 = 121$, which is palindromic.</p>
<p>Not all numbers produce palindromes so quickly. For example,</p>
\begin{align}
349 + 943 &= 1292\\
1292 + 2921 &= 4213\\
4213 + 3124 &= 7337
\end{align}
<p>That is, $349$ took three iterations to arrive at a palindrome.</p>
<p>Although no one has proved it yet, it is thought that some numbers, like $196$, never produce a palindrome. A number that never forms a palindrome through the reverse and add process is called a Lychrel number. Due to the theoretical nature of these numbers, and for the purpose of this problem, we shall assume that a number is Lychrel until proven otherwise. In addition you are given that for every number below ten-thousand, it will either (i) become a palindrome in less than fifty iterations, or, (ii) no one, with all the computing power that exists, has managed so far to map it to a palindrome. In fact, $10677$ is the first number to be shown to require over fifty iterations before producing a palindrome: $4668731596684224866951378664$ ($53$ iterations, $28$-digits).</p>
<p>Surprisingly, there are palindromic numbers that are themselves Lychrel numbers; the first example is $4994$.</p>
<p>How many Lychrel numbers are there below ten-thousand?</p>
<p class="smaller">NOTE: Wording was modified slightly on 24 April 2007 to emphasise the theoretical nature of Lychrel numbers.</p> | 249 | Friday, 24th October 2003, 06:00 pm | 58786 | 5% | easy |
558 | Irrational Base | Let $r$ be the real root of the equation $x^3 = x^2 + 1$.
Every positive integer can be written as the sum of distinct increasing powers of $r$.
If we require the number of terms to be finite and the difference between any two exponents to be three or more, then the representation is unique.
For example, $3 = r^{-10} + r^{-5} + r^{-1} + r^2$ and $10 = r^{-10} + r^{-7} + r^6$.
Interestingly, the relation holds for the complex roots of the equation.
Let $w(n)$ be the number of terms in this unique representation of $n$. Thus $w(3) = 4$ and $w(10) = 3$.
More formally, for all positive integers $n$, we have:
$n = \displaystyle \sum_{k=-\infty}^\infty b_k r^k$
under the conditions that:
$b_k$ is $0$ or $1$ for all $k$;
$b_k + b_{k + 1} + b_{k + 2} \le 1$ for all $k$;
$w(n) = \displaystyle \sum_{k=-\infty}^\infty b_k$ is finite.
Let $S(m) = \displaystyle \sum_{j=1}^m w(j^2)$.
You are given $S(10) = 61$ and $S(1000) = 19403$.
Find $S(5\,000\,000)$. | Let $r$ be the real root of the equation $x^3 = x^2 + 1$.
Every positive integer can be written as the sum of distinct increasing powers of $r$.
If we require the number of terms to be finite and the difference between any two exponents to be three or more, then the representation is unique.
For example, $3 = r^{-10} + r^{-5} + r^{-1} + r^2$ and $10 = r^{-10} + r^{-7} + r^6$.
Interestingly, the relation holds for the complex roots of the equation.
Let $w(n)$ be the number of terms in this unique representation of $n$. Thus $w(3) = 4$ and $w(10) = 3$.
More formally, for all positive integers $n$, we have:
$n = \displaystyle \sum_{k=-\infty}^\infty b_k r^k$
under the conditions that:
$b_k$ is $0$ or $1$ for all $k$;
$b_k + b_{k + 1} + b_{k + 2} \le 1$ for all $k$;
$w(n) = \displaystyle \sum_{k=-\infty}^\infty b_k$ is finite.
Let $S(m) = \displaystyle \sum_{j=1}^m w(j^2)$.
You are given $S(10) = 61$ and $S(1000) = 19403$.
Find $S(5\,000\,000)$. | <p>Let $r$ be the real root of the equation $x^3 = x^2 + 1$.<br/>
Every positive integer can be written as the sum of distinct increasing powers of $r$.<br/>
If we require the number of terms to be finite and the difference between any two exponents to be three or more, then the representation is unique.<br/>
For example, $3 = r^{-10} + r^{-5} + r^{-1} + r^2$ and $10 = r^{-10} + r^{-7} + r^6$.<br/>
Interestingly, the relation holds for the complex roots of the equation.</p>
<p>Let $w(n)$ be the number of terms in this unique representation of $n$. Thus $w(3) = 4$ and $w(10) = 3$.</p>
<p>More formally, for all positive integers $n$, we have:<br/>
$n = \displaystyle \sum_{k=-\infty}^\infty b_k r^k$<br/>
under the conditions that:<br/>
$b_k$ is $0$ or $1$ for all $k$;<br/>
$b_k + b_{k + 1} + b_{k + 2} \le 1$ for all $k$;<br/>
$w(n) = \displaystyle \sum_{k=-\infty}^\infty b_k$ is finite.</p>
<p>Let $S(m) = \displaystyle \sum_{j=1}^m w(j^2)$.<br/>
You are given $S(10) = 61$ and $S(1000) = 19403$.</p>
<p>Find $S(5\,000\,000)$.</p> | 226754889 | Saturday, 30th April 2016, 01:00 pm | 275 | 65% | hard |
842 | Irregular Star Polygons | Given $n$ equally spaced points on a circle, we define an $n$-star polygon as an $n$-gon having those $n$ points as vertices. Two $n$-star polygons differing by a rotation/reflection are considered different.
For example, there are twelve $5$-star polygons shown below.
For an $n$-star polygon $S$, let $I(S)$ be the number of its self intersection points.
Let $T(n)$ be the sum of $I(S)$ over all $n$-star polygons $S$.
For the example above $T(5) = 20$ because in total there are $20$ self intersection points.
Some star polygons may have intersection points made from more than two lines. These are only counted once. For example, $S$, shown below is one of the sixty $6$-star polygons. This one has $I(S) = 4$.
You are also given that $T(8) = 14640$.
Find $\displaystyle \sum_{n = 3}^{60}T(n)$. Give your answer modulo $(10^9 + 7)$. | Given $n$ equally spaced points on a circle, we define an $n$-star polygon as an $n$-gon having those $n$ points as vertices. Two $n$-star polygons differing by a rotation/reflection are considered different.
For example, there are twelve $5$-star polygons shown below.
For an $n$-star polygon $S$, let $I(S)$ be the number of its self intersection points.
Let $T(n)$ be the sum of $I(S)$ over all $n$-star polygons $S$.
For the example above $T(5) = 20$ because in total there are $20$ self intersection points.
Some star polygons may have intersection points made from more than two lines. These are only counted once. For example, $S$, shown below is one of the sixty $6$-star polygons. This one has $I(S) = 4$.
You are also given that $T(8) = 14640$.
Find $\displaystyle \sum_{n = 3}^{60}T(n)$. Give your answer modulo $(10^9 + 7)$. | <p>
Given $n$ equally spaced points on a circle, we define an <dfn>$n$-star polygon</dfn> as an $n$-gon having those $n$ points as vertices. Two $n$-star polygons differing by a rotation/reflection are considered <b>different</b>.</p>
<p>
For example, there are twelve $5$-star polygons shown below.</p>
<img alt="0842_5-agons.jpg" src="resources/images/0842_5-agons.jpg?1680461480"/>
<p>
For an $n$-star polygon $S$, let $I(S)$ be the number of its self intersection points.<br/>
Let $T(n)$ be the sum of $I(S)$ over all $n$-star polygons $S$.<br/>
For the example above $T(5) = 20$ because in total there are $20$ self intersection points.</p>
<p>
Some star polygons may have intersection points made from more than two lines. These are only counted once. For example, <span style="white-space:nowrap;">$S$,</span> shown below is one of the sixty $6$-star polygons. This one has $I(S) = 4$.</p>
<img alt="0842_6-agon.jpg" src="resources/images/0842_6-agon.jpg?1680461493"/>
<p>
You are also given that $T(8) = 14640$.</p>
<p>
Find $\displaystyle \sum_{n = 3}^{60}T(n)$. Give your answer modulo $(10^9 + 7)$.</p> | 885226002 | Sunday, 7th May 2023, 08:00 am | 135 | 75% | hard |
775 | Saving Paper | When wrapping several cubes in paper, it is more efficient to wrap them all together than to wrap each one individually. For example, with 10 cubes of unit edge length, it would take 30 units of paper to wrap them in the arrangement shown below, but 60 units to wrap them separately.
Define $g(n)$ to be the maximum amount of paper that can be saved by wrapping $n$ identical $1\times 1\times 1$ cubes in a compact arrangement, compared with wrapping them individually. We insist that the wrapping paper is in contact with the cubes at all points, without leaving a void.
With 10 cubes, the arrangement illustrated above is optimal, so $g(10)=60-30=30$. With 18 cubes, it can be shown that the optimal arrangement is as a $3\times 3\times 2$, using 42 units of paper, whereas wrapping individually would use 108 units of paper; hence $g(18) = 66$.
Define
$$G(N) = \sum_{n=1}^N g(n)$$
You are given that $G(18) = 530$, and $G(10^6) \equiv 951640919 \pmod {1\,000\,000\,007}$.
Find $G(10^{16})$. Give your answer modulo $1\,000\,000\,007$. | When wrapping several cubes in paper, it is more efficient to wrap them all together than to wrap each one individually. For example, with 10 cubes of unit edge length, it would take 30 units of paper to wrap them in the arrangement shown below, but 60 units to wrap them separately.
Define $g(n)$ to be the maximum amount of paper that can be saved by wrapping $n$ identical $1\times 1\times 1$ cubes in a compact arrangement, compared with wrapping them individually. We insist that the wrapping paper is in contact with the cubes at all points, without leaving a void.
With 10 cubes, the arrangement illustrated above is optimal, so $g(10)=60-30=30$. With 18 cubes, it can be shown that the optimal arrangement is as a $3\times 3\times 2$, using 42 units of paper, whereas wrapping individually would use 108 units of paper; hence $g(18) = 66$.
Define
$$G(N) = \sum_{n=1}^N g(n)$$
You are given that $G(18) = 530$, and $G(10^6) \equiv 951640919 \pmod {1\,000\,000\,007}$.
Find $G(10^{16})$. Give your answer modulo $1\,000\,000\,007$. | <p>When wrapping several cubes in paper, it is more efficient to wrap them all together than to wrap each one individually. For example, with 10 cubes of unit edge length, it would take 30 units of paper to wrap them in the arrangement shown below, but 60 units to wrap them separately.</p>
<div style="text-align:center;">
<img alt="" class="dark_img" src="project/images/p775_wrapping_cubes.png"/></div>
<p>Define $g(n)$ to be the maximum amount of paper that can be saved by wrapping $n$ identical $1\times 1\times 1$ cubes in a compact arrangement, compared with wrapping them individually. We insist that the wrapping paper is in contact with the cubes at all points, without leaving a void.</p>
<p>With 10 cubes, the arrangement illustrated above is optimal, so $g(10)=60-30=30$. With 18 cubes, it can be shown that the optimal arrangement is as a $3\times 3\times 2$, using 42 units of paper, whereas wrapping individually would use 108 units of paper; hence $g(18) = 66$.</p>
<p>Define
$$G(N) = \sum_{n=1}^N g(n)$$
You are given that $G(18) = 530$, and $G(10^6) \equiv 951640919 \pmod {1\,000\,000\,007}$.</p>
<p>Find $G(10^{16})$. Give your answer modulo $1\,000\,000\,007$.</p> | 946791106 | Sunday, 5th December 2021, 01:00 am | 260 | 40% | medium |
827 | Pythagorean Triple Occurrence | Define $Q(n)$ to be the smallest number that occurs in exactly $n$ Pythagorean triples $(a,b,c)$ where $a \lt b \lt c$.
For example, $15$ is the smallest number occurring in exactly $5$ Pythagorean triples:
$$(9,12,\mathbf{15})\quad (8,\mathbf{15},17)\quad (\mathbf{15},20,25)\quad (\mathbf{15},36,39)\quad (\mathbf{15},112,113)$$
and so $Q(5) = 15$.
You are also given $Q(10)=48$ and $Q(10^3)=8064000$.
Find $\displaystyle \sum_{k=1}^{18} Q(10^k)$. Give your answer modulo $409120391$. | Define $Q(n)$ to be the smallest number that occurs in exactly $n$ Pythagorean triples $(a,b,c)$ where $a \lt b \lt c$.
For example, $15$ is the smallest number occurring in exactly $5$ Pythagorean triples:
$$(9,12,\mathbf{15})\quad (8,\mathbf{15},17)\quad (\mathbf{15},20,25)\quad (\mathbf{15},36,39)\quad (\mathbf{15},112,113)$$
and so $Q(5) = 15$.
You are also given $Q(10)=48$ and $Q(10^3)=8064000$.
Find $\displaystyle \sum_{k=1}^{18} Q(10^k)$. Give your answer modulo $409120391$. | <p>
Define $Q(n)$ to be the smallest number that occurs in exactly $n$ <strong>Pythagorean triples</strong> $(a,b,c)$ where $a \lt b \lt c$.</p>
<p>
For example, $15$ is the smallest number occurring in exactly $5$ Pythagorean triples:
$$(9,12,\mathbf{15})\quad (8,\mathbf{15},17)\quad (\mathbf{15},20,25)\quad (\mathbf{15},36,39)\quad (\mathbf{15},112,113)$$
and so $Q(5) = 15$.</p>
<p>
You are also given $Q(10)=48$ and $Q(10^3)=8064000$.</p>
<p>
Find $\displaystyle \sum_{k=1}^{18} Q(10^k)$. Give your answer modulo $409120391$.</p> | 397289979 | Saturday, 28th January 2023, 01:00 pm | 193 | 50% | medium |
696 | Mahjong | The game of Mahjong is played with tiles belonging to $s$ suits. Each tile also has a number in the range $1\ldots n$, and for each suit/number combination there are exactly four indistinguishable tiles with that suit and number. (The real Mahjong game also contains other bonus tiles, but those will not feature in this problem.)
A winning hand is a collection of $3t+2$ Tiles (where $t$ is a fixed integer) that can be arranged as $t$ Triples and one Pair, where:
A Triple is either a Chow or a Pung
A Chow is three tiles of the same suit and consecutive numbers
A Pung is three identical tiles (same suit and same number)
A Pair is two identical tiles (same suit and same number)
For example, here is a winning hand with $n=9$, $s=3$, $t=4$, consisting in this case of two Chows, two Pungs, and one Pair:
Note that sometimes the same collection of tiles can be represented as $t$ Triples and one Pair in more than one way. This only counts as one winning hand. For example, this is considered to be the same winning hand as above, because it consists of the same tiles:
Let $w(n, s, t)$ be the number of distinct winning hands formed of $t$ Triples and one Pair, where there are $s$ suits available and tiles are numbered up to $n$.
For example, with a single suit and tiles numbered up to $4$, we have $w(4, 1, 1) = 20$: there are $12$ winning hands consisting of a Pung and a Pair, and another $8$ containing a Chow and a Pair. You are also given that $w(9, 1, 4) = 13259$, $w(9, 3, 4) = 5237550$, and $w(1000, 1000, 5) \equiv 107662178 \pmod{1\,000\,000\,007}$.
Find $w(10^8, 10^8, 30)$. Give your answer modulo $1\,000\,000\,007$. | The game of Mahjong is played with tiles belonging to $s$ suits. Each tile also has a number in the range $1\ldots n$, and for each suit/number combination there are exactly four indistinguishable tiles with that suit and number. (The real Mahjong game also contains other bonus tiles, but those will not feature in this problem.)
A winning hand is a collection of $3t+2$ Tiles (where $t$ is a fixed integer) that can be arranged as $t$ Triples and one Pair, where:
A Triple is either a Chow or a Pung
A Chow is three tiles of the same suit and consecutive numbers
A Pung is three identical tiles (same suit and same number)
A Pair is two identical tiles (same suit and same number)
For example, here is a winning hand with $n=9$, $s=3$, $t=4$, consisting in this case of two Chows, two Pungs, and one Pair:
Note that sometimes the same collection of tiles can be represented as $t$ Triples and one Pair in more than one way. This only counts as one winning hand. For example, this is considered to be the same winning hand as above, because it consists of the same tiles:
Let $w(n, s, t)$ be the number of distinct winning hands formed of $t$ Triples and one Pair, where there are $s$ suits available and tiles are numbered up to $n$.
For example, with a single suit and tiles numbered up to $4$, we have $w(4, 1, 1) = 20$: there are $12$ winning hands consisting of a Pung and a Pair, and another $8$ containing a Chow and a Pair. You are also given that $w(9, 1, 4) = 13259$, $w(9, 3, 4) = 5237550$, and $w(1000, 1000, 5) \equiv 107662178 \pmod{1\,000\,000\,007}$.
Find $w(10^8, 10^8, 30)$. Give your answer modulo $1\,000\,000\,007$. | <p>The game of Mahjong is played with tiles belonging to $s$ <dfn>suits</dfn>. Each tile also has a <dfn>number</dfn> in the range $1\ldots n$, and for each suit/number combination there are exactly four indistinguishable tiles with that suit and number. (The real Mahjong game also contains other bonus tiles, but those will not feature in this problem.)</p>
<p>A <dfn>winning hand</dfn> is a collection of $3t+2$ Tiles (where $t$ is a fixed integer) that can be arranged as $t$ <dfn>Triples</dfn> and one <dfn>Pair</dfn>, where:</p>
<ul>
<li>A <dfn>Triple</dfn> is either a <dfn>Chow</dfn> or a <dfn>Pung</dfn></li>
<li>A <dfn>Chow</dfn> is three tiles of the same suit and consecutive numbers</li>
<li>A <dfn>Pung</dfn> is three identical tiles (same suit and same number)</li>
<li>A <dfn>Pair</dfn> is two identical tiles (same suit and same number)</li>
</ul>
<p>For example, here is a winning hand with $n=9$, $s=3$, $t=4$, consisting in this case of two Chows, two Pungs, and one Pair:</p>
<div class="center">
<img alt="A winning Mahjong hand" src="resources/images/0696_mahjong_1.png?1678992054"/>
</div>
<p>Note that sometimes the same collection of tiles can be represented as $t$ Triples and one Pair in more than one way. This only counts as one winning hand. For example, this is considered to be the same winning hand as above, because it consists of the same tiles:</p>
<div class="center">
<img alt="Alternative arrangement of the same hand" src="resources/images/0696_mahjong_2.png?1678992054"/>
</div>
<p>Let $w(n, s, t)$ be the number of distinct winning hands formed of $t$ Triples and one Pair, where there are $s$ suits available and tiles are numbered up to $n$.</p>
<p>For example, with a single suit and tiles numbered up to $4$, we have $w(4, 1, 1) = 20$: there are $12$ winning hands consisting of a Pung and a Pair, and another $8$ containing a Chow and a Pair. You are also given that $w(9, 1, 4) = 13259$, $w(9, 3, 4) = 5237550$, and $w(1000, 1000, 5) \equiv 107662178 \pmod{1\,000\,000\,007}$.</p>
<p>Find $w(10^8, 10^8, 30)$. Give your answer modulo $1\,000\,000\,007$.</p> | 436944244 | Sunday, 5th January 2020, 01:00 am | 194 | 100% | hard |
447 | Retractions C | For every integer $n>1$, the family of functions $f_{n,a,b}$ is defined
by
$f_{n,a,b}(x)\equiv a x + b \mod n\,\,\, $ for $a,b,x$ integer and $0< a <n, 0 \le b < n,0 \le x < n$.
We will call $f_{n,a,b}$ a retraction if $\,\,\, f_{n,a,b}(f_{n,a,b}(x)) \equiv f_{n,a,b}(x) \mod n \,\,\,$ for every $0 \le x < n$.
Let $R(n)$ be the number of retractions for $n$.
$\displaystyle F(N)=\sum_{n=2}^N R(n)$.
$F(10^7)\equiv 638042271 \mod 1\,000\,000\,007$.
Find $F(10^{14})$.
Give your answer modulo $1\,000\,000\,007$. | For every integer $n>1$, the family of functions $f_{n,a,b}$ is defined
by
$f_{n,a,b}(x)\equiv a x + b \mod n\,\,\, $ for $a,b,x$ integer and $0< a <n, 0 \le b < n,0 \le x < n$.
We will call $f_{n,a,b}$ a retraction if $\,\,\, f_{n,a,b}(f_{n,a,b}(x)) \equiv f_{n,a,b}(x) \mod n \,\,\,$ for every $0 \le x < n$.
Let $R(n)$ be the number of retractions for $n$.
$\displaystyle F(N)=\sum_{n=2}^N R(n)$.
$F(10^7)\equiv 638042271 \mod 1\,000\,000\,007$.
Find $F(10^{14})$.
Give your answer modulo $1\,000\,000\,007$. | <p>
For every integer $n>1$, the family of functions $f_{n,a,b}$ is defined
by <br>
$f_{n,a,b}(x)\equiv a x + b \mod n\,\,\, $ for $a,b,x$ integer and $0< a <n, 0 \le b < n,0 \le x < n$. </br></p>
<p>
We will call $f_{n,a,b}$ a <i>retraction</i> if $\,\,\, f_{n,a,b}(f_{n,a,b}(x)) \equiv f_{n,a,b}(x) \mod n \,\,\,$ for every $0 \le x < n$.<br/>
Let $R(n)$ be the number of retractions for $n$.
</p>
<p>
$\displaystyle F(N)=\sum_{n=2}^N R(n)$. <br/>
$F(10^7)\equiv 638042271 \mod 1\,000\,000\,007$.<br/></p>
<p>
Find $F(10^{14})$.<br/>
Give your answer modulo $1\,000\,000\,007$.
</p> | 530553372 | Saturday, 16th November 2013, 10:00 pm | 350 | 95% | hard |
285 | Pythagorean Odds | Albert chooses a positive integer $k$, then two real numbers $a, b$ are randomly chosen in the interval $[0,1]$ with uniform distribution.
The square root of the sum $(k \cdot a + 1)^2 + (k \cdot b + 1)^2$ is then computed and rounded to the nearest integer. If the result is equal to $k$, he scores $k$ points; otherwise he scores nothing.
For example, if $k = 6$, $a = 0.2$ and $b = 0.85$, then $(k \cdot a + 1)^2 + (k \cdot b + 1)^2 = 42.05$.
The square root of $42.05$ is $6.484\cdots$ and when rounded to the nearest integer, it becomes $6$.
This is equal to $k$, so he scores $6$ points.
It can be shown that if he plays $10$ turns with $k = 1, k = 2, \dots, k = 10$, the expected value of his total score, rounded to five decimal places, is $10.20914$.
If he plays $10^5$ turns with $k = 1, k = 2, k = 3, \dots, k = 10^5$, what is the expected value of his total score, rounded to five decimal places? | Albert chooses a positive integer $k$, then two real numbers $a, b$ are randomly chosen in the interval $[0,1]$ with uniform distribution.
The square root of the sum $(k \cdot a + 1)^2 + (k \cdot b + 1)^2$ is then computed and rounded to the nearest integer. If the result is equal to $k$, he scores $k$ points; otherwise he scores nothing.
For example, if $k = 6$, $a = 0.2$ and $b = 0.85$, then $(k \cdot a + 1)^2 + (k \cdot b + 1)^2 = 42.05$.
The square root of $42.05$ is $6.484\cdots$ and when rounded to the nearest integer, it becomes $6$.
This is equal to $k$, so he scores $6$ points.
It can be shown that if he plays $10$ turns with $k = 1, k = 2, \dots, k = 10$, the expected value of his total score, rounded to five decimal places, is $10.20914$.
If he plays $10^5$ turns with $k = 1, k = 2, k = 3, \dots, k = 10^5$, what is the expected value of his total score, rounded to five decimal places? | <p>Albert chooses a positive integer $k$, then two real numbers $a, b$ are randomly chosen in the interval $[0,1]$ with uniform distribution.<br/>
The square root of the sum $(k \cdot a + 1)^2 + (k \cdot b + 1)^2$ is then computed and rounded to the nearest integer. If the result is equal to $k$, he scores $k$ points; otherwise he scores nothing.</p>
<p>For example, if $k = 6$, $a = 0.2$ and $b = 0.85$, then $(k \cdot a + 1)^2 + (k \cdot b + 1)^2 = 42.05$.<br/>
The square root of $42.05$ is $6.484\cdots$ and when rounded to the nearest integer, it becomes $6$.<br/>
This is equal to $k$, so he scores $6$ points.</p>
<p>It can be shown that if he plays $10$ turns with $k = 1, k = 2, \dots, k = 10$, the expected value of his total score, rounded to five decimal places, is $10.20914$.</p>
<p>If he plays $10^5$ turns with $k = 1, k = 2, k = 3, \dots, k = 10^5$, what is the expected value of his total score, rounded to five decimal places?</p> | 157055.80999 | Saturday, 3rd April 2010, 05:00 am | 1361 | 55% | medium |
800 | Hybrid Integers | An integer of the form $p^q q^p$ with prime numbers $p \neq q$ is called a hybrid-integer.
For example, $800 = 2^5 5^2$ is a hybrid-integer.
We define $C(n)$ to be the number of hybrid-integers less than or equal to $n$.
You are given $C(800) = 2$ and $C(800^{800}) = 10790$.
Find $C(800800^{800800})$. | An integer of the form $p^q q^p$ with prime numbers $p \neq q$ is called a hybrid-integer.
For example, $800 = 2^5 5^2$ is a hybrid-integer.
We define $C(n)$ to be the number of hybrid-integers less than or equal to $n$.
You are given $C(800) = 2$ and $C(800^{800}) = 10790$.
Find $C(800800^{800800})$. | <p>
An integer of the form $p^q q^p$ with prime numbers $p \neq q$ is called a <dfn>hybrid-integer</dfn>.<br/>
For example, $800 = 2^5 5^2$ is a hybrid-integer.
</p>
<p>
We define $C(n)$ to be the number of hybrid-integers less than or equal to $n$.<br/>
You are given $C(800) = 2$ and $C(800^{800}) = 10790$.
</p>
<p>
Find $C(800800^{800800})$.
</p> | 1412403576 | Sunday, 29th May 2022, 05:00 am | 2165 | 5% | easy |
100 | Arranged Probability | If a box contains twenty-one coloured discs, composed of fifteen blue discs and six red discs, and two discs were taken at random, it can be seen that the probability of taking two blue discs, $P(\text{BB}) = (15/21) \times (14/20) = 1/2$.
The next such arrangement, for which there is exactly $50\%$ chance of taking two blue discs at random, is a box containing eighty-five blue discs and thirty-five red discs.
By finding the first arrangement to contain over $10^{12} = 1\,000\,000\,000\,000$ discs in total, determine the number of blue discs that the box would contain. | If a box contains twenty-one coloured discs, composed of fifteen blue discs and six red discs, and two discs were taken at random, it can be seen that the probability of taking two blue discs, $P(\text{BB}) = (15/21) \times (14/20) = 1/2$.
The next such arrangement, for which there is exactly $50\%$ chance of taking two blue discs at random, is a box containing eighty-five blue discs and thirty-five red discs.
By finding the first arrangement to contain over $10^{12} = 1\,000\,000\,000\,000$ discs in total, determine the number of blue discs that the box would contain. | <p>If a box contains twenty-one coloured discs, composed of fifteen blue discs and six red discs, and two discs were taken at random, it can be seen that the probability of taking two blue discs, $P(\text{BB}) = (15/21) \times (14/20) = 1/2$.</p>
<p>The next such arrangement, for which there is exactly $50\%$ chance of taking two blue discs at random, is a box containing eighty-five blue discs and thirty-five red discs.</p>
<p>By finding the first arrangement to contain over $10^{12} = 1\,000\,000\,000\,000$ discs in total, determine the number of blue discs that the box would contain.</p> | 756872327473 | Friday, 15th July 2005, 06:00 pm | 18422 | 30% | easy |
140 | Modified Fibonacci Golden Nuggets | Consider the infinite polynomial series $A_G(x) = x G_1 + x^2 G_2 + x^3 G_3 + \cdots$, where $G_k$ is the $k$th term of the second order recurrence relation $G_k = G_{k-1} + G_{k-2}$, $G_1 = 1$ and $G_2 = 4$; that is, $1, 4, 5, 9, 14, 23, \dots$.
For this problem we shall be concerned with values of $x$ for which $A_G(x)$ is a positive integer.
The corresponding values of $x$ for the first five natural numbers are shown below.
$x$$A_G(x)$
$\frac{\sqrt{5}-1}{4}$$1$
$\tfrac{2}{5}$$2$
$\frac{\sqrt{22}-2}{6}$$3$
$\frac{\sqrt{137}-5}{14}$$4$
$\tfrac{1}{2}$$5$
We shall call $A_G(x)$ a golden nugget if $x$ is rational, because they become increasingly rarer; for example, the $20$th golden nugget is $211345365$.
Find the sum of the first thirty golden nuggets. | Consider the infinite polynomial series $A_G(x) = x G_1 + x^2 G_2 + x^3 G_3 + \cdots$, where $G_k$ is the $k$th term of the second order recurrence relation $G_k = G_{k-1} + G_{k-2}$, $G_1 = 1$ and $G_2 = 4$; that is, $1, 4, 5, 9, 14, 23, \dots$.
For this problem we shall be concerned with values of $x$ for which $A_G(x)$ is a positive integer.
The corresponding values of $x$ for the first five natural numbers are shown below.
$x$$A_G(x)$
$\frac{\sqrt{5}-1}{4}$$1$
$\tfrac{2}{5}$$2$
$\frac{\sqrt{22}-2}{6}$$3$
$\frac{\sqrt{137}-5}{14}$$4$
$\tfrac{1}{2}$$5$
We shall call $A_G(x)$ a golden nugget if $x$ is rational, because they become increasingly rarer; for example, the $20$th golden nugget is $211345365$.
Find the sum of the first thirty golden nuggets. | <p>Consider the infinite polynomial series $A_G(x) = x G_1 + x^2 G_2 + x^3 G_3 + \cdots$, where $G_k$ is the $k$th term of the second order recurrence relation $G_k = G_{k-1} + G_{k-2}$, $G_1 = 1$ and $G_2 = 4$; that is, $1, 4, 5, 9, 14, 23, \dots$.</p>
<p>For this problem we shall be concerned with values of $x$ for which $A_G(x)$ is a positive integer.</p>
<p>The corresponding values of $x$ for the first five natural numbers are shown below.</p>
<div class="center">
<table align="center" border="1" cellpadding="2" cellspacing="0"><tr><th>$x$</th><th width="50">$A_G(x)$</th>
</tr><tr><td>$\frac{\sqrt{5}-1}{4}$</td><td>$1$</td>
</tr><tr><td>$\tfrac{2}{5}$</td><td>$2$</td>
</tr><tr><td>$\frac{\sqrt{22}-2}{6}$</td><td>$3$</td>
</tr><tr><td>$\frac{\sqrt{137}-5}{14}$</td><td>$4$</td>
</tr><tr><td>$\tfrac{1}{2}$</td><td>$5$</td>
</tr></table></div>
<p>We shall call $A_G(x)$ a golden nugget if $x$ is rational, because they become increasingly rarer; for example, the $20$th golden nugget is $211345365$.</p>
<p>Find the sum of the first thirty golden nuggets.</p> | 5673835352990 | Saturday, 3rd February 2007, 07:00 am | 4928 | 55% | medium |
738 | Counting Ordered Factorisations | Define $d(n,k)$ to be the number of ways to write $n$ as a product of $k$ ordered integers
\[
n = x_1\times x_2\times x_3\times \ldots\times x_k\qquad 1\le x_1\le x_2\le\ldots\le x_k
\]
Further define $D(N,K)$ to be the sum of $d(n,k)$ for $1\le n\le N$ and $1\le k\le K$.
You are given that $D(10, 10) = 153$ and $D(100, 100) = 35384$.
Find $D(10^{10},10^{10})$ giving your answer modulo $1\,000\,000\,007$. | Define $d(n,k)$ to be the number of ways to write $n$ as a product of $k$ ordered integers
\[
n = x_1\times x_2\times x_3\times \ldots\times x_k\qquad 1\le x_1\le x_2\le\ldots\le x_k
\]
Further define $D(N,K)$ to be the sum of $d(n,k)$ for $1\le n\le N$ and $1\le k\le K$.
You are given that $D(10, 10) = 153$ and $D(100, 100) = 35384$.
Find $D(10^{10},10^{10})$ giving your answer modulo $1\,000\,000\,007$. | <p>Define $d(n,k)$ to be the number of ways to write $n$ as a product of $k$ ordered integers</p>
\[
n = x_1\times x_2\times x_3\times \ldots\times x_k\qquad 1\le x_1\le x_2\le\ldots\le x_k
\]
<p>Further define $D(N,K)$ to be the sum of $d(n,k)$ for $1\le n\le N$ and $1\le k\le K$.</p>
<p>You are given that $D(10, 10) = 153$ and $D(100, 100) = 35384$.</p>
<p>Find $D(10^{10},10^{10})$ giving your answer modulo $1\,000\,000\,007$.</p> | 143091030 | Sunday, 13th December 2020, 07:00 am | 300 | 35% | medium |
321 | Swapping Counters | A horizontal row comprising of $2n + 1$ squares has $n$ red counters placed at one end and $n$ blue counters at the other end, being separated by a single empty square in the centre. For example, when $n = 3$.
A counter can move from one square to the next (slide) or can jump over another counter (hop) as long as the square next to that counter is unoccupied.
Let $M(n)$ represent the minimum number of moves/actions to completely reverse the positions of the coloured counters; that is, move all the red counters to the right and all the blue counters to the left.
It can be verified $M(3) = 15$, which also happens to be a triangle number.
If we create a sequence based on the values of $n$ for which $M(n)$ is a triangle number then the first five terms would be:
$1$, $3$, $10$, $22$, and $63$, and their sum would be $99$.
Find the sum of the first forty terms of this sequence. | A horizontal row comprising of $2n + 1$ squares has $n$ red counters placed at one end and $n$ blue counters at the other end, being separated by a single empty square in the centre. For example, when $n = 3$.
A counter can move from one square to the next (slide) or can jump over another counter (hop) as long as the square next to that counter is unoccupied.
Let $M(n)$ represent the minimum number of moves/actions to completely reverse the positions of the coloured counters; that is, move all the red counters to the right and all the blue counters to the left.
It can be verified $M(3) = 15$, which also happens to be a triangle number.
If we create a sequence based on the values of $n$ for which $M(n)$ is a triangle number then the first five terms would be:
$1$, $3$, $10$, $22$, and $63$, and their sum would be $99$.
Find the sum of the first forty terms of this sequence. | <p>A horizontal row comprising of $2n + 1$ squares has $n$ red counters placed at one end and $n$ blue counters at the other end, being separated by a single empty square in the centre. For example, when $n = 3$.</p>
<p></p><div align="center"><img alt="0321_swapping_counters_1.gif" src="resources/images/0321_swapping_counters_1.gif?1678992056"/></div>
<p>A counter can move from one square to the next (slide) or can jump over another counter (hop) as long as the square next to that counter is unoccupied.</p>
<p></p><div align="center"><img alt="0321_swapping_counters_2.gif" src="resources/images/0321_swapping_counters_2.gif?1678992056"/></div>
<p>Let $M(n)$ represent the minimum number of moves/actions to completely reverse the positions of the coloured counters; that is, move all the red counters to the right and all the blue counters to the left.</p>
<p>It can be verified $M(3) = 15$, which also happens to be a triangle number.</p>
<p>If we create a sequence based on the values of $n$ for which $M(n)$ is a triangle number then the first five terms would be:
<br/>$1$, $3$, $10$, $22$, and $63$, and their sum would be $99$.</p>
<p>Find the sum of the first forty terms of this sequence.</p> | 2470433131948040 | Sunday, 23rd January 2011, 01:00 am | 1909 | 30% | easy |
247 | Squares Under a Hyperbola | Consider the region constrained by $1 \le x$ and $0 \le y \le 1/x$.
Let $S_1$ be the largest square that can fit under the curve.
Let $S_2$ be the largest square that fits in the remaining area, and so on.
Let the index of $S_n$ be the pair $(\text{left}, \text{below})$ indicating the number of squares to the left of $S_n$ and the number of squares below $S_n$.
The diagram shows some such squares labelled by number.
$S_2$ has one square to its left and none below, so the index of $S_2$ is $(1,0)$.
It can be seen that the index of $S_{32}$ is $(1,1)$ as is the index of $S_{50}$.
$50$ is the largest $n$ for which the index of $S_n$ is $(1,1)$.
What is the largest $n$ for which the index of $S_n$ is $(3,3)$? | Consider the region constrained by $1 \le x$ and $0 \le y \le 1/x$.
Let $S_1$ be the largest square that can fit under the curve.
Let $S_2$ be the largest square that fits in the remaining area, and so on.
Let the index of $S_n$ be the pair $(\text{left}, \text{below})$ indicating the number of squares to the left of $S_n$ and the number of squares below $S_n$.
The diagram shows some such squares labelled by number.
$S_2$ has one square to its left and none below, so the index of $S_2$ is $(1,0)$.
It can be seen that the index of $S_{32}$ is $(1,1)$ as is the index of $S_{50}$.
$50$ is the largest $n$ for which the index of $S_n$ is $(1,1)$.
What is the largest $n$ for which the index of $S_n$ is $(3,3)$? | <p>Consider the region constrained by $1 \le x$ and $0 \le y \le 1/x$.
</p><p>
Let $S_1$ be the largest square that can fit under the curve.<br/>
Let $S_2$ be the largest square that fits in the remaining area, and so on. <br/>
Let the <dfn>index</dfn> of $S_n$ be the pair $(\text{left}, \text{below})$ indicating the number of squares to the left of $S_n$ and the number of squares below $S_n$.
</p>
<div class="center">
<img alt="" class="dark_img" src="resources/images/0247_hypersquares.gif?1678992055"/></div>
<p>
The diagram shows some such squares labelled by number. <br/>
$S_2$ has one square to its left and none below, so the index of $S_2$ is $(1,0)$.<br/>
It can be seen that the index of $S_{32}$ is $(1,1)$ as is the index of $S_{50}$. <br/>
$50$ is the largest $n$ for which the index of $S_n$ is $(1,1)$.
</p>
<p>
What is the largest $n$ for which the index of $S_n$ is $(3,3)$?
</p> | 782252 | Friday, 29th May 2009, 09:00 pm | 1639 | 65% | hard |
24 | Lexicographic Permutations | A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or alphabetically, we call it lexicographic order. The lexicographic permutations of 0, 1 and 2 are:
012 021 102 120 201 210
What is the millionth lexicographic permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9? | A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or alphabetically, we call it lexicographic order. The lexicographic permutations of 0, 1 and 2 are:
012 021 102 120 201 210
What is the millionth lexicographic permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9? | <p>A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or alphabetically, we call it lexicographic order. The lexicographic permutations of 0, 1 and 2 are:</p>
<p class="center">012 021 102 120 201 210</p>
<p>What is the millionth lexicographic permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9?</p> | 2783915460 | Friday, 16th August 2002, 06:00 pm | 124535 | 5% | easy |
192 | Best Approximations | Let $x$ be a real number.
A best approximation to $x$ for the denominator bound $d$ is a rational number $\frac r s $ in reduced form, with $s \le d$, such that any rational number which is closer to $x$ than $\frac r s$ has a denominator larger than $d$:
$|\frac p q -x | < |\frac r s -x| \Rightarrow q > d$
For example, the best approximation to $\sqrt {13}$ for the denominator bound 20 is $\frac {18} 5$ and the best approximation to $\sqrt {13}$ for the denominator bound 30 is $\frac {101}{28}$.
Find the sum of all denominators of the best approximations to $\sqrt n$ for the denominator bound $10^{12}$, where $n$ is not a perfect square and $ 1 < n \le 100000$. | Let $x$ be a real number.
A best approximation to $x$ for the denominator bound $d$ is a rational number $\frac r s $ in reduced form, with $s \le d$, such that any rational number which is closer to $x$ than $\frac r s$ has a denominator larger than $d$:
$|\frac p q -x | < |\frac r s -x| \Rightarrow q > d$
For example, the best approximation to $\sqrt {13}$ for the denominator bound 20 is $\frac {18} 5$ and the best approximation to $\sqrt {13}$ for the denominator bound 30 is $\frac {101}{28}$.
Find the sum of all denominators of the best approximations to $\sqrt n$ for the denominator bound $10^{12}$, where $n$ is not a perfect square and $ 1 < n \le 100000$. | <p>Let $x$ be a real number.<br>
A <b>best approximation</b> to $x$ for the <b>denominator bound</b> $d$ is a rational number $\frac r s $ in<b> reduced form</b>, with $s \le d$, such that any rational number which is closer to $x$ than $\frac r s$ has a denominator larger than $d$:</br></p>
<div class="center"> $|\frac p q -x | < |\frac r s -x| \Rightarrow q > d$
</div>
<p>For example, the best approximation to $\sqrt {13}$ for the denominator bound 20 is $\frac {18} 5$ and the best approximation to $\sqrt {13}$ for the denominator bound 30 is $\frac {101}{28}$.</p>
<p>Find the sum of all denominators of the best approximations to $\sqrt n$ for the denominator bound $10^{12}$, where $n$ is not a perfect square and $ 1 < n \le 100000$. </p> | 57060635927998347 | Saturday, 3rd May 2008, 05:00 am | 1875 | 75% | hard |
506 | Clock Sequence | Consider the infinite repeating sequence of digits:
1234321234321234321...
Amazingly, you can break this sequence of digits into a sequence of integers such that the sum of the digits in the $n$-th value is $n$.
The sequence goes as follows:
1, 2, 3, 4, 32, 123, 43, 2123, 432, 1234, 32123, ...
Let $v_n$ be the $n$-th value in this sequence. For example, $v_2=2$, $v_5=32$ and $v_{11}=32123$.
Let $S(n)$ be $v_1+v_2+\cdots+v_n$. For example, $S(11)=36120$, and $S(1000)\bmod 123454321=18232686$.
Find $S(10^{14})\bmod 123454321$. | Consider the infinite repeating sequence of digits:
1234321234321234321...
Amazingly, you can break this sequence of digits into a sequence of integers such that the sum of the digits in the $n$-th value is $n$.
The sequence goes as follows:
1, 2, 3, 4, 32, 123, 43, 2123, 432, 1234, 32123, ...
Let $v_n$ be the $n$-th value in this sequence. For example, $v_2=2$, $v_5=32$ and $v_{11}=32123$.
Let $S(n)$ be $v_1+v_2+\cdots+v_n$. For example, $S(11)=36120$, and $S(1000)\bmod 123454321=18232686$.
Find $S(10^{14})\bmod 123454321$. | <p>Consider the infinite repeating sequence of digits:<br/>
1234321234321234321...</p>
<p>Amazingly, you can break this sequence of digits into a sequence of integers such that the sum of the digits in the $n$-th value is $n$.</p>
<p>The sequence goes as follows:<br/>
1, 2, 3, 4, 32, 123, 43, 2123, 432, 1234, 32123, ...</p>
<p>Let $v_n$ be the $n$-th value in this sequence. For example, $v_2=2$, $v_5=32$ and $v_{11}=32123$.</p>
<p>Let $S(n)$ be $v_1+v_2+\cdots+v_n$. For example, $S(11)=36120$, and $S(1000)\bmod 123454321=18232686$.</p>
<p>Find $S(10^{14})\bmod 123454321$.</p> | 18934502 | Sunday, 8th March 2015, 04:00 am | 994 | 30% | easy |
265 | Binary Circles | $2^N$ binary digits can be placed in a circle so that all the $N$-digit clockwise subsequences are distinct.
For $N=3$, two such circular arrangements are possible, ignoring rotations:
For the first arrangement, the $3$-digit subsequences, in clockwise order, are:$000$, $001$, $010$, $101$, $011$, $111$, $110$ and $100$.
Each circular arrangement can be encoded as a number by concatenating the binary digits starting with the subsequence of all zeros as the most significant bits and proceeding clockwise. The two arrangements for $N=3$ are thus represented as $23$ and $29$:
\begin{align}
00010111_2 &= 23\\
00011101_2 &= 29
\end{align}
Calling $S(N)$ the sum of the unique numeric representations, we can see that $S(3) = 23 + 29 = 52$.
Find $S(5)$. | $2^N$ binary digits can be placed in a circle so that all the $N$-digit clockwise subsequences are distinct.
For $N=3$, two such circular arrangements are possible, ignoring rotations:
For the first arrangement, the $3$-digit subsequences, in clockwise order, are:$000$, $001$, $010$, $101$, $011$, $111$, $110$ and $100$.
Each circular arrangement can be encoded as a number by concatenating the binary digits starting with the subsequence of all zeros as the most significant bits and proceeding clockwise. The two arrangements for $N=3$ are thus represented as $23$ and $29$:
\begin{align}
00010111_2 &= 23\\
00011101_2 &= 29
\end{align}
Calling $S(N)$ the sum of the unique numeric representations, we can see that $S(3) = 23 + 29 = 52$.
Find $S(5)$. | <p>$2^N$ binary digits can be placed in a circle so that all the $N$-digit clockwise subsequences are distinct.</p>
<p>For $N=3$, two such circular arrangements are possible, ignoring rotations:</p>
<div align="center"><img alt="0265_BinaryCircles.gif" class="dark_img" src="resources/images/0265_BinaryCircles.gif?1678992056"/></div>
<p>For the first arrangement, the $3$-digit subsequences, in clockwise order, are:<br/>$000$, $001$, $010$, $101$, $011$, $111$, $110$ and $100$.</p>
<p>Each circular arrangement can be encoded as a number by concatenating the binary digits starting with the subsequence of all zeros as the most significant bits and proceeding clockwise. The two arrangements for $N=3$ are thus represented as $23$ and $29$:
</p>
\begin{align}
00010111_2 &= 23\\
00011101_2 &= 29
\end{align}
<p>Calling $S(N)$ the sum of the unique numeric representations, we can see that $S(3) = 23 + 29 = 52$.</p>
<p>Find $S(5)$.</p> | 209110240768 | Saturday, 21st November 2009, 09:00 am | 4565 | 40% | medium |
891 | Ambiguous Clock | A round clock only has three hands: hour, minute, second. All hands look identical and move continuously. Moreover, there is no number or reference mark so that the "upright position" is unknown. The clock functions the same as a normal 12-hour analogue clock.
Despite the inconvenient design, for most time it is possible to tell the correct time (within a 12-hour cycle) from the clock, just by measuring accurately the angles between the hands. For example, if all three hands coincide, then the time must be 12:00:00.
Nevertheless, there are several moments where the clock shows an ambiguous reading. For example, the following moment could be either 1:30:00 or 7:30:00 (with the clock rotated $180^\circ$). Thus both 1:30:00 and 7:30:00 are ambiguous moments.
Note that even if two hands perfectly coincide, we can still see them as two distinct hands in the same position. Thus for example 3:00:00 and 9:00:00 are not ambiguous moments.
How many ambiguous moments are there within a 12-hour cycle? | A round clock only has three hands: hour, minute, second. All hands look identical and move continuously. Moreover, there is no number or reference mark so that the "upright position" is unknown. The clock functions the same as a normal 12-hour analogue clock.
Despite the inconvenient design, for most time it is possible to tell the correct time (within a 12-hour cycle) from the clock, just by measuring accurately the angles between the hands. For example, if all three hands coincide, then the time must be 12:00:00.
Nevertheless, there are several moments where the clock shows an ambiguous reading. For example, the following moment could be either 1:30:00 or 7:30:00 (with the clock rotated $180^\circ$). Thus both 1:30:00 and 7:30:00 are ambiguous moments.
Note that even if two hands perfectly coincide, we can still see them as two distinct hands in the same position. Thus for example 3:00:00 and 9:00:00 are not ambiguous moments.
How many ambiguous moments are there within a 12-hour cycle? | <p>
A round clock only has three hands: hour, minute, second. All hands look identical and move continuously. Moreover, there is no number or reference mark so that the "upright position" is unknown. The clock functions the same as a normal 12-hour analogue clock.</p>
<p>
Despite the inconvenient design, for most time it is possible to tell the correct time (within a 12-hour cycle) from the clock, just by measuring accurately the angles between the hands. For example, if all three hands coincide, then the time must be 12:00:00.</p>
<p>
Nevertheless, there are several moments where the clock shows an ambiguous reading. For example, the following moment could be either 1:30:00 or 7:30:00 (with the clock rotated $180^\circ$). Thus both 1:30:00 and 7:30:00 are ambiguous moments.<br/>
Note that even if two hands perfectly coincide, we can still see them as two distinct hands in the same position. Thus for example 3:00:00 and 9:00:00 are not ambiguous moments.
</p>
<div style="text-align:center;"><img alt="0891_clock.png" src="resources/images/0891_clock.png?1714250610"/></div>
<p>
How many ambiguous moments are there within a 12-hour cycle?</p> | 1541414 | Sunday, 19th May 2024, 05:00 am | 154 | 65% | hard |
466 | Distinct Terms in a Multiplication Table | Let $P(m,n)$ be the number of distinct terms in an $m\times n$ multiplication table.
For example, a $3\times 4$ multiplication table looks like this:
$\times$ 12341 12342 24683 36912
There are $8$ distinct terms $\{1,2,3,4,6,8,9,12\}$, therefore $P(3,4) = 8$.
You are given that:
$P(64,64) = 1263$,
$P(12,345) = 1998$, and
$P(32,10^{15}) = 13826382602124302$.
Find $P(64,10^{16})$. | Let $P(m,n)$ be the number of distinct terms in an $m\times n$ multiplication table.
For example, a $3\times 4$ multiplication table looks like this:
$\times$ 12341 12342 24683 36912
There are $8$ distinct terms $\{1,2,3,4,6,8,9,12\}$, therefore $P(3,4) = 8$.
You are given that:
$P(64,64) = 1263$,
$P(12,345) = 1998$, and
$P(32,10^{15}) = 13826382602124302$.
Find $P(64,10^{16})$. | <p>Let $P(m,n)$ be the number of <i>distinct</i> terms in an $m\times n$ multiplication table.</p>
<p>For example, a $3\times 4$ multiplication table looks like this:</p>
<p></p><center><table class="p466"><tr><th>$\times$</th> <th>1</th><th>2</th><th>3</th><th>4</th></tr><tr><th>1</th> <td>1</td><td>2</td><td>3</td><td>4</td></tr><tr><th>2</th> <td>2</td><td>4</td><td>6</td><td>8</td></tr><tr><th>3</th> <td>3</td><td>6</td><td>9</td><td>12</td></tr></table></center>
<p>There are $8$ distinct terms $\{1,2,3,4,6,8,9,12\}$, therefore $P(3,4) = 8$.</p>
<p>You are given that:<br/>
$P(64,64) = 1263$,<br/>
$P(12,345) = 1998$, and<br/>
$P(32,10^{15}) = 13826382602124302$.</p>
<p>Find $P(64,10^{16})$.</p> | 258381958195474745 | Sunday, 6th April 2014, 07:00 am | 360 | 65% | hard |
723 | Pythagorean Quadrilaterals | A pythagorean triangle with catheti $a$ and $b$ and hypotenuse $c$ is characterized by the well-known equation $a^2+b^2=c^2$. However, this can also be formulated differently:
When inscribed into a circle with radius $r$, a triangle with sides $a$, $b$ and $c$ is pythagorean, if and only if $a^2+b^2+c^2=8\, r^2$.
Analogously, we call a quadrilateral $ABCD$ with sides $a$, $b$, $c$ and $d$, inscribed in a circle with radius $r$, a pythagorean quadrilateral, if $a^2+b^2+c^2+d^2=8\, r^2$.
We further call a pythagorean quadrilateral a pythagorean lattice grid quadrilateral, if all four vertices are lattice grid points with the same distance $r$ from the origin $O$ (which then happens to be the centre of the circumcircle).
Let $f(r)$ be the number of different pythagorean lattice grid quadrilaterals for which the radius of the circumcircle is $r$. For example $f(1)=1$, $f(\sqrt 2)=1$, $f(\sqrt 5)=38$ and $f(5)=167$.
Two of the pythagorean lattice grid quadrilaterals with $r=\sqrt 5$ are illustrated below:
Let $\displaystyle S(n)=\sum_{d \mid n} f(\sqrt d)$. For example, $S(325)=S(5^2 \cdot 13)=f(1)+f(\sqrt 5)+f(5)+f(\sqrt {13})+f(\sqrt{65})+f(5\sqrt{13})=2370$ and $S(1105)=S(5\cdot 13 \cdot 17)=5535$.
Find $S(1411033124176203125)=S(5^6 \cdot 13^3 \cdot 17^2 \cdot 29 \cdot 37 \cdot 41 \cdot 53 \cdot 61)$. | A pythagorean triangle with catheti $a$ and $b$ and hypotenuse $c$ is characterized by the well-known equation $a^2+b^2=c^2$. However, this can also be formulated differently:
When inscribed into a circle with radius $r$, a triangle with sides $a$, $b$ and $c$ is pythagorean, if and only if $a^2+b^2+c^2=8\, r^2$.
Analogously, we call a quadrilateral $ABCD$ with sides $a$, $b$, $c$ and $d$, inscribed in a circle with radius $r$, a pythagorean quadrilateral, if $a^2+b^2+c^2+d^2=8\, r^2$.
We further call a pythagorean quadrilateral a pythagorean lattice grid quadrilateral, if all four vertices are lattice grid points with the same distance $r$ from the origin $O$ (which then happens to be the centre of the circumcircle).
Let $f(r)$ be the number of different pythagorean lattice grid quadrilaterals for which the radius of the circumcircle is $r$. For example $f(1)=1$, $f(\sqrt 2)=1$, $f(\sqrt 5)=38$ and $f(5)=167$.
Two of the pythagorean lattice grid quadrilaterals with $r=\sqrt 5$ are illustrated below:
Let $\displaystyle S(n)=\sum_{d \mid n} f(\sqrt d)$. For example, $S(325)=S(5^2 \cdot 13)=f(1)+f(\sqrt 5)+f(5)+f(\sqrt {13})+f(\sqrt{65})+f(5\sqrt{13})=2370$ and $S(1105)=S(5\cdot 13 \cdot 17)=5535$.
Find $S(1411033124176203125)=S(5^6 \cdot 13^3 \cdot 17^2 \cdot 29 \cdot 37 \cdot 41 \cdot 53 \cdot 61)$. | <p>A pythagorean triangle with catheti $a$ and $b$ and hypotenuse $c$ is characterized by the well-known equation $a^2+b^2=c^2$. However, this can also be formulated differently:<br/>
When inscribed into a circle with radius $r$, a triangle with sides $a$, $b$ and $c$ is pythagorean, if and only if $a^2+b^2+c^2=8\, r^2$.</p>
<p>Analogously, we call a quadrilateral $ABCD$ with sides $a$, $b$, $c$ and $d$, inscribed in a circle with radius $r$, a <i>pythagorean quadrilateral</i>, if $a^2+b^2+c^2+d^2=8\, r^2$. <br/>
We further call a pythagorean quadrilateral a <dfn>pythagorean lattice grid quadrilateral</dfn>, if all four vertices are lattice grid points with the same distance $r$ from the origin $O$ (which then happens to be the centre of the circumcircle).</p>
<p>
Let $f(r)$ be the number of different pythagorean lattice grid quadrilaterals for which the radius of the circumcircle is $r$. For example $f(1)=1$, $f(\sqrt 2)=1$, $f(\sqrt 5)=38$ and $f(5)=167$.<br/>
Two of the pythagorean lattice grid quadrilaterals with $r=\sqrt 5$ are illustrated below:</p>
<div class="center">
<img alt="PythagoreanQ_1" src="resources/images/0723_1.png?1678992054"/>
</div>
<br/>
<div class="center">
<img alt="PythagoreanQ_2" src="resources/images/0723_2.png?1678992054"/>
</div>
<p>
Let $\displaystyle S(n)=\sum_{d \mid n} f(\sqrt d)$. For example, $S(325)=S(5^2 \cdot 13)=f(1)+f(\sqrt 5)+f(5)+f(\sqrt {13})+f(\sqrt{65})+f(5\sqrt{13})=2370$ and $S(1105)=S(5\cdot 13 \cdot 17)=5535$.</p>
<p>
Find $S(1411033124176203125)=S(5^6 \cdot 13^3 \cdot 17^2 \cdot 29 \cdot 37 \cdot 41 \cdot 53 \cdot 61)$.</p> | 1395793419248 | Sunday, 5th July 2020, 08:00 am | 197 | 65% | hard |
553 | Power Sets of Power Sets | Let $P(n)$ be the set of the first $n$ positive integers $\{1, 2, \dots, n\}$.
Let $Q(n)$ be the set of all the non-empty subsets of $P(n)$.
Let $R(n)$ be the set of all the non-empty subsets of $Q(n)$.
An element $X \in R(n)$ is a non-empty subset of $Q(n)$, so it is itself a set.
From $X$ we can construct a graph as follows:
Each element $Y \in X$ corresponds to a vertex and labeled with $Y$;
Two vertices $Y_1$ and $Y_2$ are connected if $Y_1 \cap Y_2 \ne \emptyset$.
For example, $X = \{\{1\},\{1,2,3\},\{3\},\{5,6\},\{6,7\}\}$ results in the following graph:
This graph has two connected components.
Let $C(n, k)$ be the number of elements of $R(n)$ that have exactly $k$ connected components in their graph.
You are given $C(2, 1) = 6$, $C(3, 1) = 111$, $C(4, 2) = 486$, $C(100, 10) \bmod 1\,000\,000\,007 = 728209718$.
Find $C(10^4, 10) \bmod 1\,000\,000\,007$. | Let $P(n)$ be the set of the first $n$ positive integers $\{1, 2, \dots, n\}$.
Let $Q(n)$ be the set of all the non-empty subsets of $P(n)$.
Let $R(n)$ be the set of all the non-empty subsets of $Q(n)$.
An element $X \in R(n)$ is a non-empty subset of $Q(n)$, so it is itself a set.
From $X$ we can construct a graph as follows:
Each element $Y \in X$ corresponds to a vertex and labeled with $Y$;
Two vertices $Y_1$ and $Y_2$ are connected if $Y_1 \cap Y_2 \ne \emptyset$.
For example, $X = \{\{1\},\{1,2,3\},\{3\},\{5,6\},\{6,7\}\}$ results in the following graph:
This graph has two connected components.
Let $C(n, k)$ be the number of elements of $R(n)$ that have exactly $k$ connected components in their graph.
You are given $C(2, 1) = 6$, $C(3, 1) = 111$, $C(4, 2) = 486$, $C(100, 10) \bmod 1\,000\,000\,007 = 728209718$.
Find $C(10^4, 10) \bmod 1\,000\,000\,007$. | <p>Let $P(n)$ be the set of the first $n$ positive integers $\{1, 2, \dots, n\}$.<br/>
Let $Q(n)$ be the set of all the non-empty subsets of $P(n)$.<br/>
Let $R(n)$ be the set of all the non-empty subsets of $Q(n)$.</p>
<p>An element $X \in R(n)$ is a non-empty subset of $Q(n)$, so it is itself a set.<br/>
From $X$ we can construct a graph as follows:</p>
<ul>
<li>Each element $Y \in X$ corresponds to a vertex and labeled with $Y$;</li>
<li>Two vertices $Y_1$ and $Y_2$ are connected if $Y_1 \cap Y_2 \ne \emptyset$.</li>
</ul>
<p>For example, $X = \{\{1\},\{1,2,3\},\{3\},\{5,6\},\{6,7\}\}$ results in the following graph:</p>
<div align="center"><img alt="0553-power-sets.gif" src="resources/images/0553-power-sets.gif?1678992057"/></div>
<p>This graph has two <strong>connected components</strong>.</p>
<p>Let $C(n, k)$ be the number of elements of $R(n)$ that have exactly $k$ connected components in their graph.<br/>
You are given $C(2, 1) = 6$, $C(3, 1) = 111$, $C(4, 2) = 486$, $C(100, 10) \bmod 1\,000\,000\,007 = 728209718$.</p>
<p>Find $C(10^4, 10) \bmod 1\,000\,000\,007$.</p> | 57717170 | Saturday, 26th March 2016, 10:00 pm | 234 | 85% | hard |
577 | Counting Hexagons | An equilateral triangle with integer side length $n \ge 3$ is divided into $n^2$ equilateral triangles with side length 1 as shown in the diagram below.
The vertices of these triangles constitute a triangular lattice with $\frac{(n+1)(n+2)} 2$ lattice points.
Let $H(n)$ be the number of all regular hexagons that can be found by connecting 6 of these points.
For example, $H(3)=1$, $H(6)=12$ and $H(20)=966$.
Find $\displaystyle \sum_{n=3}^{12345} H(n)$. | An equilateral triangle with integer side length $n \ge 3$ is divided into $n^2$ equilateral triangles with side length 1 as shown in the diagram below.
The vertices of these triangles constitute a triangular lattice with $\frac{(n+1)(n+2)} 2$ lattice points.
Let $H(n)$ be the number of all regular hexagons that can be found by connecting 6 of these points.
For example, $H(3)=1$, $H(6)=12$ and $H(20)=966$.
Find $\displaystyle \sum_{n=3}^{12345} H(n)$. | <p>An equilateral triangle with integer side length $n \ge 3$ is divided into $n^2$ equilateral triangles with side length 1 as shown in the diagram below.<br/>
The vertices of these triangles constitute a triangular lattice with $\frac{(n+1)(n+2)} 2$ lattice points.</p>
<p>Let $H(n)$ be the number of all regular hexagons that can be found by connecting 6 of these points.</p>
<div class="center">
<img alt="0577_counting_hexagons.png" src="resources/images/0577_counting_hexagons.png?1678992053"/>
</div>
<p>
For example, $H(3)=1$, $H(6)=12$ and $H(20)=966$.</p>
<p>Find $\displaystyle \sum_{n=3}^{12345} H(n)$.</p> | 265695031399260211 | Saturday, 12th November 2016, 07:00 pm | 1732 | 25% | easy |
594 | Rhombus Tilings | For a polygon $P$, let $t(P)$ be the number of ways in which $P$ can be tiled using rhombi and squares with edge length 1. Distinct rotations and reflections are counted as separate tilings.
For example, if $O$ is a regular octagon with edge length 1, then $t(O) = 8$. As it happens, all these 8 tilings are rotations of one another:
Let $O_{a,b}$ be the equal-angled convex octagon whose edges alternate in length between $a$ and $b$.
For example, here is $O_{2,1}$, with one of its tilings:
You are given that $t(O_{1,1})=8$, $t(O_{2,1})=76$ and $t(O_{3,2})=456572$.
Find $t(O_{4,2})$. | For a polygon $P$, let $t(P)$ be the number of ways in which $P$ can be tiled using rhombi and squares with edge length 1. Distinct rotations and reflections are counted as separate tilings.
For example, if $O$ is a regular octagon with edge length 1, then $t(O) = 8$. As it happens, all these 8 tilings are rotations of one another:
Let $O_{a,b}$ be the equal-angled convex octagon whose edges alternate in length between $a$ and $b$.
For example, here is $O_{2,1}$, with one of its tilings:
You are given that $t(O_{1,1})=8$, $t(O_{2,1})=76$ and $t(O_{3,2})=456572$.
Find $t(O_{4,2})$. | <p>
For a polygon $P$, let $t(P)$ be the number of ways in which $P$ can be tiled using rhombi and squares with edge length 1. Distinct rotations and reflections are counted as separate tilings.
</p>
<p>
For example, if $O$ is a regular octagon with edge length 1, then $t(O) = 8$. As it happens, all these 8 tilings are rotations of one another:
</p>
<div class="center">
<img alt="p594_octagon_tilings_1.png" src="project/images/p594_octagon_tilings_1.png"/></div>
<p>
Let $O_{a,b}$ be the equal-angled convex octagon whose edges alternate in length between $a$ and $b$.
<br>
For example, here is $O_{2,1}$, with one of its tilings:
</br></p>
<div class="center">
<img alt="p594_octagon_tilings_2.png" src="project/images/p594_octagon_tilings_2.png"/></div>
<p>
You are given that $t(O_{1,1})=8$, $t(O_{2,1})=76$ and $t(O_{3,2})=456572$.
</p>
<p>
Find $t(O_{4,2})$.
</p> | 47067598 | Saturday, 11th March 2017, 10:00 pm | 208 | 85% | hard |
770 | Delphi Flip | A and B play a game. A has originally $1$ gram of gold and B has an unlimited amount.
Each round goes as follows:
A chooses and displays, $x$, a nonnegative real number no larger than the amount of gold that A has.
Either B chooses to TAKE. Then A gives B $x$ grams of gold.
Or B chooses to GIVE. Then B gives A $x$ grams of gold.
B TAKEs $n$ times and GIVEs $n$ times after which the game finishes.
Define $g(X)$ to be the smallest value of $n$ so that A can guarantee to have at least $X$ grams of gold at the end of the game. You are given $g(1.7) = 10$.
Find $g(1.9999)$. | A and B play a game. A has originally $1$ gram of gold and B has an unlimited amount.
Each round goes as follows:
A chooses and displays, $x$, a nonnegative real number no larger than the amount of gold that A has.
Either B chooses to TAKE. Then A gives B $x$ grams of gold.
Or B chooses to GIVE. Then B gives A $x$ grams of gold.
B TAKEs $n$ times and GIVEs $n$ times after which the game finishes.
Define $g(X)$ to be the smallest value of $n$ so that A can guarantee to have at least $X$ grams of gold at the end of the game. You are given $g(1.7) = 10$.
Find $g(1.9999)$. | <p>
A and B play a game. A has originally $1$ gram of gold and B has an unlimited amount.
Each round goes as follows:
</p>
<ul>
<li>
A chooses and displays, $x$, a nonnegative real number no larger than the amount of gold that A has.</li>
<li>
Either B chooses to TAKE. Then A gives B $x$ grams of gold.</li>
<li>
Or B chooses to GIVE. Then B gives A $x$ grams of gold.</li>
</ul>
<p>
B TAKEs $n$ times and GIVEs $n$ times after which the game finishes.</p>
<p>
Define $g(X)$ to be the smallest value of $n$ so that A can guarantee to have at least $X$ grams of gold at the end of the game. You are given $g(1.7) = 10$.
</p>
<p>
Find $g(1.9999)$.
</p> | 127311223 | Sunday, 31st October 2021, 10:00 am | 549 | 30% | easy |
521 | Smallest Prime Factor | Let $\operatorname{smpf}(n)$ be the smallest prime factor of $n$.
$\operatorname{smpf}(91)=7$ because $91=7\times 13$ and $\operatorname{smpf}(45)=3$ because $45=3\times 3\times 5$.
Let $S(n)$ be the sum of $\operatorname{smpf}(i)$ for $2 \le i \le n$.
E.g. $S(100)=1257$.
Find $S(10^{12}) \bmod 10^9$. | Let $\operatorname{smpf}(n)$ be the smallest prime factor of $n$.
$\operatorname{smpf}(91)=7$ because $91=7\times 13$ and $\operatorname{smpf}(45)=3$ because $45=3\times 3\times 5$.
Let $S(n)$ be the sum of $\operatorname{smpf}(i)$ for $2 \le i \le n$.
E.g. $S(100)=1257$.
Find $S(10^{12}) \bmod 10^9$. | <p>
Let $\operatorname{smpf}(n)$ be the smallest prime factor of $n$.<br/>
$\operatorname{smpf}(91)=7$ because $91=7\times 13$ and $\operatorname{smpf}(45)=3$ because $45=3\times 3\times 5$.<br/>
Let $S(n)$ be the sum of $\operatorname{smpf}(i)$ for $2 \le i \le n$.<br/>
E.g. $S(100)=1257$.
</p>
<p>
Find $S(10^{12}) \bmod 10^9$.
</p> | 44389811 | Sunday, 21st June 2015, 01:00 am | 853 | 50% | medium |
437 | Fibonacci Primitive Roots | When we calculate $8^n$ modulo $11$ for $n=0$ to $9$ we get: $1, 8, 9, 6, 4, 10, 3, 2, 5, 7$.
As we see all possible values from $1$ to $10$ occur. So $8$ is a primitive root of $11$.
But there is more:
If we take a closer look we see:
$1+8=9$
$8+9=17 \equiv 6 \bmod 11$
$9+6=15 \equiv 4 \bmod 11$
$6+4=10$
$4+10=14 \equiv 3 \bmod 11$
$10+3=13 \equiv 2 \bmod 11$
$3+2=5$
$2+5=7$
$5+7=12 \equiv 1 \bmod 11$.
So the powers of $8 \bmod 11$ are cyclic with period $10$, and $8^n + 8^{n+1} \equiv 8^{n+2} \pmod{11}$.
$8$ is called a Fibonacci primitive root of $11$.
Not every prime has a Fibonacci primitive root.
There are $323$ primes less than $10000$ with one or more Fibonacci primitive roots and the sum of these primes is $1480491$.
Find the sum of the primes less than $100\,000\,000$ with at least one Fibonacci primitive root. | When we calculate $8^n$ modulo $11$ for $n=0$ to $9$ we get: $1, 8, 9, 6, 4, 10, 3, 2, 5, 7$.
As we see all possible values from $1$ to $10$ occur. So $8$ is a primitive root of $11$.
But there is more:
If we take a closer look we see:
$1+8=9$
$8+9=17 \equiv 6 \bmod 11$
$9+6=15 \equiv 4 \bmod 11$
$6+4=10$
$4+10=14 \equiv 3 \bmod 11$
$10+3=13 \equiv 2 \bmod 11$
$3+2=5$
$2+5=7$
$5+7=12 \equiv 1 \bmod 11$.
So the powers of $8 \bmod 11$ are cyclic with period $10$, and $8^n + 8^{n+1} \equiv 8^{n+2} \pmod{11}$.
$8$ is called a Fibonacci primitive root of $11$.
Not every prime has a Fibonacci primitive root.
There are $323$ primes less than $10000$ with one or more Fibonacci primitive roots and the sum of these primes is $1480491$.
Find the sum of the primes less than $100\,000\,000$ with at least one Fibonacci primitive root. | <p>
When we calculate $8^n$ modulo $11$ for $n=0$ to $9$ we get: $1, 8, 9, 6, 4, 10, 3, 2, 5, 7$.<br/>
As we see all possible values from $1$ to $10$ occur. So $8$ is a <strong>primitive root</strong> of $11$.<br/>
But there is more:<br/>
If we take a closer look we see:<br/>
$1+8=9$<br/>
$8+9=17 \equiv 6 \bmod 11$<br/>
$9+6=15 \equiv 4 \bmod 11$<br/>
$6+4=10$<br/>
$4+10=14 \equiv 3 \bmod 11$<br/>
$10+3=13 \equiv 2 \bmod 11$<br/>
$3+2=5$<br/>
$2+5=7$<br/>
$5+7=12 \equiv 1 \bmod 11$.
</p>
So the powers of $8 \bmod 11$ are cyclic with period $10$, and $8^n + 8^{n+1} \equiv 8^{n+2} \pmod{11}$.<br/>
$8$ is called a <strong>Fibonacci primitive root</strong> of $11$.<br/>
Not every prime has a Fibonacci primitive root.<br/>
There are $323$ primes less than $10000$ with one or more Fibonacci primitive roots and the sum of these primes is $1480491$.<br/>
Find the sum of the primes less than $100\,000\,000$ with at least one Fibonacci primitive root. | 74204709657207 | Saturday, 21st September 2013, 10:00 pm | 903 | 35% | medium |
431 | Square Space Silo | Fred the farmer arranges to have a new storage silo installed on his farm and having an obsession for all things square he is absolutely devastated when he discovers that it is circular. Quentin, the representative from the company that installed the silo, explains that they only manufacture cylindrical silos, but he points out that it is resting on a square base. Fred is not amused and insists that it is removed from his property.
Quick thinking Quentin explains that when granular materials are delivered from above a conical slope is formed and the natural angle made with the horizontal is called the angle of repose. For example if the angle of repose, $\alpha = 30$ degrees, and grain is delivered at the centre of the silo then a perfect cone will form towards the top of the cylinder. In the case of this silo, which has a diameter of $6\mathrm m$, the amount of space wasted would be approximately $32.648388556\mathrm{m^3}$. However, if grain is delivered at a point on the top which has a horizontal distance of $x$ metres from the centre then a cone with a strangely curved and sloping base is formed. He shows Fred a picture.
We shall let the amount of space wasted in cubic metres be given by $V(x)$. If $x = 1.114785284$, which happens to have three squared decimal places, then the amount of space wasted, $V(1.114785284) \approx 36$. Given the range of possible solutions to this problem there is exactly one other option: $V(2.511167869) \approx 49$. It would be like knowing that the square is king of the silo, sitting in splendid glory on top of your grain.
Fred's eyes light up with delight at this elegant resolution, but on closer inspection of Quentin's drawings and calculations his happiness turns to despondency once more. Fred points out to Quentin that it's the radius of the silo that is $6$ metres, not the diameter, and the angle of repose for his grain is $40$ degrees. However, if Quentin can find a set of solutions for this particular silo then he will be more than happy to keep it.
If Quick thinking Quentin is to satisfy frustratingly fussy Fred the farmer's appetite for all things square then determine the values of $x$ for all possible square space wastage options and calculate $\sum x$ correct to $9$ decimal places. | Fred the farmer arranges to have a new storage silo installed on his farm and having an obsession for all things square he is absolutely devastated when he discovers that it is circular. Quentin, the representative from the company that installed the silo, explains that they only manufacture cylindrical silos, but he points out that it is resting on a square base. Fred is not amused and insists that it is removed from his property.
Quick thinking Quentin explains that when granular materials are delivered from above a conical slope is formed and the natural angle made with the horizontal is called the angle of repose. For example if the angle of repose, $\alpha = 30$ degrees, and grain is delivered at the centre of the silo then a perfect cone will form towards the top of the cylinder. In the case of this silo, which has a diameter of $6\mathrm m$, the amount of space wasted would be approximately $32.648388556\mathrm{m^3}$. However, if grain is delivered at a point on the top which has a horizontal distance of $x$ metres from the centre then a cone with a strangely curved and sloping base is formed. He shows Fred a picture.
We shall let the amount of space wasted in cubic metres be given by $V(x)$. If $x = 1.114785284$, which happens to have three squared decimal places, then the amount of space wasted, $V(1.114785284) \approx 36$. Given the range of possible solutions to this problem there is exactly one other option: $V(2.511167869) \approx 49$. It would be like knowing that the square is king of the silo, sitting in splendid glory on top of your grain.
Fred's eyes light up with delight at this elegant resolution, but on closer inspection of Quentin's drawings and calculations his happiness turns to despondency once more. Fred points out to Quentin that it's the radius of the silo that is $6$ metres, not the diameter, and the angle of repose for his grain is $40$ degrees. However, if Quentin can find a set of solutions for this particular silo then he will be more than happy to keep it.
If Quick thinking Quentin is to satisfy frustratingly fussy Fred the farmer's appetite for all things square then determine the values of $x$ for all possible square space wastage options and calculate $\sum x$ correct to $9$ decimal places. | <p>Fred the farmer arranges to have a new storage silo installed on his farm and having an obsession for all things square he is absolutely devastated when he discovers that it is circular. Quentin, the representative from the company that installed the silo, explains that they only manufacture cylindrical silos, but he points out that it is resting on a square base. Fred is not amused and insists that it is removed from his property.</p>
<p>Quick thinking Quentin explains that when granular materials are delivered from above a conical slope is formed and the natural angle made with the horizontal is called the angle of repose. For example if the angle of repose, $\alpha = 30$ degrees, and grain is delivered at the centre of the silo then a perfect cone will form towards the top of the cylinder. In the case of this silo, which has a diameter of $6\mathrm m$, the amount of space wasted would be approximately $32.648388556\mathrm{m^3}$. However, if grain is delivered at a point on the top which has a horizontal distance of $x$ metres from the centre then a cone with a strangely curved and sloping base is formed. He shows Fred a picture.</p>
<div class="center">
<img alt="0431_grain_silo.png" class="dark_img" src="resources/images/0431_grain_silo.png?1678992053"/></div>
<p>We shall let the amount of space wasted in cubic metres be given by $V(x)$. If $x = 1.114785284$, which happens to have three squared decimal places, then the amount of space wasted, $V(1.114785284) \approx 36$. Given the range of possible solutions to this problem there is exactly one other option: $V(2.511167869) \approx 49$. It would be like knowing that the square is king of the silo, sitting in splendid glory on top of your grain.</p>
<p>Fred's eyes light up with delight at this elegant resolution, but on closer inspection of Quentin's drawings and calculations his happiness turns to despondency once more. Fred points out to Quentin that it's the radius of the silo that is $6$ metres, not the diameter, and the angle of repose for his grain is $40$ degrees. However, if Quentin can find a set of solutions for this particular silo then he will be more than happy to keep it.</p>
<p>If Quick thinking Quentin is to satisfy frustratingly fussy Fred the farmer's appetite for all things square then determine the values of $x$ for all possible square space wastage options and calculate $\sum x$ correct to $9$ decimal places.</p> | 23.386029052 | Sunday, 9th June 2013, 10:00 am | 670 | 40% | medium |
263 | An Engineers' Dream Come True | Consider the number $6$. The divisors of $6$ are: $1,2,3$ and $6$.
Every number from $1$ up to and including $6$ can be written as a sum of distinct divisors of $6$:
$1=1$, $2=2$, $3=1+2$, $4=1+3$, $5=2+3$, $6=6$.
A number $n$ is called a practical number if every number from $1$ up to and including $n$ can be expressed as a sum of distinct divisors of $n$.
A pair of consecutive prime numbers with a difference of six is called a sexy pair (since "sex" is the Latin word for "six"). The first sexy pair is $(23, 29)$.
We may occasionally find a triple-pair, which means three consecutive sexy prime pairs, such that the second member of each pair is the first member of the next pair.
We shall call a number $n$ such that :
$(n-9, n-3)$, $(n-3,n+3)$, $(n+3, n+9)$ form a triple-pair, and
the numbers $n-8$, $n-4$, $n$, $n+4$ and $n+8$ are all practical,
an engineers’ paradise.
Find the sum of the first four engineers’ paradises. | Consider the number $6$. The divisors of $6$ are: $1,2,3$ and $6$.
Every number from $1$ up to and including $6$ can be written as a sum of distinct divisors of $6$:
$1=1$, $2=2$, $3=1+2$, $4=1+3$, $5=2+3$, $6=6$.
A number $n$ is called a practical number if every number from $1$ up to and including $n$ can be expressed as a sum of distinct divisors of $n$.
A pair of consecutive prime numbers with a difference of six is called a sexy pair (since "sex" is the Latin word for "six"). The first sexy pair is $(23, 29)$.
We may occasionally find a triple-pair, which means three consecutive sexy prime pairs, such that the second member of each pair is the first member of the next pair.
We shall call a number $n$ such that :
$(n-9, n-3)$, $(n-3,n+3)$, $(n+3, n+9)$ form a triple-pair, and
the numbers $n-8$, $n-4$, $n$, $n+4$ and $n+8$ are all practical,
an engineers’ paradise.
Find the sum of the first four engineers’ paradises. | <p>
Consider the number $6$. The divisors of $6$ are: $1,2,3$ and $6$.<br/>
Every number from $1$ up to and including $6$ can be written as a sum of distinct divisors of $6$:<br/>
$1=1$, $2=2$, $3=1+2$, $4=1+3$, $5=2+3$, $6=6$.<br/>
A number $n$ is called a practical number if every number from $1$ up to and including $n$ can be expressed as a sum of distinct divisors of $n$.
</p>
<p>
A pair of consecutive prime numbers with a difference of six is called a sexy pair (since "sex" is the Latin word for "six"). The first sexy pair is $(23, 29)$.
</p>
<p>
We may occasionally find a triple-pair, which means three consecutive sexy prime pairs, such that the second member of each pair is the first member of the next pair.
</p>
<p>
We shall call a number $n$ such that :
</p><ul><li>$(n-9, n-3)$, $(n-3,n+3)$, $(n+3, n+9)$ form a triple-pair, and
</li><li>the numbers $n-8$, $n-4$, $n$, $n+4$ and $n+8$ are all practical,
</li></ul>
an engineers’ paradise.
<p>
Find the sum of the first four engineers’ paradises.
</p> | 2039506520 | Saturday, 7th November 2009, 01:00 am | 1177 | 75% | hard |
243 | Resilience | A positive fraction whose numerator is less than its denominator is called a proper fraction.
For any denominator, $d$, there will be $d - 1$ proper fractions; for example, with $d = 12$:$1 / 12, 2 / 12, 3 / 12, 4 / 12, 5 / 12, 6 / 12, 7 / 12, 8 / 12, 9 / 12, 10 / 12, 11 / 12$.
We shall call a fraction that cannot be cancelled down a resilient fraction.
Furthermore we shall define the resilience of a denominator, $R(d)$, to be the ratio of its proper fractions that are resilient; for example, $R(12) = 4/11$.
In fact, $d = 12$ is the smallest denominator having a resilience $R(d) \lt 4/10$.
Find the smallest denominator $d$, having a resilience $R(d) \lt 15499/94744$. | A positive fraction whose numerator is less than its denominator is called a proper fraction.
For any denominator, $d$, there will be $d - 1$ proper fractions; for example, with $d = 12$:$1 / 12, 2 / 12, 3 / 12, 4 / 12, 5 / 12, 6 / 12, 7 / 12, 8 / 12, 9 / 12, 10 / 12, 11 / 12$.
We shall call a fraction that cannot be cancelled down a resilient fraction.
Furthermore we shall define the resilience of a denominator, $R(d)$, to be the ratio of its proper fractions that are resilient; for example, $R(12) = 4/11$.
In fact, $d = 12$ is the smallest denominator having a resilience $R(d) \lt 4/10$.
Find the smallest denominator $d$, having a resilience $R(d) \lt 15499/94744$. | <p>A positive fraction whose numerator is less than its denominator is called a proper fraction.<br/>
For any denominator, $d$, there will be $d - 1$ proper fractions; for example, with $d = 12$:<br/>$1 / 12, 2 / 12, 3 / 12, 4 / 12, 5 / 12, 6 / 12, 7 / 12, 8 / 12, 9 / 12, 10 / 12, 11 / 12$.
</p>
<p>We shall call a fraction that cannot be cancelled down a <dfn>resilient fraction</dfn>.<br/>
Furthermore we shall define the <dfn>resilience</dfn> of a denominator, $R(d)$, to be the ratio of its proper fractions that are resilient; for example, $R(12) = 4/11$.<br/>
In fact, $d = 12$ is the smallest denominator having a resilience $R(d) \lt 4/10$.</p>
<p>Find the smallest denominator $d$, having a resilience $R(d) \lt 15499/94744$.</p> | 892371480 | Saturday, 2nd May 2009, 10:00 am | 10366 | 35% | medium |
751 | Concatenation Coincidence | A non-decreasing sequence of integers $a_n$ can be generated from any positive real value $\theta$ by the following procedure:
\begin{align}
\begin{split}
b_1 &= \theta \\
b_n &= \left\lfloor b_{n-1} \right\rfloor \left(b_{n-1} - \left\lfloor b_{n-1} \right\rfloor + 1\right)~~~\forall ~ n \geq 2 \\
a_n &= \left\lfloor b_{n} \right\rfloor
\end{split}
\end{align}
Where $\left\lfloor \cdot \right\rfloor$ is the floor function.
For example, $\theta=2.956938891377988...$ generates the Fibonacci sequence: $2, 3, 5, 8, 13, 21, 34, 55, 89, ...$
The concatenation of a sequence of positive integers $a_n$ is a real value denoted $\tau$ constructed by concatenating the elements of the sequence after the decimal point, starting at $a_1$: $a_1.a_2a_3a_4...$
For example, the Fibonacci sequence constructed from $\theta=2.956938891377988...$ yields the concatenation $\tau=2.3581321345589...$ Clearly, $\tau \neq \theta$ for this value of $\theta$.
Find the only value of $\theta$ for which the generated sequence starts at $a_1=2$ and the concatenation of the generated sequence equals the original value: $\tau = \theta$. Give your answer rounded to $24$ places after the decimal point. | A non-decreasing sequence of integers $a_n$ can be generated from any positive real value $\theta$ by the following procedure:
\begin{align}
\begin{split}
b_1 &= \theta \\
b_n &= \left\lfloor b_{n-1} \right\rfloor \left(b_{n-1} - \left\lfloor b_{n-1} \right\rfloor + 1\right)~~~\forall ~ n \geq 2 \\
a_n &= \left\lfloor b_{n} \right\rfloor
\end{split}
\end{align}
Where $\left\lfloor \cdot \right\rfloor$ is the floor function.
For example, $\theta=2.956938891377988...$ generates the Fibonacci sequence: $2, 3, 5, 8, 13, 21, 34, 55, 89, ...$
The concatenation of a sequence of positive integers $a_n$ is a real value denoted $\tau$ constructed by concatenating the elements of the sequence after the decimal point, starting at $a_1$: $a_1.a_2a_3a_4...$
For example, the Fibonacci sequence constructed from $\theta=2.956938891377988...$ yields the concatenation $\tau=2.3581321345589...$ Clearly, $\tau \neq \theta$ for this value of $\theta$.
Find the only value of $\theta$ for which the generated sequence starts at $a_1=2$ and the concatenation of the generated sequence equals the original value: $\tau = \theta$. Give your answer rounded to $24$ places after the decimal point. | <p>A non-decreasing sequence of integers $a_n$ can be generated from any positive real value $\theta$ by the following procedure:
\begin{align}
\begin{split}
b_1 &= \theta \\
b_n &= \left\lfloor b_{n-1} \right\rfloor \left(b_{n-1} - \left\lfloor b_{n-1} \right\rfloor + 1\right)~~~\forall ~ n \geq 2 \\
a_n &= \left\lfloor b_{n} \right\rfloor
\end{split}
\end{align}
Where $\left\lfloor \cdot \right\rfloor$ is the floor function.</p>
<p>For example, $\theta=2.956938891377988...$ generates the Fibonacci sequence: $2, 3, 5, 8, 13, 21, 34, 55, 89, ...$</p>
<p>The <i>concatenation</i> of a sequence of positive integers $a_n$ is a real value denoted $\tau$ constructed by concatenating the elements of the sequence after the decimal point, starting at $a_1$: $a_1.a_2a_3a_4...$</p>
<p>For example, the Fibonacci sequence constructed from $\theta=2.956938891377988...$ yields the concatenation $\tau=2.3581321345589...$ Clearly, $\tau \neq \theta$ for this value of $\theta$.</p>
<p>Find the only value of $\theta$ for which the generated sequence starts at $a_1=2$ and the concatenation of the generated sequence equals the original value: $\tau = \theta$. Give your answer rounded to $24$ places after the decimal point.</p> | 2.223561019313554106173177 | Saturday, 13th March 2021, 10:00 pm | 2543 | 5% | easy |
597 | Torpids | The Torpids are rowing races held annually in Oxford, following some curious rules:
A division consists of $n$ boats (typically 13), placed in order based on past performance.
All boats within a division start at 40 metre intervals along the river, in order with the highest-placed boat starting furthest upstream.
The boats all start rowing simultaneously, upstream, trying to catch the boat in front while avoiding being caught by boats behind.
Each boat continues rowing until either it reaches the finish line or it catches up with ("bumps") a boat in front.
The finish line is a distance $L$ metres (the course length, in reality about 1800 metres) upstream from the starting position of the lowest-placed boat. (Because of the staggered starting positions, higher-placed boats row a slightly shorter course than lower-placed boats.)
When a "bump" occurs, the "bumping" boat takes no further part in the race. The "bumped" boat must continue, however, and may even be "bumped" again by boats that started two or more places behind it.
After the race, boats are assigned new places within the division, based on the bumps that occurred. Specifically, for any boat $A$ that started in a lower place than $B$, then $A$ will be placed higher than $B$ in the new order if and only if one of the following occurred:
$A$ bumped $B$ directly
$A$ bumped another boat that went on to bump $B$
$A$ bumped another boat, that bumped yet another boat, that bumped $B$
etc NOTE: For the purposes of this problem you may disregard the boats' lengths, and assume that a bump occurs precisely when the two boats draw level. (In reality, a bump is awarded as soon as physical contact is made, which usually occurs when there is much less than a full boat length's overlap.)
Suppose that, in a particular race, each boat $B_j$ rows at a steady speed $v_j = -$log$X_j$ metres per second, where the $X_j$ are chosen randomly (with uniform distribution) between 0 and 1, independently from one another. These speeds are relative to the riverbank: you may disregard the flow of the river.
Let $p(n,L)$ be the probability that the new order is an even permutation of the starting order, when there are $n$ boats in the division and $L$ is the course length.
For example, with $n=3$ and $L=160$, labelling the boats as $A$,$B$,$C$ in starting order with $C$ highest, the different possible outcomes of the race are as follows:
Bumps occurring
New order
Permutation
Probability
none
$A$, $B$, $C$
even
$4/15$
$B$ bumps $C$
$A$, $C$, $B$
odd
$8/45$
$A$ bumps $B$
$B$, $A$, $C$
odd
$1/3$
$B$ bumps $C$, then $A$ bumps $C$
$C$, $A$, $B$
even
$4/27$
$A$ bumps $B$, then $B$ bumps $C$
$C$, $B$, $A$
odd
$2/27$
Therefore, $p(3,160) = 4/15 + 4/27 = 56/135$.
You are also given that $p(4,400)=0.5107843137$, rounded to 10 digits after the decimal point.
Find $p(13,1800)$ rounded to 10 digits after the decimal point. | The Torpids are rowing races held annually in Oxford, following some curious rules:
A division consists of $n$ boats (typically 13), placed in order based on past performance.
All boats within a division start at 40 metre intervals along the river, in order with the highest-placed boat starting furthest upstream.
The boats all start rowing simultaneously, upstream, trying to catch the boat in front while avoiding being caught by boats behind.
Each boat continues rowing until either it reaches the finish line or it catches up with ("bumps") a boat in front.
The finish line is a distance $L$ metres (the course length, in reality about 1800 metres) upstream from the starting position of the lowest-placed boat. (Because of the staggered starting positions, higher-placed boats row a slightly shorter course than lower-placed boats.)
When a "bump" occurs, the "bumping" boat takes no further part in the race. The "bumped" boat must continue, however, and may even be "bumped" again by boats that started two or more places behind it.
After the race, boats are assigned new places within the division, based on the bumps that occurred. Specifically, for any boat $A$ that started in a lower place than $B$, then $A$ will be placed higher than $B$ in the new order if and only if one of the following occurred:
$A$ bumped $B$ directly
$A$ bumped another boat that went on to bump $B$
$A$ bumped another boat, that bumped yet another boat, that bumped $B$
etc NOTE: For the purposes of this problem you may disregard the boats' lengths, and assume that a bump occurs precisely when the two boats draw level. (In reality, a bump is awarded as soon as physical contact is made, which usually occurs when there is much less than a full boat length's overlap.)
Suppose that, in a particular race, each boat $B_j$ rows at a steady speed $v_j = -$log$X_j$ metres per second, where the $X_j$ are chosen randomly (with uniform distribution) between 0 and 1, independently from one another. These speeds are relative to the riverbank: you may disregard the flow of the river.
Let $p(n,L)$ be the probability that the new order is an even permutation of the starting order, when there are $n$ boats in the division and $L$ is the course length.
For example, with $n=3$ and $L=160$, labelling the boats as $A$,$B$,$C$ in starting order with $C$ highest, the different possible outcomes of the race are as follows:
Bumps occurring
New order
Permutation
Probability
none
$A$, $B$, $C$
even
$4/15$
$B$ bumps $C$
$A$, $C$, $B$
odd
$8/45$
$A$ bumps $B$
$B$, $A$, $C$
odd
$1/3$
$B$ bumps $C$, then $A$ bumps $C$
$C$, $A$, $B$
even
$4/27$
$A$ bumps $B$, then $B$ bumps $C$
$C$, $B$, $A$
odd
$2/27$
Therefore, $p(3,160) = 4/15 + 4/27 = 56/135$.
You are also given that $p(4,400)=0.5107843137$, rounded to 10 digits after the decimal point.
Find $p(13,1800)$ rounded to 10 digits after the decimal point. | The Torpids are rowing races held annually in Oxford, following some curious rules:
<ul><li>
A division consists of $n$ boats (typically 13), placed in order based on past performance.
</li><li>
All boats within a division start at 40 metre intervals along the river, in order with the highest-placed boat starting furthest upstream.
</li><li>
The boats all start rowing simultaneously, upstream, trying to catch the boat in front while avoiding being caught by boats behind.
</li><li>
Each boat continues rowing until <em>either</em> it reaches the finish line <em>or</em> it catches up with ("bumps") a boat in front.
</li><li>
The finish line is a distance $L$ metres (the course length, in reality about 1800 metres) upstream from the starting position of the lowest-placed boat. (Because of the staggered starting positions, higher-placed boats row a slightly shorter course than lower-placed boats.)
</li><li>
When a "bump" occurs, the "bumping" boat takes no further part in the race. The "bumped" boat must continue, however, and may even be "bumped" again by boats that started two or more places behind it.
</li><li>
After the race, boats are assigned new places within the division, based on the bumps that occurred. Specifically, for any boat $A$ that started in a lower place than $B$, then $A$ will be placed higher than $B$ in the new order if and only if one of the following occurred:
<ol><li> $A$ bumped $B$ directly </li>
<li> $A$ bumped another boat that went on to bump $B$ </li>
<li> $A$ bumped another boat, that bumped yet another boat, that bumped $B$ </li>
<li> etc </li></ol></li></ul><b>NOTE</b>: For the purposes of this problem you may disregard the boats' lengths, and assume that a bump occurs precisely when the two boats draw level. (In reality, a bump is awarded as soon as physical contact is made, which usually occurs when there is much less than a full boat length's overlap.)
<p>
Suppose that, in a particular race, each boat $B_j$ rows at a steady speed $v_j = -$log$X_j$ metres per second, where the $X_j$ are chosen randomly (with uniform distribution) between 0 and 1, independently from one another. These speeds are relative to the riverbank: you may disregard the flow of the river.
</p>
<p>
Let $p(n,L)$ be the probability that the new order is an <b>even permutation</b> of the starting order, when there are $n$ boats in the division and $L$ is the course length.
</p>
<p>
For example, with $n=3$ and $L=160$, labelling the boats as $A$,$B$,$C$ in starting order with $C$ highest, the different possible outcomes of the race are as follows:
</p>
<table align="center" cellspacing="15"><tr><th> Bumps occurring </th>
<th> New order </th>
<th> Permutation </th>
<th> Probability </th>
</tr><tr align="center"><td> none </td>
<td> $A$, $B$, $C$ </td>
<td> even </td>
<td> $4/15$ </td>
</tr><tr align="center"><td> $B$ bumps $C$ </td>
<td> $A$, $C$, $B$ </td>
<td> odd </td>
<td> $8/45$ </td>
</tr><tr align="center"><td> $A$ bumps $B$ </td>
<td> $B$, $A$, $C$ </td>
<td> odd </td>
<td> $1/3$ </td>
</tr><tr align="center"><td> $B$ bumps $C$, then $A$ bumps $C$ </td>
<td> $C$, $A$, $B$ </td>
<td> even </td>
<td> $4/27$ </td>
</tr><tr align="center"><td> $A$ bumps $B$, then $B$ bumps $C$ </td>
<td> $C$, $B$, $A$ </td>
<td> odd </td>
<td> $2/27$ </td>
</tr></table><p>
Therefore, $p(3,160) = 4/15 + 4/27 = 56/135$.
</p>
<p>
You are also given that $p(4,400)=0.5107843137$, rounded to 10 digits after the decimal point.
</p>
<p>
Find $p(13,1800)$ rounded to 10 digits after the decimal point.
</p> | 0.5001817828 | Sunday, 2nd April 2017, 07:00 am | 188 | 100% | hard |
812 | Dynamical Polynomials | A dynamical polynomial is a monicleading coefficient is $1$ polynomial $f(x)$ with integer coefficients such that $f(x)$ divides $f(x^2-2)$.
For example, $f(x) = x^2 - x - 2$ is a dynamical polynomial because $f(x^2-2) = x^4-5x^2+4 = (x^2 + x -2)f(x)$.
Let $S(n)$ be the number of dynamical polynomials of degree $n$.
For example, $S(2)=6$, as there are six dynamical polynomials of degree $2$:
$$ x^2-4x+4 \quad,\quad x^2-x-2 \quad,\quad x^2-4 \quad,\quad x^2-1 \quad,\quad x^2+x-1 \quad,\quad x^2+2x+1 $$
Also, $S(5)=58$ and $S(20)=122087$.
Find $S(10\,000)$. Give your answer modulo $998244353$. | A dynamical polynomial is a monicleading coefficient is $1$ polynomial $f(x)$ with integer coefficients such that $f(x)$ divides $f(x^2-2)$.
For example, $f(x) = x^2 - x - 2$ is a dynamical polynomial because $f(x^2-2) = x^4-5x^2+4 = (x^2 + x -2)f(x)$.
Let $S(n)$ be the number of dynamical polynomials of degree $n$.
For example, $S(2)=6$, as there are six dynamical polynomials of degree $2$:
$$ x^2-4x+4 \quad,\quad x^2-x-2 \quad,\quad x^2-4 \quad,\quad x^2-1 \quad,\quad x^2+x-1 \quad,\quad x^2+2x+1 $$
Also, $S(5)=58$ and $S(20)=122087$.
Find $S(10\,000)$. Give your answer modulo $998244353$. | <p>A <dfn>dynamical polynomial</dfn> is a <strong class="tooltip">monic<span class="tooltiptext">leading coefficient is $1$</span></strong> polynomial $f(x)$ with integer coefficients such that $f(x)$ divides $f(x^2-2)$.</p>
<p>For example, $f(x) = x^2 - x - 2$ is a dynamical polynomial because $f(x^2-2) = x^4-5x^2+4 = (x^2 + x -2)f(x)$.</p>
<p>Let $S(n)$ be the number of dynamical polynomials of degree $n$.<br/>
For example, $S(2)=6$, as there are six dynamical polynomials of degree $2$:</p>
$$ x^2-4x+4 \quad,\quad x^2-x-2 \quad,\quad x^2-4 \quad,\quad x^2-1 \quad,\quad x^2+x-1 \quad,\quad x^2+2x+1 $$
<p>Also, $S(5)=58$ and $S(20)=122087$.</p>
<p>Find $S(10\,000)$. Give your answer modulo $998244353$.</p> | 986262698 | Saturday, 15th October 2022, 05:00 pm | 141 | 100% | hard |
487 | Sums of Power Sums | Let $f_k(n)$ be the sum of the $k$th powers of the first $n$ positive integers.
For example, $f_2(10) = 1^2 + 2^2 + 3^2 + 4^2 + 5^2 + 6^2 + 7^2 + 8^2 + 9^2 + 10^2 = 385$.
Let $S_k(n)$ be the sum of $f_k(i)$ for $1 \le i \le n$. For example, $S_4(100) = 35375333830$.
What is $\sum (S_{10000}(10^{12}) \bmod p)$ over all primes $p$ between $2 \cdot 10^9$ and $2 \cdot 10^9 + 2000$? | Let $f_k(n)$ be the sum of the $k$th powers of the first $n$ positive integers.
For example, $f_2(10) = 1^2 + 2^2 + 3^2 + 4^2 + 5^2 + 6^2 + 7^2 + 8^2 + 9^2 + 10^2 = 385$.
Let $S_k(n)$ be the sum of $f_k(i)$ for $1 \le i \le n$. For example, $S_4(100) = 35375333830$.
What is $\sum (S_{10000}(10^{12}) \bmod p)$ over all primes $p$ between $2 \cdot 10^9$ and $2 \cdot 10^9 + 2000$? | <p>Let $f_k(n)$ be the sum of the $k$<sup>th</sup> powers of the first $n$ positive integers.</p>
<p>For example, $f_2(10) = 1^2 + 2^2 + 3^2 + 4^2 + 5^2 + 6^2 + 7^2 + 8^2 + 9^2 + 10^2 = 385$.</p>
<p>Let $S_k(n)$ be the sum of $f_k(i)$ for $1 \le i \le n$. For example, $S_4(100) = 35375333830$.</p>
<p>What is $\sum (S_{10000}(10^{12}) \bmod p)$ over all primes $p$ between $2 \cdot 10^9$ and $2 \cdot 10^9 + 2000$?</p> | 106650212746 | Saturday, 1st November 2014, 10:00 pm | 731 | 40% | medium |
104 | Pandigital Fibonacci Ends | The Fibonacci sequence is defined by the recurrence relation:
$F_n = F_{n - 1} + F_{n - 2}$, where $F_1 = 1$ and $F_2 = 1$.
It turns out that $F_{541}$, which contains $113$ digits, is the first Fibonacci number for which the last nine digits are $1$-$9$ pandigital (contain all the digits $1$ to $9$, but not necessarily in order). And $F_{2749}$, which contains $575$ digits, is the first Fibonacci number for which the first nine digits are $1$-$9$ pandigital.
Given that $F_k$ is the first Fibonacci number for which the first nine digits AND the last nine digits are $1$-$9$ pandigital, find $k$. | The Fibonacci sequence is defined by the recurrence relation:
$F_n = F_{n - 1} + F_{n - 2}$, where $F_1 = 1$ and $F_2 = 1$.
It turns out that $F_{541}$, which contains $113$ digits, is the first Fibonacci number for which the last nine digits are $1$-$9$ pandigital (contain all the digits $1$ to $9$, but not necessarily in order). And $F_{2749}$, which contains $575$ digits, is the first Fibonacci number for which the first nine digits are $1$-$9$ pandigital.
Given that $F_k$ is the first Fibonacci number for which the first nine digits AND the last nine digits are $1$-$9$ pandigital, find $k$. | <p>The Fibonacci sequence is defined by the recurrence relation:</p>
<blockquote>$F_n = F_{n - 1} + F_{n - 2}$, where $F_1 = 1$ and $F_2 = 1$.</blockquote>
<p>It turns out that $F_{541}$, which contains $113$ digits, is the first Fibonacci number for which the last nine digits are $1$-$9$ pandigital (contain all the digits $1$ to $9$, but not necessarily in order). And $F_{2749}$, which contains $575$ digits, is the first Fibonacci number for which the first nine digits are $1$-$9$ pandigital.</p>
<p>Given that $F_k$ is the first Fibonacci number for which the first nine digits AND the last nine digits are $1$-$9$ pandigital, find $k$.</p> | 329468 | Friday, 9th September 2005, 06:00 pm | 17904 | 25% | easy |
415 | Titanic Sets | A set of lattice points $S$ is called a titanic set if there exists a line passing through exactly two points in $S$.
An example of a titanic set is $S = \{(0, 0), (0, 1), (0, 2), (1, 1), (2, 0), (1, 0)\}$, where the line passing through $(0, 1)$ and $(2, 0)$ does not pass through any other point in $S$.
On the other hand, the set $\{(0, 0), (1, 1), (2, 2), (4, 4)\}$ is not a titanic set since the line passing through any two points in the set also passes through the other two.
For any positive integer $N$, let $T(N)$ be the number of titanic sets $S$ whose every point $(x, y)$ satisfies $0 \leq x, y \leq N$.
It can be verified that $T(1) = 11$, $T(2) = 494$, $T(4) = 33554178$, $T(111) \bmod 10^8 = 13500401$ and $T(10^5) \bmod 10^8 = 63259062$.
Find $T(10^{11})\bmod 10^8$. | A set of lattice points $S$ is called a titanic set if there exists a line passing through exactly two points in $S$.
An example of a titanic set is $S = \{(0, 0), (0, 1), (0, 2), (1, 1), (2, 0), (1, 0)\}$, where the line passing through $(0, 1)$ and $(2, 0)$ does not pass through any other point in $S$.
On the other hand, the set $\{(0, 0), (1, 1), (2, 2), (4, 4)\}$ is not a titanic set since the line passing through any two points in the set also passes through the other two.
For any positive integer $N$, let $T(N)$ be the number of titanic sets $S$ whose every point $(x, y)$ satisfies $0 \leq x, y \leq N$.
It can be verified that $T(1) = 11$, $T(2) = 494$, $T(4) = 33554178$, $T(111) \bmod 10^8 = 13500401$ and $T(10^5) \bmod 10^8 = 63259062$.
Find $T(10^{11})\bmod 10^8$. | <p>A set of lattice points $S$ is called a <dfn>titanic set</dfn> if there exists a line passing through exactly two points in $S$.</p>
<p>An example of a titanic set is $S = \{(0, 0), (0, 1), (0, 2), (1, 1), (2, 0), (1, 0)\}$, where the line passing through $(0, 1)$ and $(2, 0)$ does not pass through any other point in $S$.</p>
<p>On the other hand, the set $\{(0, 0), (1, 1), (2, 2), (4, 4)\}$ is not a titanic set since the line passing through any two points in the set also passes through the other two.</p>
<p>For any positive integer $N$, let $T(N)$ be the number of titanic sets $S$ whose every point $(x, y)$ satisfies $0 \leq x, y \leq N$.
It can be verified that $T(1) = 11$, $T(2) = 494$, $T(4) = 33554178$, $T(111) \bmod 10^8 = 13500401$ and $T(10^5) \bmod 10^8 = 63259062$.</p>
<p>Find $T(10^{11})\bmod 10^8$.</p> | 55859742 | Sunday, 17th February 2013, 10:00 am | 358 | 100% | hard |
328 | Lowest-cost Search | We are trying to find a hidden number selected from the set of integers $\{1, 2, \dots, n\}$ by asking questions.
Each number (question) we ask, has a cost equal to the number asked and we get one of three possible answers: "Your guess is lower than the hidden number", or
"Yes, that's it!", or
"Your guess is higher than the hidden number".
Given the value of $n$, an optimal strategy minimizes the total cost (i.e. the sum of all the questions asked) for the worst possible case. E.g.
If $n=3$, the best we can do is obviously to ask the number "2". The answer will immediately lead us to find the hidden number (at a total cost $= 2$).
If $n=8$, we might decide to use a "binary search" type of strategy: Our first question would be "$\mathbf 4$" and if the hidden number is higher than $4$ we will need one or two additional questions.
Let our second question be "$\mathbf 6$". If the hidden number is still higher than $6$, we will need a third question in order to discriminate between $7$ and $8$.
Thus, our third question will be "$\mathbf 7$" and the total cost for this worst-case scenario will be $4+6+7={\color{red}\mathbf{17}}$.
We can improve considerably the worst-case cost for $n=8$, by asking "$\mathbf 5$" as our first question.
If we are told that the hidden number is higher than $5$, our second question will be "$\mathbf 7$", then we'll know for certain what the hidden number is (for a total cost of $5+7={\color{blue}\mathbf{12}}$).
If we are told that the hidden number is lower than $5$, our second question will be "$\mathbf 3$" and if the hidden number is lower than $3$ our third question will be "$\mathbf 1$", giving a total cost of $5+3+1={\color{blue}\mathbf 9}$.
Since ${\color{blue}\mathbf{12}} \gt {\color{blue}\mathbf 9}$, the worst-case cost for this strategy is ${\color{red}\mathbf{12}}$. That's better than what we achieved previously with the "binary search" strategy; it is also better than or equal to any other strategy.
So, in fact, we have just described an optimal strategy for $n=8$.
Let $C(n)$ be the worst-case cost achieved by an optimal strategy for $n$, as described above.
Thus $C(1) = 0$, $C(2) = 1$, $C(3) = 2$ and $C(8) = 12$.
Similarly, $C(100) = 400$ and $\sum \limits_{n = 1}^{100} C(n) = 17575$.
Find $\sum \limits_{n = 1}^{200000} C(n)$. | We are trying to find a hidden number selected from the set of integers $\{1, 2, \dots, n\}$ by asking questions.
Each number (question) we ask, has a cost equal to the number asked and we get one of three possible answers: "Your guess is lower than the hidden number", or
"Yes, that's it!", or
"Your guess is higher than the hidden number".
Given the value of $n$, an optimal strategy minimizes the total cost (i.e. the sum of all the questions asked) for the worst possible case. E.g.
If $n=3$, the best we can do is obviously to ask the number "2". The answer will immediately lead us to find the hidden number (at a total cost $= 2$).
If $n=8$, we might decide to use a "binary search" type of strategy: Our first question would be "$\mathbf 4$" and if the hidden number is higher than $4$ we will need one or two additional questions.
Let our second question be "$\mathbf 6$". If the hidden number is still higher than $6$, we will need a third question in order to discriminate between $7$ and $8$.
Thus, our third question will be "$\mathbf 7$" and the total cost for this worst-case scenario will be $4+6+7={\color{red}\mathbf{17}}$.
We can improve considerably the worst-case cost for $n=8$, by asking "$\mathbf 5$" as our first question.
If we are told that the hidden number is higher than $5$, our second question will be "$\mathbf 7$", then we'll know for certain what the hidden number is (for a total cost of $5+7={\color{blue}\mathbf{12}}$).
If we are told that the hidden number is lower than $5$, our second question will be "$\mathbf 3$" and if the hidden number is lower than $3$ our third question will be "$\mathbf 1$", giving a total cost of $5+3+1={\color{blue}\mathbf 9}$.
Since ${\color{blue}\mathbf{12}} \gt {\color{blue}\mathbf 9}$, the worst-case cost for this strategy is ${\color{red}\mathbf{12}}$. That's better than what we achieved previously with the "binary search" strategy; it is also better than or equal to any other strategy.
So, in fact, we have just described an optimal strategy for $n=8$.
Let $C(n)$ be the worst-case cost achieved by an optimal strategy for $n$, as described above.
Thus $C(1) = 0$, $C(2) = 1$, $C(3) = 2$ and $C(8) = 12$.
Similarly, $C(100) = 400$ and $\sum \limits_{n = 1}^{100} C(n) = 17575$.
Find $\sum \limits_{n = 1}^{200000} C(n)$. | <p>We are trying to find a hidden number selected from the set of integers $\{1, 2, \dots, n\}$ by asking questions.
Each number (question) we ask, has a <u>cost equal to the number asked</u> and we get one of three possible answers:<br/></p><ul><li> "Your guess is lower than the hidden number", or</li>
<li> "Yes, that's it!", or</li>
<li> "Your guess is higher than the hidden number".</li>
</ul><p>Given the value of $n$, an <dfn>optimal strategy</dfn> minimizes the total cost (i.e. the sum of all the questions asked) <u>for the worst possible case</u>. E.g.</p>
<p>If $n=3$, the best we can do is obviously to ask the number "<b>2</b>". The answer will immediately lead us to find the hidden number (at a total cost $= 2$).</p>
<p>If $n=8$, we might decide to use a "binary search" type of strategy: Our first question would be "$\mathbf 4$" and if the hidden number is higher than $4$ we will need one or two additional questions.<br/>
Let our second question be "$\mathbf 6$". If the hidden number is still higher than $6$, we will need a third question in order to discriminate between $7$ and $8$.<br/>
Thus, our third question will be "$\mathbf 7$" and the total cost for this worst-case scenario will be $4+6+7={\color{red}\mathbf{17}}$.</p>
<p>We can improve considerably the worst-case cost for $n=8$, by asking "$\mathbf 5$" as our first question.<br/>
If we are told that the hidden number is higher than $5$, our second question will be "$\mathbf 7$", then we'll know for certain what the hidden number is (for a total cost of $5+7={\color{blue}\mathbf{12}}$).<br/>
If we are told that the hidden number is lower than $5$, our second question will be "$\mathbf 3$" and if the hidden number is lower than $3$ our third question will be "$\mathbf 1$", giving a total cost of $5+3+1={\color{blue}\mathbf 9}$.<br/>
Since ${\color{blue}\mathbf{12}} \gt {\color{blue}\mathbf 9}$, the worst-case cost for this strategy is ${\color{red}\mathbf{12}}$. That's better than what we achieved previously with the "binary search" strategy; it is also better than or equal to any other strategy.<br/>
So, in fact, we have just described an optimal strategy for $n=8$.</p>
<p>Let $C(n)$ be the worst-case cost achieved by an optimal strategy for $n$, as described above.<br/>
Thus $C(1) = 0$, $C(2) = 1$, $C(3) = 2$ and $C(8) = 12$.<br/>
Similarly, $C(100) = 400$ and $\sum \limits_{n = 1}^{100} C(n) = 17575$.</p>
<p>Find $\sum \limits_{n = 1}^{200000} C(n)$.</p> | 260511850222 | Saturday, 12th March 2011, 10:00 pm | 500 | 95% | hard |
105 | Special Subset Sums: 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 example, $\{81, 88, 75, 42, 87, 84, 86, 65\}$ is not a special sum set because $65 + 87 + 88 = 75 + 81 + 84$, whereas $\{157, 150, 164, 119, 79, 159, 161, 139, 158\}$ satisfies both rules for all possible subset pair combinations and $S(A) = 1286$.
Using sets.txt (right click and "Save Link/Target As..."), a 4K text file with one-hundred sets containing seven to twelve elements (the two examples given above are the first two sets in the file), identify all the special sum sets, $A_1, A_2, \dots, A_k$, and find the value of $S(A_1) + S(A_2) + \cdots + S(A_k)$.
NOTE: This problem is related to Problem 103 and Problem 106. | 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 example, $\{81, 88, 75, 42, 87, 84, 86, 65\}$ is not a special sum set because $65 + 87 + 88 = 75 + 81 + 84$, whereas $\{157, 150, 164, 119, 79, 159, 161, 139, 158\}$ satisfies both rules for all possible subset pair combinations and $S(A) = 1286$.
Using sets.txt (right click and "Save Link/Target As..."), a 4K text file with one-hundred sets containing seven to twelve elements (the two examples given above are the first two sets in the file), identify all the special sum sets, $A_1, A_2, \dots, A_k$, and find the value of $S(A_1) + S(A_2) + \cdots + S(A_k)$.
NOTE: This problem is related to Problem 103 and Problem 106. | <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 example, $\{81, 88, 75, 42, 87, 84, 86, 65\}$ is not a special sum set because $65 + 87 + 88 = 75 + 81 + 84$, whereas $\{157, 150, 164, 119, 79, 159, 161, 139, 158\}$ satisfies both rules for all possible subset pair combinations and $S(A) = 1286$.</p>
<p>Using <a href="resources/documents/0105_sets.txt">sets.txt</a> (right click and "Save Link/Target As..."), a 4K text file with one-hundred sets containing seven to twelve elements (the two examples given above are the first two sets in the file), identify all the special sum sets, $A_1, A_2, \dots, A_k$, and find the value of $S(A_1) + S(A_2) + \cdots + S(A_k)$.</p>
<p class="smaller">NOTE: This problem is related to <a href="problem=103">Problem 103</a> and <a href="problem=106">Problem 106</a>.</p> | 73702 | Friday, 23rd September 2005, 06:00 pm | 9108 | 45% | medium |
772 | Balanceable $k$-bounded Partitions | A $k$-bounded partition of a positive integer $N$ is a way of writing $N$ as a sum of positive integers not exceeding $k$.
A balanceable partition is a partition that can be further divided into two parts of equal sums.
For example, $3 + 2 + 2 + 2 + 2 + 1$ is a balanceable $3$-bounded partition of $12$ since $3 + 2 + 1 = 2 + 2 + 2$. Conversely, $3 + 3 + 3 + 1$ is a $3$-bounded partition of $10$ which is not balanceable.
Let $f(k)$ be the smallest positive integer $N$ all of whose $k$-bounded partitions are balanceable. For example, $f(3) = 12$ and $f(30) \equiv 179092994 \pmod {1\,000\,000\,007}$.
Find $f(10^8)$. Give your answer modulo $1\,000\,000\,007$. | A $k$-bounded partition of a positive integer $N$ is a way of writing $N$ as a sum of positive integers not exceeding $k$.
A balanceable partition is a partition that can be further divided into two parts of equal sums.
For example, $3 + 2 + 2 + 2 + 2 + 1$ is a balanceable $3$-bounded partition of $12$ since $3 + 2 + 1 = 2 + 2 + 2$. Conversely, $3 + 3 + 3 + 1$ is a $3$-bounded partition of $10$ which is not balanceable.
Let $f(k)$ be the smallest positive integer $N$ all of whose $k$-bounded partitions are balanceable. For example, $f(3) = 12$ and $f(30) \equiv 179092994 \pmod {1\,000\,000\,007}$.
Find $f(10^8)$. Give your answer modulo $1\,000\,000\,007$. | <p>A $k$-bounded partition of a positive integer $N$ is a way of writing $N$ as a sum of positive integers not exceeding $k$.</p>
<p>A balanceable partition is a partition that can be further divided into two parts of equal sums.</p>
<p>For example, $3 + 2 + 2 + 2 + 2 + 1$ is a balanceable $3$-bounded partition of $12$ since $3 + 2 + 1 = 2 + 2 + 2$. Conversely, $3 + 3 + 3 + 1$ is a $3$-bounded partition of $10$ which is not balanceable.</p>
<p>Let $f(k)$ be the smallest positive integer $N$ all of whose $k$-bounded partitions are balanceable. For example, $f(3) = 12$ and $f(30) \equiv 179092994 \pmod {1\,000\,000\,007}$.</p>
<p>Find $f(10^8)$. Give your answer modulo $1\,000\,000\,007$.</p> | 83985379 | Saturday, 13th November 2021, 04:00 pm | 555 | 20% | easy |
832 | Mex Sequence | In this problem $\oplus$ is used to represent the bitwise exclusive or of two numbers.
Starting with blank paper repeatedly do the following:
Write down the smallest positive integer $a$ which is currently not on the paper;
Find the smallest positive integer $b$ such that neither $b$ nor $(a \oplus b)$ is currently on the paper. Then write down both $b$ and $(a \oplus b)$.
After the first round $\{1,2,3\}$ will be written on the paper. In the second round $a=4$ and because $(4 \oplus 5)$, $(4 \oplus 6)$ and $(4 \oplus 7)$ are all already written $b$ must be $8$.
After $n$ rounds there will be $3n$ numbers on the paper. Their sum is denoted by $M(n)$.
For example, $M(10) = 642$ and $M(1000) = 5432148$.
Find $M(10^{18})$. Give your answer modulo $1\,000\,000\,007$. | In this problem $\oplus$ is used to represent the bitwise exclusive or of two numbers.
Starting with blank paper repeatedly do the following:
Write down the smallest positive integer $a$ which is currently not on the paper;
Find the smallest positive integer $b$ such that neither $b$ nor $(a \oplus b)$ is currently on the paper. Then write down both $b$ and $(a \oplus b)$.
After the first round $\{1,2,3\}$ will be written on the paper. In the second round $a=4$ and because $(4 \oplus 5)$, $(4 \oplus 6)$ and $(4 \oplus 7)$ are all already written $b$ must be $8$.
After $n$ rounds there will be $3n$ numbers on the paper. Their sum is denoted by $M(n)$.
For example, $M(10) = 642$ and $M(1000) = 5432148$.
Find $M(10^{18})$. Give your answer modulo $1\,000\,000\,007$. | <p>
In this problem $\oplus$ is used to represent the bitwise <strong>exclusive or</strong> of two numbers.<br>
Starting with blank paper repeatedly do the following:</br></p>
<ol type="1">
<li>Write down the smallest positive integer $a$ which is currently not on the paper;</li>
<li>Find the smallest positive integer $b$ such that neither $b$ nor $(a \oplus b)$ is currently on the paper. Then write down both $b$ and <span style="white-space:nowrap;">$(a \oplus b)$.</span></li>
</ol>
<p>
After the first round $\{1,2,3\}$ will be written on the paper. In the second round $a=4$ and because <span style="white-space:nowrap;">$(4 \oplus 5)$,</span> $(4 \oplus 6)$ and $(4 \oplus 7)$ are all already written $b$ must be <span style="white-space:nowrap;">$8$.</span></p>
<p>
After $n$ rounds there will be $3n$ numbers on the paper. Their sum is denoted by <span style="white-space:nowrap;">$M(n)$.</span><br/>
For example, $M(10) = 642$ and <span style="white-space:nowrap;">$M(1000) = 5432148$.</span></p>
<p>
Find <span style="white-space:nowrap;">$M(10^{18})$.</span> Give your answer modulo <span style="white-space:nowrap;">$1\,000\,000\,007$.</span></p> | 552839586 | Sunday, 5th March 2023, 04:00 am | 337 | 30% | easy |
769 | Binary Quadratic Form II | Consider the following binary quadratic form:
$$
\begin{align}
f(x,y)=x^2+5xy+3y^2
\end{align}
$$
A positive integer $q$ has a primitive representation if there exist positive integers $x$ and $y$ such that $q = f(x,y)$ and $\gcd(x,y)=1$.
We are interested in primitive representations of perfect squares. For example:
$17^2=f(1,9)$
$87^2=f(13,40) = f(46,19)$
Define $C(N)$ as the total number of primitive representations of $z^2$ for $0 < z \leq N$.
Multiple representations are counted separately, so for example $z=87$ is counted twice.
You are given $C(10^3)=142$ and $C(10^{6})=142463$
Find $C(10^{14})$. | Consider the following binary quadratic form:
$$
\begin{align}
f(x,y)=x^2+5xy+3y^2
\end{align}
$$
A positive integer $q$ has a primitive representation if there exist positive integers $x$ and $y$ such that $q = f(x,y)$ and $\gcd(x,y)=1$.
We are interested in primitive representations of perfect squares. For example:
$17^2=f(1,9)$
$87^2=f(13,40) = f(46,19)$
Define $C(N)$ as the total number of primitive representations of $z^2$ for $0 < z \leq N$.
Multiple representations are counted separately, so for example $z=87$ is counted twice.
You are given $C(10^3)=142$ and $C(10^{6})=142463$
Find $C(10^{14})$. | <p>Consider the following binary quadratic form:</p>
$$
\begin{align}
f(x,y)=x^2+5xy+3y^2
\end{align}
$$
<p>A positive integer $q$ has a primitive representation if there exist positive integers $x$ and $y$ such that $q = f(x,y)$ and <span style="white-space:nowrap;">$\gcd(x,y)=1$.</span></p>
<p>We are interested in primitive representations of perfect squares. For example:<br>
$17^2=f(1,9)$<br/>
$87^2=f(13,40) = f(46,19)$</br></p>
<p>Define $C(N)$ as the total number of primitive representations of $z^2$ for $0 < z \leq N$.<br/>
Multiple representations are counted separately, so for example $z=87$ is counted twice.</p>
<p>You are given $C(10^3)=142$ and $C(10^{6})=142463$ </p>
<p>Find $C(10^{14})$.</p> | 14246712611506 | Sunday, 24th October 2021, 07:00 am | 160 | 90% | hard |
444 | The Roundtable Lottery | A group of $p$ people decide to sit down at a round table and play a lottery-ticket trading game. Each person starts off with a randomly-assigned, unscratched lottery ticket. Each ticket, when scratched, reveals a whole-pound prize ranging anywhere from £1 to £$p$, with no two tickets alike. The goal of the game is for all of the players to maximize the winnings of the ticket they hold upon leaving the game.
An arbitrary person is chosen to be the first player. Going around the table, each player has only one of two options:
The player can choose to scratch the ticket and reveal its worth to everyone at the table.
If the player's ticket is unscratched, then the player may trade it with a previous player's scratched ticket, and then leaves the game with that ticket. The previous player then scratches the newly-acquired ticket and reveals its worth to everyone at the table.
The game ends once all tickets have been scratched. All players still remaining at the table must leave with their currently-held tickets.
Assume that players will use the optimal strategy for maximizing the expected value of their ticket winnings.
Let $E(p)$ represent the expected number of players left at the table when the game ends in a game consisting of $p$ players.
E.g. $E(111) = 5.2912$ when rounded to 5 significant digits.
Let $S_1(N) = \sum \limits_{p = 1}^{N} {E(p)}$.
Let $S_k(N) = \sum \limits_{p = 1}^{N} {S_{k-1}(p)}$ for $k \gt 1$.
Find $S_{20}(10^{14})$ and write the answer in scientific notation rounded to 10 significant digits. Use a lowercase e to separate mantissa and exponent. For example, the answer for $S_3(100)$ would be 5.983679014e5. | A group of $p$ people decide to sit down at a round table and play a lottery-ticket trading game. Each person starts off with a randomly-assigned, unscratched lottery ticket. Each ticket, when scratched, reveals a whole-pound prize ranging anywhere from £1 to £$p$, with no two tickets alike. The goal of the game is for all of the players to maximize the winnings of the ticket they hold upon leaving the game.
An arbitrary person is chosen to be the first player. Going around the table, each player has only one of two options:
The player can choose to scratch the ticket and reveal its worth to everyone at the table.
If the player's ticket is unscratched, then the player may trade it with a previous player's scratched ticket, and then leaves the game with that ticket. The previous player then scratches the newly-acquired ticket and reveals its worth to everyone at the table.
The game ends once all tickets have been scratched. All players still remaining at the table must leave with their currently-held tickets.
Assume that players will use the optimal strategy for maximizing the expected value of their ticket winnings.
Let $E(p)$ represent the expected number of players left at the table when the game ends in a game consisting of $p$ players.
E.g. $E(111) = 5.2912$ when rounded to 5 significant digits.
Let $S_1(N) = \sum \limits_{p = 1}^{N} {E(p)}$.
Let $S_k(N) = \sum \limits_{p = 1}^{N} {S_{k-1}(p)}$ for $k \gt 1$.
Find $S_{20}(10^{14})$ and write the answer in scientific notation rounded to 10 significant digits. Use a lowercase e to separate mantissa and exponent. For example, the answer for $S_3(100)$ would be 5.983679014e5. | <p>A group of $p$ people decide to sit down at a round table and play a lottery-ticket trading game. Each person starts off with a randomly-assigned, unscratched lottery ticket. Each ticket, when scratched, reveals a whole-pound prize ranging anywhere from £1 to £$p$, with no two tickets alike. The goal of the game is for all of the players to maximize the winnings of the ticket they hold upon leaving the game.</p>
<p>An arbitrary person is chosen to be the first player. Going around the table, each player has only one of two options:</p>
<ol>
<li>The player can choose to scratch the ticket and reveal its worth to everyone at the table.</li>
<li>If the player's ticket is unscratched, then the player may trade it with a previous player's scratched ticket, and then leaves the game with that ticket. The previous player then scratches the newly-acquired ticket and reveals its worth to everyone at the table.</li>
</ol>
<p>The game ends once all tickets have been scratched. All players still remaining at the table must leave with their currently-held tickets.</p>
<p>Assume that players will use the optimal strategy for maximizing the expected value of their ticket winnings.</p>
<p>Let $E(p)$ represent the expected number of players left at the table when the game ends in a game consisting of $p$ players.<br/>
E.g. $E(111) = 5.2912$ when rounded to 5 significant digits.</p>
<p>Let $S_1(N) = \sum \limits_{p = 1}^{N} {E(p)}$.<br/>
Let $S_k(N) = \sum \limits_{p = 1}^{N} {S_{k-1}(p)}$ for $k \gt 1$.</p>
<p>Find $S_{20}(10^{14})$ and write the answer in scientific notation rounded to 10 significant digits. Use a lowercase e to separate mantissa and exponent. For example, the answer for $S_3(100)$ would be 5.983679014e5.</p> | 1.200856722e263 | Saturday, 9th November 2013, 07:00 pm | 340 | 60% | hard |
608 | Divisor Sums | Let $D(m,n)=\displaystyle\sum_{d\mid m}\sum_{k=1}^n\sigma_0(kd)$ where $d$ runs through all divisors of $m$ and $\sigma_0(n)$ is the number of divisors of $n$.
You are given $D(3!,10^2)=3398$ and $D(4!,10^6)=268882292$.
Find $D(200!,10^{12}) \bmod (10^9 + 7)$. | Let $D(m,n)=\displaystyle\sum_{d\mid m}\sum_{k=1}^n\sigma_0(kd)$ where $d$ runs through all divisors of $m$ and $\sigma_0(n)$ is the number of divisors of $n$.
You are given $D(3!,10^2)=3398$ and $D(4!,10^6)=268882292$.
Find $D(200!,10^{12}) \bmod (10^9 + 7)$. | <p>Let $D(m,n)=\displaystyle\sum_{d\mid m}\sum_{k=1}^n\sigma_0(kd)$ where $d$ runs through all divisors of $m$ and $\sigma_0(n)$ is the number of divisors of $n$.<br/>
You are given $D(3!,10^2)=3398$ and $D(4!,10^6)=268882292$.</p>
<p>Find $D(200!,10^{12}) \bmod (10^9 + 7)$.</p> | 439689828 | Saturday, 17th June 2017, 04:00 pm | 339 | 80% | hard |
32 | Pandigital Products | We shall say that an $n$-digit number is pandigital if it makes use of all the digits $1$ to $n$ exactly once; for example, the $5$-digit number, $15234$, is $1$ through $5$ pandigital.
The product $7254$ is unusual, as the identity, $39 \times 186 = 7254$, containing multiplicand, multiplier, and product is $1$ through $9$ pandigital.
Find the sum of all products whose multiplicand/multiplier/product identity can be written as a $1$ through $9$ pandigital.
HINT: Some products can be obtained in more than one way so be sure to only include it once in your sum. | We shall say that an $n$-digit number is pandigital if it makes use of all the digits $1$ to $n$ exactly once; for example, the $5$-digit number, $15234$, is $1$ through $5$ pandigital.
The product $7254$ is unusual, as the identity, $39 \times 186 = 7254$, containing multiplicand, multiplier, and product is $1$ through $9$ pandigital.
Find the sum of all products whose multiplicand/multiplier/product identity can be written as a $1$ through $9$ pandigital.
HINT: Some products can be obtained in more than one way so be sure to only include it once in your sum. | <p>We shall say that an $n$-digit number is pandigital if it makes use of all the digits $1$ to $n$ exactly once; for example, the $5$-digit number, $15234$, is $1$ through $5$ pandigital.</p>
<p>The product $7254$ is unusual, as the identity, $39 \times 186 = 7254$, containing multiplicand, multiplier, and product is $1$ through $9$ pandigital.</p>
<p>Find the sum of all products whose multiplicand/multiplier/product identity can be written as a $1$ through $9$ pandigital.</p>
<div class="note">HINT: Some products can be obtained in more than one way so be sure to only include it once in your sum.</div> | 45228 | Friday, 6th December 2002, 06:00 pm | 78180 | 5% | easy |
615 | The Millionth Number with at Least One Million Prime Factors | Consider the natural numbers having at least $5$ prime factors, which don't have to be distinct. Sorting these numbers by size gives a list which starts with:
$32=2 \cdot 2 \cdot 2 \cdot 2 \cdot 2$
$48=2 \cdot 2 \cdot 2 \cdot 2 \cdot 3$
$64=2 \cdot 2 \cdot 2 \cdot 2 \cdot 2 \cdot 2$
$72=2 \cdot 2 \cdot 2 \cdot 3 \cdot 3$
$80=2 \cdot 2 \cdot 2 \cdot 2 \cdot 5$
$96=2 \cdot 2 \cdot 2 \cdot 2 \cdot 2 \cdot 3$
$\cdots$
So, for example, the fifth number with at least $5$ prime factors is $80$.
Find the millionth number with at least one million prime factors. Give your answer modulo $123454321$. | Consider the natural numbers having at least $5$ prime factors, which don't have to be distinct. Sorting these numbers by size gives a list which starts with:
$32=2 \cdot 2 \cdot 2 \cdot 2 \cdot 2$
$48=2 \cdot 2 \cdot 2 \cdot 2 \cdot 3$
$64=2 \cdot 2 \cdot 2 \cdot 2 \cdot 2 \cdot 2$
$72=2 \cdot 2 \cdot 2 \cdot 3 \cdot 3$
$80=2 \cdot 2 \cdot 2 \cdot 2 \cdot 5$
$96=2 \cdot 2 \cdot 2 \cdot 2 \cdot 2 \cdot 3$
$\cdots$
So, for example, the fifth number with at least $5$ prime factors is $80$.
Find the millionth number with at least one million prime factors. Give your answer modulo $123454321$. | <p>
Consider the natural numbers having at least $5$ prime factors, which don't have to be distinct.<br/> Sorting these numbers by size gives a list which starts with:
</p>
<ul style="list-style:none;"><li>$32=2 \cdot 2 \cdot 2 \cdot 2 \cdot 2$</li>
<li>$48=2 \cdot 2 \cdot 2 \cdot 2 \cdot 3$</li>
<li>$64=2 \cdot 2 \cdot 2 \cdot 2 \cdot 2 \cdot 2$</li>
<li>$72=2 \cdot 2 \cdot 2 \cdot 3 \cdot 3$</li>
<li>$80=2 \cdot 2 \cdot 2 \cdot 2 \cdot 5$</li>
<li>$96=2 \cdot 2 \cdot 2 \cdot 2 \cdot 2 \cdot 3$</li>
<li>$\cdots$</li></ul>
<p>
So, for example, the fifth number with at least $5$ prime factors is $80$.
</p>
<p>
Find the millionth number with at least one million prime factors.<br/> Give your answer modulo $123454321$.
</p> | 108424772 | Sunday, 3rd December 2017, 10:00 am | 651 | 35% | medium |
384 | Rudin-Shapiro Sequence | Define the sequence $a(n)$ as the number of adjacent pairs of ones in the binary expansion of $n$ (possibly overlapping).
E.g.: $a(5) = a(101_2) = 0$, $a(6) = a(110_2) = 1$, $a(7) = a(111_2) = 2$.
Define the sequence $b(n) = (-1)^{a(n)}$.
This sequence is called the Rudin-Shapiro sequence.
Also consider the summatory sequence of $b(n)$: $s(n) = \sum \limits_{i = 0}^n b(i)$.
The first couple of values of these sequences are:
$n$
$0$
$1$
$2$
$3$
$4$
$5$
$6$
$7$
$a(n)$
$0$
$0$
$0$
$1$
$0$
$0$
$1$
$2$
$b(n)$
$1$
$1$
$1$
$-1$
$1$
$1$
$-1$
$1$
$s(n)$
$1$
$2$
$3$
$2$
$3$
$4$
$3$
$4$
The sequence $s(n)$ has the remarkable property that all elements are positive and every positive integer $k$ occurs exactly $k$ times.
Define $g(t,c)$, with $1 \le c \le t$, as the index in $s(n)$ for which $t$ occurs for the $c$'th time in $s(n)$.
E.g.: $g(3,3) = 6$, $g(4,2) = 7$ and $g(54321,12345) = 1220847710$.
Let $F(n)$ be the Fibonacci sequence defined by:
$F(0)=F(1)=1$ and
$F(n)=F(n-1)+F(n-2)$ for $n \gt 1$.
Define $GF(t)=g(F(t),F(t-1))$.
Find $\sum GF(t)$ for $2 \le t \le 45$. | Define the sequence $a(n)$ as the number of adjacent pairs of ones in the binary expansion of $n$ (possibly overlapping).
E.g.: $a(5) = a(101_2) = 0$, $a(6) = a(110_2) = 1$, $a(7) = a(111_2) = 2$.
Define the sequence $b(n) = (-1)^{a(n)}$.
This sequence is called the Rudin-Shapiro sequence.
Also consider the summatory sequence of $b(n)$: $s(n) = \sum \limits_{i = 0}^n b(i)$.
The first couple of values of these sequences are:
$n$
$0$
$1$
$2$
$3$
$4$
$5$
$6$
$7$
$a(n)$
$0$
$0$
$0$
$1$
$0$
$0$
$1$
$2$
$b(n)$
$1$
$1$
$1$
$-1$
$1$
$1$
$-1$
$1$
$s(n)$
$1$
$2$
$3$
$2$
$3$
$4$
$3$
$4$
The sequence $s(n)$ has the remarkable property that all elements are positive and every positive integer $k$ occurs exactly $k$ times.
Define $g(t,c)$, with $1 \le c \le t$, as the index in $s(n)$ for which $t$ occurs for the $c$'th time in $s(n)$.
E.g.: $g(3,3) = 6$, $g(4,2) = 7$ and $g(54321,12345) = 1220847710$.
Let $F(n)$ be the Fibonacci sequence defined by:
$F(0)=F(1)=1$ and
$F(n)=F(n-1)+F(n-2)$ for $n \gt 1$.
Define $GF(t)=g(F(t),F(t-1))$.
Find $\sum GF(t)$ for $2 \le t \le 45$. | <p>Define the sequence $a(n)$ as the number of adjacent pairs of ones in the binary expansion of $n$ (possibly overlapping).
<br/>E.g.: $a(5) = a(101_2) = 0$, $a(6) = a(110_2) = 1$, $a(7) = a(111_2) = 2$.</p>
<p>Define the sequence $b(n) = (-1)^{a(n)}$.
<br/>This sequence is called the <strong>Rudin-Shapiro</strong> sequence.</p>
<p>Also consider the summatory sequence of $b(n)$: $s(n) = \sum \limits_{i = 0}^n b(i)$.</p>
<p>The first couple of values of these sequences are:</p>
<table align="center"><tr>
<td align="center" width="30">$n$</td>
<td align="right" width="30">$0$</td>
<td align="right" width="30">$1$</td>
<td align="right" width="30">$2$</td>
<td align="right" width="30">$3$</td>
<td align="right" width="30">$4$</td>
<td align="right" width="30">$5$</td>
<td align="right" width="30">$6$</td>
<td align="right" width="30">$7$</td>
</tr><tr>
<td align="center" width="30">$a(n)$</td>
<td align="right" width="30">$0$</td>
<td align="right" width="30">$0$</td>
<td align="right" width="30">$0$</td>
<td align="right" width="30">$1$</td>
<td align="right" width="30">$0$</td>
<td align="right" width="30">$0$</td>
<td align="right" width="30">$1$</td>
<td align="right" width="30">$2$</td>
</tr><tr>
<td align="center" width="30">$b(n)$</td>
<td align="right" width="30">$1$</td>
<td align="right" width="30">$1$</td>
<td align="right" width="30">$1$</td>
<td align="right" width="30">$-1$</td>
<td align="right" width="30">$1$</td>
<td align="right" width="30">$1$</td>
<td align="right" width="30">$-1$</td>
<td align="right" width="30">$1$</td>
</tr><tr>
<td align="center" width="30">$s(n)$</td>
<td align="right" width="30">$1$</td>
<td align="right" width="30">$2$</td>
<td align="right" width="30">$3$</td>
<td align="right" width="30">$2$</td>
<td align="right" width="30">$3$</td>
<td align="right" width="30">$4$</td>
<td align="right" width="30">$3$</td>
<td align="right" width="30">$4$</td>
</tr></table>
<p>The sequence $s(n)$ has the remarkable property that all elements are positive and every positive integer $k$ occurs exactly $k$ times.</p>
<p>Define $g(t,c)$, with $1 \le c \le t$, as the index in $s(n)$ for which $t$ occurs for the $c$'th time in $s(n)$.
<br/>E.g.: $g(3,3) = 6$, $g(4,2) = 7$ and $g(54321,12345) = 1220847710$.</p>
<p>Let $F(n)$ be the Fibonacci sequence defined by:
<br/>$F(0)=F(1)=1$ and
<br/>$F(n)=F(n-1)+F(n-2)$ for $n \gt 1$.</p>
<p>Define $GF(t)=g(F(t),F(t-1))$.</p>
<p>Find $\sum GF(t)$ for $2 \le t \le 45$.</p> | 3354706415856332783 | Sunday, 13th May 2012, 02:00 am | 366 | 65% | hard |
255 | Rounded Square Roots | We define the rounded-square-root of a positive integer $n$ as the square root of $n$ rounded to the nearest integer.
The following procedure (essentially Heron's method adapted to integer arithmetic) finds the rounded-square-root of $n$:
Let $d$ be the number of digits of the number $n$.
If $d$ is odd, set $x_0 = 2 \times 10^{(d-1)/2}$.
If $d$ is even, set $x_0 = 7 \times 10^{(d-2)/2}$.
Repeat:
$$x_{k+1} = \Biggl\lfloor{\dfrac{x_k + \lceil{n / x_k}\rceil}{2}}\Biggr\rfloor$$
until $x_{k+1} = x_k$.
As an example, let us find the rounded-square-root of $n = 4321$.$n$ has $4$ digits, so $x_0 = 7 \times 10^{(4-2)/2} = 70$.
$$x_1 = \Biggl\lfloor{\dfrac{70 + \lceil{4321 / 70}\rceil}{2}}\Biggr\rfloor = 66$$
$$x_2 = \Biggl\lfloor{\dfrac{66 + \lceil{4321 / 66}\rceil}{2}}\Biggr\rfloor = 66$$
Since $x_2 = x_1$, we stop here.
So, after just two iterations, we have found that the rounded-square-root of $4321$ is $66$ (the actual square root is $65.7343137\cdots$).
The number of iterations required when using this method is surprisingly low.
For example, we can find the rounded-square-root of a $5$-digit integer ($10\,000 \le n \le 99\,999$) with an average of $3.2102888889$ iterations (the average value was rounded to $10$ decimal places).
Using the procedure described above, what is the average number of iterations required to find the rounded-square-root of a $14$-digit number ($10^{13} \le n \lt 10^{14}$)?
Give your answer rounded to $10$ decimal places.
Note: The symbols $\lfloor x \rfloor$ and $\lceil x \rceil$ represent the floor functionthe largest integer not greater than $x$ and ceiling functionthe smallest integer not less than $x$ respectively. | We define the rounded-square-root of a positive integer $n$ as the square root of $n$ rounded to the nearest integer.
The following procedure (essentially Heron's method adapted to integer arithmetic) finds the rounded-square-root of $n$:
Let $d$ be the number of digits of the number $n$.
If $d$ is odd, set $x_0 = 2 \times 10^{(d-1)/2}$.
If $d$ is even, set $x_0 = 7 \times 10^{(d-2)/2}$.
Repeat:
$$x_{k+1} = \Biggl\lfloor{\dfrac{x_k + \lceil{n / x_k}\rceil}{2}}\Biggr\rfloor$$
until $x_{k+1} = x_k$.
As an example, let us find the rounded-square-root of $n = 4321$.$n$ has $4$ digits, so $x_0 = 7 \times 10^{(4-2)/2} = 70$.
$$x_1 = \Biggl\lfloor{\dfrac{70 + \lceil{4321 / 70}\rceil}{2}}\Biggr\rfloor = 66$$
$$x_2 = \Biggl\lfloor{\dfrac{66 + \lceil{4321 / 66}\rceil}{2}}\Biggr\rfloor = 66$$
Since $x_2 = x_1$, we stop here.
So, after just two iterations, we have found that the rounded-square-root of $4321$ is $66$ (the actual square root is $65.7343137\cdots$).
The number of iterations required when using this method is surprisingly low.
For example, we can find the rounded-square-root of a $5$-digit integer ($10\,000 \le n \le 99\,999$) with an average of $3.2102888889$ iterations (the average value was rounded to $10$ decimal places).
Using the procedure described above, what is the average number of iterations required to find the rounded-square-root of a $14$-digit number ($10^{13} \le n \lt 10^{14}$)?
Give your answer rounded to $10$ decimal places.
Note: The symbols $\lfloor x \rfloor$ and $\lceil x \rceil$ represent the floor functionthe largest integer not greater than $x$ and ceiling functionthe smallest integer not less than $x$ respectively. | <p>We define the <dfn>rounded-square-root</dfn> of a positive integer $n$ as the square root of $n$ rounded to the nearest integer.</p>
<p>The following procedure (essentially Heron's method adapted to integer arithmetic) finds the rounded-square-root of $n$:</p>
<p>Let $d$ be the number of digits of the number $n$.<br/>
If $d$ is odd, set $x_0 = 2 \times 10^{(d-1)/2}$.<br/>
If $d$ is even, set $x_0 = 7 \times 10^{(d-2)/2}$.<br/>
Repeat:</p>
$$x_{k+1} = \Biggl\lfloor{\dfrac{x_k + \lceil{n / x_k}\rceil}{2}}\Biggr\rfloor$$
<p>until $x_{k+1} = x_k$.</p>
<p>As an example, let us find the rounded-square-root of $n = 4321$.<br/>$n$ has $4$ digits, so $x_0 = 7 \times 10^{(4-2)/2} = 70$.<br/>
$$x_1 = \Biggl\lfloor{\dfrac{70 + \lceil{4321 / 70}\rceil}{2}}\Biggr\rfloor = 66$$
$$x_2 = \Biggl\lfloor{\dfrac{66 + \lceil{4321 / 66}\rceil}{2}}\Biggr\rfloor = 66$$
Since $x_2 = x_1$, we stop here.<br/>
So, after just two iterations, we have found that the rounded-square-root of $4321$ is $66$ (the actual square root is $65.7343137\cdots$).
</p>
<p>The number of iterations required when using this method is surprisingly low.<br/>
For example, we can find the rounded-square-root of a $5$-digit integer ($10\,000 \le n \le 99\,999$) with an average of $3.2102888889$ iterations (the average value was rounded to $10$ decimal places).
</p>
<p>Using the procedure described above, what is the average number of iterations required to find the rounded-square-root of a $14$-digit number ($10^{13} \le n \lt 10^{14}$)?<br/>
Give your answer rounded to $10$ decimal places.
</p>
<p>Note: The symbols $\lfloor x \rfloor$ and $\lceil x \rceil$ represent the <strong class="tooltip">floor function<span class="tooltiptext">the largest integer not greater than $x$</span></strong> and <strong class="tooltip">ceiling function<span class="tooltiptext">the smallest integer not less than $x$</span></strong> respectively.
</p> | 4.4474011180 | Friday, 11th September 2009, 09:00 pm | 987 | 75% | hard |
18 | Maximum Path Sum I | By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is $23$.
37 4
2 4 6
8 5 9 3
That is, $3 + 7 + 4 + 9 = 23$.
Find the maximum total from top to bottom of the triangle below:
75
95 64
17 47 82
18 35 87 10
20 04 82 47 65
19 01 23 75 03 34
88 02 77 73 07 63 67
99 65 04 28 06 16 70 92
41 41 26 56 83 40 80 70 33
41 48 72 33 47 32 37 16 94 29
53 71 44 65 25 43 91 52 97 51 14
70 11 33 28 77 73 17 78 39 68 17 57
91 71 52 38 17 14 91 43 58 50 27 29 48
63 66 04 68 89 53 67 30 73 16 69 87 40 31
04 62 98 27 23 09 70 98 73 93 38 53 60 04 23
NOTE: As there are only $16384$ routes, it is possible to solve this problem by trying every route. However, Problem 67, is the same challenge with a triangle containing one-hundred rows; it cannot be solved by brute force, and requires a clever method! ;o) | By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is $23$.
37 4
2 4 6
8 5 9 3
That is, $3 + 7 + 4 + 9 = 23$.
Find the maximum total from top to bottom of the triangle below:
75
95 64
17 47 82
18 35 87 10
20 04 82 47 65
19 01 23 75 03 34
88 02 77 73 07 63 67
99 65 04 28 06 16 70 92
41 41 26 56 83 40 80 70 33
41 48 72 33 47 32 37 16 94 29
53 71 44 65 25 43 91 52 97 51 14
70 11 33 28 77 73 17 78 39 68 17 57
91 71 52 38 17 14 91 43 58 50 27 29 48
63 66 04 68 89 53 67 30 73 16 69 87 40 31
04 62 98 27 23 09 70 98 73 93 38 53 60 04 23
NOTE: As there are only $16384$ routes, it is possible to solve this problem by trying every route. However, Problem 67, is the same challenge with a triangle containing one-hundred rows; it cannot be solved by brute force, and requires a clever method! ;o) | <p>By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is $23$.</p>
<p class="monospace center"><span class="red"><b>3</b></span><br/><span class="red"><b>7</b></span> 4<br/>
2 <span class="red"><b>4</b></span> 6<br/>
8 5 <span class="red"><b>9</b></span> 3</p>
<p>That is, $3 + 7 + 4 + 9 = 23$.</p>
<p>Find the maximum total from top to bottom of the triangle below:</p>
<p class="monospace center">75<br/>
95 64<br/>
17 47 82<br/>
18 35 87 10<br/>
20 04 82 47 65<br/>
19 01 23 75 03 34<br/>
88 02 77 73 07 63 67<br/>
99 65 04 28 06 16 70 92<br/>
41 41 26 56 83 40 80 70 33<br/>
41 48 72 33 47 32 37 16 94 29<br/>
53 71 44 65 25 43 91 52 97 51 14<br/>
70 11 33 28 77 73 17 78 39 68 17 57<br/>
91 71 52 38 17 14 91 43 58 50 27 29 48<br/>
63 66 04 68 89 53 67 30 73 16 69 87 40 31<br/>
04 62 98 27 23 09 70 98 73 93 38 53 60 04 23</p>
<p class="note"><b>NOTE:</b> As there are only $16384$ routes, it is possible to solve this problem by trying every route. However, <a href="problem=67">Problem 67</a>, is the same challenge with a triangle containing one-hundred rows; it cannot be solved by brute force, and requires a clever method! ;o)</p> | 1074 | Friday, 31st May 2002, 06:00 pm | 157085 | 5% | easy |
25 | $1000$-digit Fibonacci Number | The Fibonacci sequence is defined by the recurrence relation:
$F_n = F_{n - 1} + F_{n - 2}$, where $F_1 = 1$ and $F_2 = 1$.
Hence the first $12$ terms will be:
\begin{align}
F_1 &= 1\\
F_2 &= 1\\
F_3 &= 2\\
F_4 &= 3\\
F_5 &= 5\\
F_6 &= 8\\
F_7 &= 13\\
F_8 &= 21\\
F_9 &= 34\\
F_{10} &= 55\\
F_{11} &= 89\\
F_{12} &= 144
\end{align}
The $12$th term, $F_{12}$, is the first term to contain three digits.
What is the index of the first term in the Fibonacci sequence to contain $1000$ digits? | The Fibonacci sequence is defined by the recurrence relation:
$F_n = F_{n - 1} + F_{n - 2}$, where $F_1 = 1$ and $F_2 = 1$.
Hence the first $12$ terms will be:
\begin{align}
F_1 &= 1\\
F_2 &= 1\\
F_3 &= 2\\
F_4 &= 3\\
F_5 &= 5\\
F_6 &= 8\\
F_7 &= 13\\
F_8 &= 21\\
F_9 &= 34\\
F_{10} &= 55\\
F_{11} &= 89\\
F_{12} &= 144
\end{align}
The $12$th term, $F_{12}$, is the first term to contain three digits.
What is the index of the first term in the Fibonacci sequence to contain $1000$ digits? | <p>The Fibonacci sequence is defined by the recurrence relation:</p>
<blockquote>$F_n = F_{n - 1} + F_{n - 2}$, where $F_1 = 1$ and $F_2 = 1$.</blockquote>
<p>Hence the first $12$ terms will be:</p>
\begin{align}
F_1 &= 1\\
F_2 &= 1\\
F_3 &= 2\\
F_4 &= 3\\
F_5 &= 5\\
F_6 &= 8\\
F_7 &= 13\\
F_8 &= 21\\
F_9 &= 34\\
F_{10} &= 55\\
F_{11} &= 89\\
F_{12} &= 144
\end{align}
<p>The $12$th term, $F_{12}$, is the first term to contain three digits.</p>
<p>What is the index of the first term in the Fibonacci sequence to contain $1000$ digits?</p> | 4782 | Friday, 30th August 2002, 06:00 pm | 167940 | 5% | easy |
356 | Largest Roots of Cubic Polynomials | Let $a_n$ be the largest real root of a polynomial $g(x) = x^3 - 2^n \cdot x^2 + n$.
For example, $a_2 = 3.86619826\cdots$
Find the last eight digits of $\sum \limits_{i = 1}^{30} \lfloor a_i^{987654321} \rfloor$.
Note: $\lfloor a \rfloor$ represents the floor function. | Let $a_n$ be the largest real root of a polynomial $g(x) = x^3 - 2^n \cdot x^2 + n$.
For example, $a_2 = 3.86619826\cdots$
Find the last eight digits of $\sum \limits_{i = 1}^{30} \lfloor a_i^{987654321} \rfloor$.
Note: $\lfloor a \rfloor$ represents the floor function. | <p>
Let $a_n$ be the largest real root of a polynomial $g(x) = x^3 - 2^n \cdot x^2 + n$.<br/>
For example, $a_2 = 3.86619826\cdots$</p>
<p>
Find the last eight digits of $\sum \limits_{i = 1}^{30} \lfloor a_i^{987654321} \rfloor$.</p>
<p>
<u><i>Note</i></u>: $\lfloor a \rfloor$ represents the floor function.</p> | 28010159 | Saturday, 29th October 2011, 01:00 pm | 675 | 60% | hard |
865 | Triplicate Numbers | A triplicate number is a positive integer such that, after repeatedly removing three consecutive identical digits from it, all its digits can be removed.
For example, the integer $122555211$ is a triplicate number:
$$122{\color{red}555}211 \rightarrow 1{\color{red}222}11\rightarrow{\color{red}111}\rightarrow.$$
On the other hand, neither $663633$ nor $9990$ are triplicate numbers.
Let $T(n)$ be how many triplicate numbers are less than $10^n$.
For example, $T(6) = 261$ and $T(30) = 5576195181577716$.
Find $T(10^4)$. Give your answer modulo $998244353$. | A triplicate number is a positive integer such that, after repeatedly removing three consecutive identical digits from it, all its digits can be removed.
For example, the integer $122555211$ is a triplicate number:
$$122{\color{red}555}211 \rightarrow 1{\color{red}222}11\rightarrow{\color{red}111}\rightarrow.$$
On the other hand, neither $663633$ nor $9990$ are triplicate numbers.
Let $T(n)$ be how many triplicate numbers are less than $10^n$.
For example, $T(6) = 261$ and $T(30) = 5576195181577716$.
Find $T(10^4)$. Give your answer modulo $998244353$. | <p>
A <dfn>triplicate number</dfn> is a positive integer such that, after repeatedly removing three consecutive identical digits from it, all its digits can be removed.</p>
<p>
For example, the integer $122555211$ is a triplicate number:
$$122{\color{red}555}211 \rightarrow 1{\color{red}222}11\rightarrow{\color{red}111}\rightarrow.$$
On the other hand, neither $663633$ nor $9990$ are triplicate numbers.</p>
<p>
Let $T(n)$ be how many triplicate numbers are less than $10^n$.</p>
<p>
For example, $T(6) = 261$ and $T(30) = 5576195181577716$.</p>
<p>
Find $T(10^4)$. Give your answer modulo $998244353$.</p> | 761181918 | Sunday, 26th November 2023, 01:00 am | 285 | 35% | medium |
379 | Least Common Multiple Count | Let $f(n)$ be the number of couples $(x, y)$ with $x$ and $y$ positive integers, $x \le y$ and the least common multiple of $x$ and $y$ equal to $n$.
Let $g$ be the summatory function of $f$, i.e.:
$g(n) = \sum f(i)$ for $1 \le i \le n$.
You are given that $g(10^6) = 37429395$.
Find $g(10^{12})$. | Let $f(n)$ be the number of couples $(x, y)$ with $x$ and $y$ positive integers, $x \le y$ and the least common multiple of $x$ and $y$ equal to $n$.
Let $g$ be the summatory function of $f$, i.e.:
$g(n) = \sum f(i)$ for $1 \le i \le n$.
You are given that $g(10^6) = 37429395$.
Find $g(10^{12})$. | <p>
Let $f(n)$ be the number of couples $(x, y)$ with $x$ and $y$ positive integers, $x \le y$ and the least common multiple of $x$ and $y$ equal to $n$.
</p>
<p>
Let $g$ be the <strong>summatory function</strong> of $f$, i.e.:
$g(n) = \sum f(i)$ for $1 \le i \le n$.
</p><p>
You are given that $g(10^6) = 37429395$.
</p>
<p>
Find $g(10^{12})$.
</p> | 132314136838185 | Sunday, 8th April 2012, 11:00 am | 601 | 70% | hard |
713 | Turán's Water Heating System | Turan has the electrical water heating system outside his house in a shed. The electrical system uses two fuses in series, one in the house and one in the shed. (Nowadays old fashioned fuses are often replaced with reusable mini circuit breakers, but Turan's system still uses old fashioned fuses.)
For the heating system to work both fuses must work.
Turan has $N$ fuses. He knows that $m$ of them are working and the rest are blown. However, he doesn't know which ones are blown. So he tries different combinations until the heating system turns on.
We denote by $T(N,m)$ the smallest number of tries required to ensure the heating system turns on.
$T(3,2)=3$ and $T(8,4)=7$.
Let $L(N)$ be the sum of all $T(N, m)$ for $2 \leq m \leq N$.
$L(10^3)=3281346$.
Find $L(10^7)$. | Turan has the electrical water heating system outside his house in a shed. The electrical system uses two fuses in series, one in the house and one in the shed. (Nowadays old fashioned fuses are often replaced with reusable mini circuit breakers, but Turan's system still uses old fashioned fuses.)
For the heating system to work both fuses must work.
Turan has $N$ fuses. He knows that $m$ of them are working and the rest are blown. However, he doesn't know which ones are blown. So he tries different combinations until the heating system turns on.
We denote by $T(N,m)$ the smallest number of tries required to ensure the heating system turns on.
$T(3,2)=3$ and $T(8,4)=7$.
Let $L(N)$ be the sum of all $T(N, m)$ for $2 \leq m \leq N$.
$L(10^3)=3281346$.
Find $L(10^7)$. | <p>
Turan has the electrical water heating system outside his house in a shed. The electrical system uses two fuses in series, one in the house and one in the shed. (Nowadays old fashioned fuses are often replaced with reusable mini circuit breakers, but Turan's system still uses old fashioned fuses.)
For the heating system to work both fuses must work.
</p>
<p>
Turan has $N$ fuses. He knows that $m$ of them are working and the rest are blown. However, he doesn't know which ones are blown. So he tries different combinations until the heating system turns on.<br/>
We denote by $T(N,m)$ the smallest number of tries required to <i>ensure</i> the heating system turns on.<br/>
$T(3,2)=3$ and $T(8,4)=7$.
</p>
<p>
Let $L(N)$ be the sum of all $T(N, m)$ for $2 \leq m \leq N$.<br/>
$L(10^3)=3281346$.
</p>
<p>
Find $L(10^7)$.
</p> | 788626351539895 | Sunday, 26th April 2020, 02:00 am | 783 | 20% | easy |
789 | Minimal Pairing Modulo $p$ | Given an odd prime $p$, put the numbers $1,...,p-1$ into $\frac{p-1}{2}$ pairs such that each number appears exactly once. Each pair $(a,b)$ has a cost of $ab \bmod p$. For example, if $p=5$ the pair $(3,4)$ has a cost of $12 \bmod 5 = 2$.
The total cost of a pairing is the sum of the costs of its pairs. We say that such pairing is optimal if its total cost is minimal for that $p$.
For example, if $p = 5$, then there is a unique optimal pairing: $(1, 2), (3, 4)$, with total cost of $2 + 2 = 4$.
The cost product of a pairing is the product of the costs of its pairs. For example, the cost product of the optimal pairing for $p = 5$ is $2 \cdot 2 = 4$.
It turns out that all optimal pairings for $p = 2\,000\,000\,011$ have the same cost product.
Find the value of this product. | Given an odd prime $p$, put the numbers $1,...,p-1$ into $\frac{p-1}{2}$ pairs such that each number appears exactly once. Each pair $(a,b)$ has a cost of $ab \bmod p$. For example, if $p=5$ the pair $(3,4)$ has a cost of $12 \bmod 5 = 2$.
The total cost of a pairing is the sum of the costs of its pairs. We say that such pairing is optimal if its total cost is minimal for that $p$.
For example, if $p = 5$, then there is a unique optimal pairing: $(1, 2), (3, 4)$, with total cost of $2 + 2 = 4$.
The cost product of a pairing is the product of the costs of its pairs. For example, the cost product of the optimal pairing for $p = 5$ is $2 \cdot 2 = 4$.
It turns out that all optimal pairings for $p = 2\,000\,000\,011$ have the same cost product.
Find the value of this product. | <p>Given an odd prime $p$, put the numbers $1,...,p-1$ into $\frac{p-1}{2}$ pairs such that each number appears exactly once. Each pair $(a,b)$ has a cost of $ab \bmod p$. For example, if $p=5$ the pair $(3,4)$ has a cost of $12 \bmod 5 = 2$.</p>
<p>The <i>total cost</i> of a pairing is the sum of the costs of its pairs. We say that such pairing is optimal if its total cost is minimal for that $p$.</p>
<p>For example, if $p = 5$, then there is a unique optimal pairing: $(1, 2), (3, 4)$, with total cost of $2 + 2 = 4$.</p>
<p>The <dfn>cost product</dfn> of a pairing is the product of the costs of its pairs. For example, the cost product of the optimal pairing for $p = 5$ is $2 \cdot 2 = 4$.</p>
<p>It turns out that all optimal pairings for $p = 2\,000\,000\,011$ have the same cost product.</p>
<p>Find the value of this product.</p> | 13431419535872807040 | Saturday, 12th March 2022, 07:00 pm | 209 | 50% | medium |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.