id
int64
1
981
problem
stringlengths
97
5.29k
raw_html
stringlengths
121
5.63k
url
stringlengths
34
36
answer
stringlengths
1
29
901
A driller drills for water. At each iteration the driller chooses a depth $d$ (a positive real number), drills to this depth and then checks if water was found. If so, the process terminates. Otherwise, a new depth is chosen and a new drilling starts from the ground level in a new location nearby. Drilling to depth $d...
<p>A driller drills for water. At each iteration the driller chooses a depth $d$ (a positive real number), drills to this depth and then checks if water was found. If so, the process terminates. Otherwise, a new depth is chosen and a new drilling starts from the ground level in a new location nearby.</p> <p>Drilling t...
https://projecteuler.net/problem=901
2.364497769
902
A permutation $\pi$ of $\{1, \dots, n\}$ can be represented in one-line notation as $\pi(1),\ldots,\pi(n) $. If all $n!$ permutations are written in lexicographic order then $\textrm{rank}(\pi)$ is the position of $\pi$ in this 1-based list. For example, $\text{rank}(2,1,3) = 3$ because the six permutations of $\{1, 2...
<p>A permutation $\pi$ of $\{1, \dots, n\}$ can be represented in <b>one-line notation</b> as $\pi(1),\ldots,\pi(n) $. If all $n!$ permutations are written in lexicographic order then $\textrm{rank}(\pi)$ is the position of $\pi$ in this 1-based list.</p> <p>For example, $\text{rank}(2,1,3) = 3$ because the six permut...
https://projecteuler.net/problem=902
343557869
903
A permutation $\pi$ of $\{1, \dots, n\}$ can be represented in one-line notation as $\pi(1),\ldots,\pi(n) $. If all $n!$ permutations are written in lexicographic order then $\textrm{rank}(\pi)$ is the position of $\pi$ in this 1-based list. For example, $\text{rank}(2,1,3) = 3$ because the six permutations of $\{1, 2...
<p>A permutation $\pi$ of $\{1, \dots, n\}$ can be represented in <b>one-line notation</b> as $\pi(1),\ldots,\pi(n) $. If all $n!$ permutations are written in lexicographic order then $\textrm{rank}(\pi)$ is the position of $\pi$ in this 1-based list.</p> <p>For example, $\text{rank}(2,1,3) = 3$ because the six permut...
https://projecteuler.net/problem=903
128553191
904
Given a right-angled triangle with integer sides, the smaller angle formed by the two medians drawn on the the two perpendicular sides is denoted by $\theta$. Let $f(\alpha, L)$ denote the sum of the sides of the right-angled triangle minimizing the absolute difference between $\theta$ and $\alpha$ among all right-ang...
<p>Given a right-angled triangle with integer sides, the smaller angle formed by the two medians drawn on the the two perpendicular sides is denoted by $\theta$. </p> <div style="text-align:center;"><img src="resources/images/0904_pythagorean_angle.png?1723895050" alt="0904_Pythagorean_angle.jpg"></div> <p>Let $f(\alph...
https://projecteuler.net/problem=904
880652522278760
905
Three epistemologists, known as A, B, and C, are in a room, each wearing a hat with a number on it. They have been informed beforehand that all three numbers are positive and that one of the numbers is the sum of the other two. Once in the room, they can see the numbers on each other's hats but not on their own. Start...
<p> Three epistemologists, known as A, B, and C, are in a room, each wearing a hat with a number on it. They have been informed beforehand that all three numbers are positive and that one of the numbers is the sum of the other two.</p> <p> Once in the room, they can see the numbers on each other's hats but not on thei...
https://projecteuler.net/problem=905
70228218
906
Three friends attempt to collectively choose one of $n$ options, labeled $1,\dots,n$, based upon their individual preferences. They choose option $i$ if for every alternative option $j$ at least two of the three friends prefer $i$ over $j$. If no such option $i$ exists they fail to reach an agreement. Define $P(n)$ to...
<p> Three friends attempt to collectively choose one of $n$ options, labeled $1,\dots,n$, based upon their individual preferences. They choose option $i$ if for every alternative option $j$ at least two of the three friends prefer $i$ over $j$. If no such option $i$ exists they fail to reach an agreement. </p> <p> Defi...
https://projecteuler.net/problem=906
0.0195868911
907
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...
<p> An infant's toy consists of $n$ cups, labelled $C_1,\dots,C_n$ in increasing order of size. </p> <img src="resources/images/0907_four_cups.png?1723769212" alt="0907_four_cups.png" height="162"> <p> The cups may be stacked in various combinations and orientations to form towers. The cups are shaped such that the fol...
https://projecteuler.net/problem=907
196808901
908
A clock sequence is a periodic sequence of positive integers that can be broken into contiguous segments such that the sum of the $n$-th segment is equal to $n$. For example, the sequence $$1\ 2\ 3\ 4\ 3\ 2\ 1\ 2\ 3\ 4\ 3\ 2\ 1\ 2\ 3\ 4\ 3\ 2\ 1\ \cdots$$ is a clock sequence with period $6$, as it can be broken into $...
<p> A <dfn>clock sequence</dfn> is a periodic sequence of positive integers that can be broken into contiguous segments such that the sum of the $n$-th segment is equal to $n$.</p> <p> For example, the sequence $$1\ 2\ 3\ 4\ 3\ 2\ 1\ 2\ 3\ 4\ 3\ 2\ 1\ 2\ 3\ 4\ 3\ 2\ 1\ \cdots$$ is a clock sequence with period $6$, as ...
https://projecteuler.net/problem=908
451822602
909
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...
<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 follow...
https://projecteuler.net/problem=909
399885292
910
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...
<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 follow...
https://projecteuler.net/problem=910
547480666
911
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, $...
<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,...
https://projecteuler.net/problem=911
5679.934966
912
Let $s_n$ be the $n$-th positive integer that does not contain three consecutive ones in its binary representation. For example, $s_1 = 1$ and $s_7 = 8$. Define $F(N)$ to be the sum of $n^2$ for all $n\leq N$ where $s_n$ is odd. You are given $F(10)=199$. Find $F(10^{16})$ giving your answer modulo $10^9+7$.
<p> Let $s_n$ be the $n$-th positive integer that does not contain three consecutive ones in its binary representation.<br> For example, $s_1 = 1$ and $s_7 = 8$. </p> <p> Define $F(N)$ to be the sum of $n^2$ for all $n\leq N$ where $s_n$ is odd. You are given $F(10)=199$. </p> <p> Find $F(10^{16})$ giving your answer m...
https://projecteuler.net/problem=912
674045136
913
The numbers from $1$ to $12$ can be arranged into a $3 \times 4$ matrix in either row-major or column-major order: $$R=\begin{pmatrix} 1 & 2 & 3 & 4\\ 5 & 6 & 7 & 8\\ 9 & 10 & 11 & 12\end{pmatrix}, C=\begin{pmatrix} 1 & 4 & 7 & 10\\ 2 & 5 & 8 & 11\\ 3 & 6 & 9 & 12\end{pmatrix}$$ By swapping two entries at a time, at le...
<p> The numbers from $1$ to $12$ can be arranged into a $3 \times 4$ matrix in either <strong>row-major</strong> or <strong>column-major</strong> order: $$R=\begin{pmatrix} 1 &amp; 2 &amp; 3 &amp; 4\\ 5 &amp; 6 &amp; 7 &amp; 8\\ 9 &amp; 10 &amp; 11 &amp; 12\end{pmatrix}, C=\begin{pmatrix} 1 &amp; 4 &amp; 7 &amp; 10\\ 2...
https://projecteuler.net/problem=913
2101925115560555020
914
For a given integer $R$ consider all primitive Pythagorean triangles that can fit inside, without touching, a circle with radius $R$. Define $F(R)$ to be the largest inradius of those triangles. You are given $F(100) = 36$. Find $F(10^{18})$.
<p> For a given integer $R$ consider all primitive Pythagorean triangles that can fit inside, without touching, a circle with radius $R$. Define $F(R)$ to be the largest inradius of those triangles. You are given $F(100) = 36$.</p> <p> Find $F(10^{18})$.</p>
https://projecteuler.net/problem=914
414213562371805310
915
The function $s(n)$ is defined recursively for positive integers by $s(1) = 1$ and $s(n+1) = \big(s(n) - 1\big)^3 +2$ for $n\geq 1$. The sequence begins: $s(1) = 1, s(2) = 2, s(3) = 3, s(4) = 10, \ldots$. For positive integers $N$, define $$T(N) = \sum_{a=1}^N \sum_{b=1}^N \gcd\Big(s\big(s(a)\big), s\big(s(b)\big)\Bi...
<p> The function $s(n)$ is defined recursively for positive integers by $s(1) = 1$ and $s(n+1) = \big(s(n) - 1\big)^3 +2$ for $n\geq 1$.<br> The sequence begins: $s(1) = 1, s(2) = 2, s(3) = 3, s(4) = 10, \ldots$.</p> <p> For positive integers $N$, define $$T(N) = \sum_{a=1}^N \sum_{b=1}^N \gcd\Big(s\big(s(a)\big), s...
https://projecteuler.net/problem=915
55601924
916
Let $P(n)$ be the number of permutations of $\{1,2,3,\ldots,2n\}$ such that: 1. There is no ascending subsequence with more than $n+1$ elements, and 2. There is no descending subsequence with more than two elements. Note that subsequences need not be contiguous. For example, the permutation $(4,1,3,2)$ is not counte...
<p>Let $P(n)$ be the number of permutations of $\{1,2,3,\ldots,2n\}$ such that: <br> 1. There is no ascending subsequence with more than $n+1$ elements, and <br> 2. There is no descending subsequence with more than two elements. </p> <p>Note that subsequences need not be contiguous. For example, the permutation $(4,1,...
https://projecteuler.net/problem=916
877789135
917
The sequence $s_n$ is defined by $s_1 = 102022661$ and $s_n = s_{n-1}^2 \bmod {998388889}$ for $n > 1$. Let $a_n = s_{2n - 1}$ and $b_n = s_{2n}$ for $n=1,2,...$ Define an $N \times N$ matrix whose values are $M_{i,j} = a_i + b_j$. Let $A(N)$ be the minimal path sum from $M_{1,1}$ (top left) to $M_{N,N}$ (bottom rig...
<p>The sequence $s_n$ is defined by $s_1 = 102022661$ and $s_n = s_{n-1}^2 \bmod {998388889}$ for $n &gt; 1$.</p> <p>Let $a_n = s_{2n - 1}$ and $b_n = s_{2n}$ for $n=1,2,...$</p> <p>Define an $N \times N$ matrix whose values are $M_{i,j} = a_i + b_j$.</p> <p>Let $A(N)$ be the minimal path sum from $M_{1,1}$ (top lef...
https://projecteuler.net/problem=917
9986212680734636
918
The sequence $a_n$ is defined by $a_1=1$, and then recursively for $n\geq1$: $$\begin{align*} a_{2n} &=2a_n\\ a_{2n+1} &=a_n-3a_{n+1} \end{align*}$$ The first ten terms are $1, 2, -5, 4, 17, -10, -17, 8, -47, 34$. Define $\displaystyle S(N) = \sum_{n=1}^N a_n$. You are given $S(10) = -13$. Find $S(10^{12})$.
<p> The sequence $a_n$ is defined by $a_1=1$, and then recursively for $n\geq1$: $$\begin{align*} a_{2n} &amp;=2a_n\\ a_{2n+1} &amp;=a_n-3a_{n+1} \end{align*}$$ The first ten terms are $1, 2, -5, 4, 17, -10, -17, 8, -47, 34$.<br> Define $\displaystyle S(N) = \sum_{n=1}^N a_n$. You are given $S(10) = -13$.<br> Find $S(...
https://projecteuler.net/problem=918
-6999033352333308
919
We call a triangle fortunate if it has integral sides and at least one of its vertices has the property that the distance from it to the triangle's orthocentre is exactly half the distance from the same vertex to the triangle's circumcentre. Triangle $ABC$ above is an example of a fortunate triangle with sides $(6,7,8...
<p>We call a triangle <i>fortunate</i> if it has integral sides and at least one of its vertices has the property that the distance from it to the triangle's <b>orthocentre</b> is exactly half the distance from the same vertex to the triangle's <b>circumcentre</b>.</p> <center><img src="resources/images/0919_remarkable...
https://projecteuler.net/problem=919
134222859969633
920
For a positive integer $n$ we define $\tau(n)$ to be the count of the divisors of $n$. For example, the divisors of $12$ are $\{1,2,3,4,6,12\}$ and so $\tau(12) = 6$. A positive integer $n$ is a tau number if it is divisible by $\tau(n)$. For example $\tau(12)=6$ and $6$ divides $12$ so $12$ is a tau number. Let $m(k...
<p>For a positive integer $n$ we define $\tau(n)$ to be the count of the divisors of $n$. For example, the divisors of $12$ are $\{1,2,3,4,6,12\}$ and so $\tau(12) = 6$.</p> <p> A positive integer $n$ is a <b>tau number</b> if it is divisible by $\tau(n)$. For example $\tau(12)=6$ and $6$ divides $12$ so $12$ is a tau...
https://projecteuler.net/problem=920
1154027691000533893
921
Consider the following recurrence relation: $$\begin{align} a_0 &= \frac{\sqrt 5 + 1}2\\ a_{n+1} &= \dfrac{a_n(a_n^4 + 10a_n^2 + 5)}{5a_n^4 + 10a_n^2 + 1} \end{align}$$ Note that $a_0$ is the golden ratio. $a_n$ can always be written in the form $\dfrac{p_n\sqrt{5}+1}{q_n}$, where $p_n$ and $q_n$ are positive integer...
<p>Consider the following recurrence relation: $$\begin{align} a_0 &amp;= \frac{\sqrt 5 + 1}2\\ a_{n+1} &amp;= \dfrac{a_n(a_n^4 + 10a_n^2 + 5)}{5a_n^4 + 10a_n^2 + 1} \end{align}$$</p> <p> Note that $a_0$ is the <b>golden ratio</b>.</p> <p> $a_n$ can always be written in the form $\dfrac{p_n\sqrt{5}+1}{q_n}$, where $p...
https://projecteuler.net/problem=921
378401935
922
A Young diagram is a finite collection of (equally-sized) squares in a grid-like arrangement of rows and columns, such that - the left-most squares of all rows are aligned vertically; - the top squares of all columns are aligned horizontally; - the rows are non-increasing in size as we move top to bottom; - the col...
<p> A <strong>Young diagram</strong> is a finite collection of (equally-sized) squares in a grid-like arrangement of rows and columns, such that</p> <ul> <li>the left-most squares of all rows are aligned vertically; </li><li>the top squares of all columns are aligned horizontally; </li><li>the rows are non-increasing i...
https://projecteuler.net/problem=922
858945298
923
A Young diagram is a finite collection of (equally-sized) squares in a grid-like arrangement of rows and columns, such that - the left-most squares of all rows are aligned vertically; - the top squares of all columns are aligned horizontally; - the rows are non-increasing in size as we move top to bottom; - the col...
<p> A <strong>Young diagram</strong> is a finite collection of (equally-sized) squares in a grid-like arrangement of rows and columns, such that</p> <ul> <li>the left-most squares of all rows are aligned vertically; </li><li>the top squares of all columns are aligned horizontally; </li><li>the rows are non-increasing i...
https://projecteuler.net/problem=923
740759929
924
Let $B(n)$ be the smallest number larger than $n$ that can be formed by rearranging digits of $n$, or $0$ if no such number exists. For example, $B(245) = 254$ and $B(542) = 0$. Define $a_0 = 0$ and $a_n = a_{n - 1}^2 + 2$ for $n>0$. Let $\displaystyle U(N) = \sum_{n = 1}^N B(a_n)$. You are given $U(10) \equiv 5438704...
<p>Let $B(n)$ be the smallest number larger than $n$ that can be formed by rearranging digits of $n$, or $0$ if no such number exists. For example, $B(245) = 254$ and $B(542) = 0$.</p> <p>Define $a_0 = 0$ and $a_n = a_{n - 1}^2 + 2$ for $n&gt;0$. Let $\displaystyle U(N) = \sum_{n = 1}^N B(a_n)$. You are given $U(10) \...
https://projecteuler.net/problem=924
811141860
925
Let $B(n)$ be the smallest number larger than $n$ that can be formed by rearranging digits of $n$, or $0$ if no such number exists. For example, $B(245) = 254$ and $B(542) = 0$. Define $\displaystyle T(N) = \sum_{n=1}^N B(n^2)$. You are given $T(10)=270$ and $T(100)=335316$. Find $T(10^{16})$. Give your answer modulo...
<p>Let $B(n)$ be the smallest number larger than $n$ that can be formed by rearranging digits of $n$, or $0$ if no such number exists. For example, $B(245) = 254$ and $B(542) = 0$.</p> <p>Define $\displaystyle T(N) = \sum_{n=1}^N B(n^2)$. You are given $T(10)=270$ and $T(100)=335316$.</p> <p>Find $T(10^{16})$. Give y...
https://projecteuler.net/problem=925
400034379
926
A round number is a number that ends with one or more zeros in a given base. Let us define the roundness of a number $n$ in base $b$ as the number of zeros at the end of the base $b$ representation of $n$. For example, $20$ has roundness $2$ in base $2$, because the base $2$ representation of $20$ is $10100$, which e...
<p> A <strong>round number</strong> is a number that ends with one or more zeros in a given base.</p> <p> Let us define the <dfn>roundness</dfn> of a number $n$ in base $b$ as the number of zeros at the end of the base $b$ representation of $n$.<br> For example, $20$ has roundness $2$ in base $2$, because the base $2$...
https://projecteuler.net/problem=926
40410219
927
A full $k$-ary tree is a tree with a single root node, such that every node is either a leaf or has exactly $k$ ordered children. The height of a $k$-ary tree is the number of edges in the longest path from the root to a leaf. For instance, there is one full 3-ary tree of height 0, one full 3-ary tree of height 1, an...
<p>A full $k$-ary tree is a tree with a single root node, such that every node is either a leaf or has exactly $k$ ordered children. The <b>height</b> of a $k$-ary tree is the number of edges in the longest path from the root to a leaf.</p> <p> For instance, there is one full 3-ary tree of height 0, one full 3-ary tr...
https://projecteuler.net/problem=927
207282955
928
This problem is based on (but not identical to) the scoring for the card game Cribbage. Consider a normal pack of $52$ cards. A Hand is a selection of one or more of these cards. For each Hand the Hand score is the sum of the values of the cards in the Hand where the value of Aces is $1$ and the value of court cards ...
<p>This problem is based on (but not identical to) the scoring for the card game <a href="https://en.wikipedia.org/wiki/Cribbage">Cribbage</a>.</p> <p> Consider a normal pack of $52$ cards. A Hand is a selection of one or more of these cards.</p> <p> For each Hand the <i>Hand score</i> is the sum of the values of th...
https://projecteuler.net/problem=928
81108001093
929
A composition of $n$ is a sequence of positive integers which sum to $n$. Such a sequence can be split into runs, where a run is a maximal contiguous subsequence of equal terms. For example, $2,2,1,1,1,3,2,2$ is a composition of $14$ consisting of four runs: $2, 2\quad 1, 1, 1\quad 3 \quad 2, 2$ Let $F(n)$ be the nu...
<p>A <b>composition</b> of $n$ is a sequence of positive integers which sum to $n$. Such a sequence can be split into <i>runs</i>, where a run is a maximal contiguous subsequence of equal terms.</p> <p>For example, $2,2,1,1,1,3,2,2$ is a composition of $14$ consisting of four runs:</p> <center>$2, 2\quad 1, 1, 1\quad ...
https://projecteuler.net/problem=929
57322484
930
Given $n\ge 2$ bowls arranged in a circle, $m\ge 2$ balls are distributed amongst them. Initially the balls are distributed randomly: for each ball, a bowl is chosen equiprobably and independently of the other balls. After this is done, we start the following process: - Choose one of the $m$ balls equiprobably at ran...
<p>Given $n\ge 2$ bowls arranged in a circle, $m\ge 2$ balls are distributed amongst them.</p> <p>Initially the balls are distributed randomly: for each ball, a bowl is chosen equiprobably and independently of the other balls. After this is done, we start the following process:</p> <ol> <li>Choose one of the $m$ balls...
https://projecteuler.net/problem=930
1.345679959251e12
931
For a positive integer $n$ construct a graph using all the divisors of $n$ as the vertices. An edge is drawn between $a$ and $b$ if $a$ is divisible by $b$ and $a/b$ is prime, and is given weight $\phi(a)-\phi(b)$, where $\phi$ is the Euler totient function. Define $t(n)$ to be the total weight of this graph. The exam...
<p> For a positive integer $n$ construct a graph using all the divisors of $n$ as the vertices. An edge is drawn between $a$ and $b$ if $a$ is divisible by $b$ and $a/b$ is prime, and is given weight $\phi(a)-\phi(b)$, where $\phi$ is the Euler totient function.<br> Define $t(n)$ to be the total weight of this graph.<b...
https://projecteuler.net/problem=931
128856311
932
For the year $2025$ $$2025 = (20 + 25)^2$$ Given positive integers $a$ and $b$, the concatenation $ab$ we call a $2025$-number if $ab = (a+b)^2$. Other examples are $3025$ and $81$. Note $9801$ is not a $2025$-number because the concatenation of $98$ and $1$ is $981$. Let $T(n)$ be the sum of all $2025$-numbers wit...
<p>For the year $2025$</p> $$2025 = (20 + 25)^2$$ <p>Given positive integers $a$ and $b$, the concatenation $ab$ we call a $2025$-number if $ab = (a+b)^2$.<br> Other examples are $3025$ and $81$.<br> Note $9801$ is not a $2025$-number because the concatenation of $98$ and $1$ is $981$.</p> <p> Let $T(n)$ be the sum of...
https://projecteuler.net/problem=932
72673459417881349
933
Starting with one piece of integer-sized rectangle paper, two players make moves in turn. A valid move consists of choosing one piece of paper and cutting it both horizontally and vertically, so that it becomes four pieces of smaller rectangle papers, all of which are integer-sized. The player that does not have a va...
<p> Starting with one piece of integer-sized rectangle paper, two players make moves in turn.<br> A valid move consists of choosing one piece of paper and cutting it <b>both</b> horizontally and vertically, so that it becomes four pieces of smaller rectangle papers, all of which are integer-sized.<br> The player that d...
https://projecteuler.net/problem=933
5707485980743099
934
We define the unlucky prime of a number $n$, denoted $u(n)$, as the smallest prime number $p$ such that the remainder of $n$ divided by $p$ (i.e. $n \bmod p$) is not a multiple of seven. For example, $u(14) = 3$, $u(147) = 2$ and $u(1470) = 13$. Let $U(N)$ be the sum $\sum_{n = 1}^N u(n)$. You are given $U(1470) = 4...
<p>We define the <i>unlucky prime</i> of a number $n$, denoted $u(n)$, as the smallest prime number $p$ such that the remainder of $n$ divided by $p$ (i.e. $n \bmod p$) is not a multiple of seven.<br> For example, $u(14) = 3$, $u(147) = 2$ and $u(1470) = 13$.</p> <p>Let $U(N)$ be the sum $\sum_{n = 1}^N u(n)$.<br> You...
https://projecteuler.net/problem=934
292137809490441370
935
A square of side length $b<1$ is rolling around the inside of a larger square of side length $1$, always touching the larger square but without sliding. Initially the two squares share a common corner. At each step, the small square rotates clockwise about a corner that touches the large square, until another of its c...
<p> A square of side length $b&lt;1$ is rolling around the inside of a larger square of side length $1$, always touching the larger square but without sliding.<br> Initially the two squares share a common corner. At each step, the small square rotates clockwise about a corner that touches the large square, until anothe...
https://projecteuler.net/problem=935
759908921637225
936
A peerless tree is a tree with no edge between two vertices of the same degree. Let $P(n)$ be the number of peerless trees on $n$ unlabelled vertices. There are six of these trees on seven unlabelled vertices, $P(7)=6$, shown below. Define $\displaystyle S(N) = \sum_{n=3}^N P(n)$. You are given $S(10) = 74$. Find $...
<p>A <i>peerless tree</i> is a tree with no edge between two vertices of the same degree. Let $P(n)$ be the number of peerless trees on $n$ unlabelled vertices.</p> <p>There are six of these trees on seven unlabelled vertices, $P(7)=6$, shown below.</p> <img src="resources/images/0936_diagram.jpg?1738919825" alt="0936...
https://projecteuler.net/problem=936
12144907797522336
937
Let $\theta=\sqrt{-2}$. Define $T$ to be the set of numbers of the form $a+b\theta$, where $a$ and $b$ are integers and either $a\gt 0$, or $a=0$ and $b\gt 0$. For a set $S \subseteq T$ and element $z \in T$, define $p(S,z)$ to be the number of ways of choosing two distinct elements from $S$ with product either $z$ or...
<p>Let $\theta=\sqrt{-2}$.</p> <p>Define $T$ to be the set of numbers of the form $a+b\theta$, where $a$ and $b$ are integers and either $a\gt 0$, or $a=0$ and $b\gt 0$. For a set $S \subseteq T$ and element $z \in T$, define $p(S,z)$ to be the number of ways of choosing two distinct elements from $S$ with product eit...
https://projecteuler.net/problem=937
792169346
938
A deck of cards contains $R$ red cards and $B$ black cards. A card is chosen uniformly randomly from the deck and removed. A second card is then chosen uniformly randomly from the cards remaining and removed. - If both cards are red, they are discarded. - If both cards are black, they are both put back in the deck. ...
<p> A deck of cards contains $R$ red cards and $B$ black cards.<br> A card is chosen uniformly randomly from the deck and removed. A second card is then chosen uniformly randomly from the cards remaining and removed.</p> <ul> <li> If both cards are red, they are discarded.</li> <li> If both cards are black, they are bo...
https://projecteuler.net/problem=938
0.2928967987
939
Two players A and B are playing a variant of Nim. At the beginning, there are several piles of stones. Each pile is either at the side of A or at the side of B. The piles are unordered. They make moves in turn. At a player's turn, the player can - either choose a pile on the opponent's side and remove one stone from...
<p> Two players A and B are playing a variant of Nim.<br> At the beginning, there are several piles of stones. Each pile is either at the side of A or at the side of B. The piles are unordered.</p> <p> They make moves in turn. At a player's turn, the player can</p> <ul> <li>either choose a pile on the opponent's side ...
https://projecteuler.net/problem=939
246776732
940
The Fibonacci sequence $(f_i)$ is the unique sequence such that - $f_0=0$ - $f_1=1$ - $f_{i+1}=f_i+f_{i-1}$ Similarly, there is a unique function $A(m,n)$ such that - $A(0,0)=0$ - $A(0,1)=1$ - $A(m+1,n)=A(m,n+1)+A(m,n)$ - $A(m+1,n+1)=2A(m+1,n)+A(m,n)$ Define $S(k)=\displaystyle\sum_{i=2}^k\sum_{j=2}^k A(f_i,f_...
<p> The <b>Fibonacci sequence</b> $(f_i)$ is the unique sequence such that </p> <ul> <li>$f_0=0$</li> <li>$f_1=1$</li> <li>$f_{i+1}=f_i+f_{i-1}$</li> </ul> <p> Similarly, there is a unique function $A(m,n)$ such that </p> <ul> <li>$A(0,0)=0$</li> <li>$A(0,1)=1$</li> <li>$A(m+1,n)=A(m,n+1)+A(m,n)$</li> <li>$A(m+1,n+1)=2...
https://projecteuler.net/problem=940
969134784
941
de Bruijn has a digital combination lock with $k$ buttons numbered $0$ to $k-1$ where $k \le 10$. The lock opens when the last $n$ buttons pressed match the preset combination. Unfortunately he has forgotten the combination. He creates a sequence of these digits which contains every possible combination of length $n$...
<p> de Bruijn has a digital combination lock with $k$ buttons numbered $0$ to $k-1$ where $k \le 10$.<br> The lock opens when the last $n$ buttons pressed match the preset combination.</p> <p> Unfortunately he has forgotten the combination. He creates a sequence of these digits which contains every possible combinatio...
https://projecteuler.net/problem=941
1068765750
942
Given a natural number $q$, let $p = 2^q - 1$ be the $q$-th Mersenne number. Let $R(q)$ be the minimal square root of $q$ modulo $p$, if one exists. In other words, $R(q)$ is the smallest positive integer $x$ such that $x^2 - q$ is divisible by $p$. For example, $R(5)=6$ and $R(17)=47569$. Find $R(74\,207\,281)$. Gi...
<p>Given a natural number $q$, let $p = 2^q - 1$ be the $q$-th <b>Mersenne number</b>.</p> <p>Let $R(q)$ be the minimal square root of $q$ modulo $p$, if one exists. In other words, $R(q)$ is the smallest positive integer $x$ such that $x^2 - q$ is divisible by $p$.</p> <p>For example, $R(5)=6$ and $R(17)=47569$.</p>...
https://projecteuler.net/problem=942
557539756
943
Given two unequal positive integers $a$ and $b$, we define a self-describing sequence consisting of alternating runs of $a$s and $b$s. The first element is $a$ and the sequence of run lengths is the original sequence. For $a=2, b=3$, the sequence is: $$2, 2, 3, 3, 2, 2, 2, 3, 3, 3, 2, 2, 3, 3, 2, 2, 3, 3, 3, 2, 2, 2, ...
<p>Given two unequal positive integers $a$ and $b$, we define a self-describing sequence consisting of alternating runs of $a$s and $b$s. The first element is $a$ and the sequence of run lengths is the original sequence.</p> <p>For $a=2, b=3$, the sequence is: $$2, 2, 3, 3, 2, 2, 2, 3, 3, 3, 2, 2, 3, 3, 2, 2, 3, 3, 3...
https://projecteuler.net/problem=943
1038733707
944
Given a set $E$ of positive integers, an element $x$ of $E$ is called an element divisor (elevisor) of $E$ if $x$ divides another element of $E$. The sum of all elevisors of $E$ is denoted $\operatorname{sev}(E)$. For example, $\operatorname{sev}(\{1, 2, 5, 6\}) = 1 + 2 = 3$. Let $S(n)$ be the sum of $\operatorname{...
<p> Given a set $E$ of positive integers, an element $x$ of $E$ is called an <dfn>element divisor (elevisor)</dfn> of $E$ if $x$ divides <b>another</b> element of $E$.</p> <p> The sum of all elevisors of $E$ is denoted $\operatorname{sev}(E)$.<br> For example, $\operatorname{sev}(\{1, 2, 5, 6\}) = 1 + 2 = 3$.</p> <p>...
https://projecteuler.net/problem=944
1228599511
945
We use $x\oplus y$ for the bitwise XOR of $x$ and $y$. Define the XOR-product of $x$ and $y$, denoted by $x \otimes y$, similar to a long multiplication in base $2$, except that the intermediate results are XORed instead of the usual integer addition. For example, $7 \otimes 3 = 9$, or in base $2$, $111_2 \otimes 11_...
We use $x\oplus y$ for the bitwise XOR of $x$ and $y$.<br> Define the <dfn>XOR-product</dfn> of $x$ and $y$, denoted by $x \otimes y$, similar to a long multiplication in base $2$, except that the intermediate results are XORed instead of the usual integer addition.<br> For example, $7 \otimes 3 = 9$, or in base $2$, ...
https://projecteuler.net/problem=945
83357132
946
Given the representation of a continued fraction $$ a_0+ \cfrac 1{a_1+ \cfrac 1{a_2+\cfrac 1{a_3+\ddots }}}= [a_0;a_1,a_2,a_3,\ldots] $$ $\alpha$ is a real number with continued fraction representation: $\alpha = [2;1,1,2,1,1,1,2,1,1,1,1,1,2,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,2,\ldots]$ where the number of $1$'s be...
<p>Given the representation of a continued fraction $$ a_0+ \cfrac 1{a_1+ \cfrac 1{a_2+\cfrac 1{a_3+\ddots }}}= [a_0;a_1,a_2,a_3,\ldots] $$</p> <p> $\alpha$ is a real number with continued fraction representation: $\alpha = [2;1,1,2,1,1,1,2,1,1,1,1,1,2,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,2,\ldots]$<br> where the num...
https://projecteuler.net/problem=946
585787007
947
The $(a,b,m)$-sequence, where $0 \leq a,b \lt m$, is defined as $\begin{align*} g(0)&=a\\ g(1)&=b\\ g(n)&= \big(g(n-1) + g(n-2)\big) \bmod m \end{align*}$ All $(a,b,m)$-sequences are periodic with period denoted by $p(a,b,m)$. The first few terms of the $(0,1,8)$-sequence are $(0,1,1,2,3,5,0,5,5,2,7,1,0,1,1,2,\ldots...
<p> The $(a,b,m)$-sequence, where $0 \leq a,b \lt m$, is defined as</p> <div style="text-align:center;"> $\begin{align*} g(0)&amp;=a\\ g(1)&amp;=b\\ g(n)&amp;= \big(g(n-1) + g(n-2)\big) \bmod m \end{align*}$ </div> <p> All $(a,b,m)$-sequences are periodic with period denoted by $p(a,b,m)$.<br> The first few terms of...
https://projecteuler.net/problem=947
213731313
948
Left and Right play a game with a word consisting of L's and R's, alternating turns. On Left's turn, Left can remove any positive number of letters, but not all the letters, from the left side of the word. Right does the same on Right's turn except that Right removes letters from the right side. The game continues unti...
<p>Left and Right play a game with a word consisting of L's and R's, alternating turns. On Left's turn, Left can remove any positive number of letters, but not all the letters, from the left side of the word. Right does the same on Right's turn except that Right removes letters from the right side. The game continues u...
https://projecteuler.net/problem=948
1033654680825334184
949
Left and Right play a game with a number of words, each consisting of L's and R's, alternating turns. On Left's turn, for each word, Left can remove any number of letters (possibly zero), but not all the letters, from the left side of the word. However, at least one letter must be removed from at least one word. Right ...
<p>Left and Right play a game with a number of words, each consisting of L's and R's, alternating turns. On Left's turn, <b>for each word</b>, Left can remove any number of letters (possibly zero), but not all the letters, from the left side of the word. However, at least one letter must be removed from at least one wo...
https://projecteuler.net/problem=949
726010935
950
A band of pirates has come into a hoard of treasure, and must decide how to distribute it amongst themselves. The treasure consists of identical, indivisible gold coins. According to pirate law, the distribution of treasure must proceed as follows: - The most senior pirate proposes a distribution of the coins. - All...
<p>A band of pirates has come into a hoard of treasure, and must decide how to distribute it amongst themselves. The treasure consists of identical, indivisible gold coins.</p> <p>According to pirate law, the distribution of treasure must proceed as follows:</p> <ol> <li>The most senior pirate proposes a distribution ...
https://projecteuler.net/problem=950
429162542
951
Two players play a game using a deck of $2n$ cards: $n$ red and $n$ black. Initially the deck is shuffled into one of the $\binom{2n}{n}$ possible starting configurations. Play then proceeds, alternating turns, where a player follows two steps on each turn: - Remove the top card from the deck, taking note of its colou...
<p> Two players play a game using a deck of $2n$ cards: $n$ red and $n$ black. Initially the deck is shuffled into one of the $\binom{2n}{n}$ possible starting configurations. Play then proceeds, alternating turns, where a player follows two steps on each turn:</p> <ol> <li> Remove the top card from the deck, taking n...
https://projecteuler.net/problem=951
495568995495726
952
Given a prime $p$ and a positive integer $n \lt p$, let $R(p, n)$ be the multiplicative order of $p$ modulo $n!$. In other words, $R(p, n)$ is the minimal positive integer $r$ such that $$p^r \equiv 1 \pmod{n!}$$ For example, $R(7, 4) = 2$ and $R(10^9 + 7, 12) = 17280$. Find $R(10^9 + 7, 10^7)$. Give your answer mo...
<p> Given a prime $p$ and a positive integer $n \lt p$, let $R(p, n)$ be the <b>multiplicative order</b> of $p$ modulo $n!$.<br> In other words, $R(p, n)$ is the minimal positive integer $r$ such that</p> $$p^r \equiv 1 \pmod{n!}$$ <p> For example, $R(7, 4) = 2$ and $R(10^9 + 7, 12) = 17280$.</p> <p> Find $R(10^9 + ...
https://projecteuler.net/problem=952
794394453
953
In the classical game of Nim two players take turns removing stones from piles. A player may remove any positive number of stones from a single pile. If there are no remaining stones, the next player to move loses. In Factorisation Nim the initial position of the game is chosen according to the prime factorisation of ...
<p>In the classical game of <b>Nim</b> two players take turns removing stones from piles. A player may remove any positive number of stones from a single pile. If there are no remaining stones, the next player to move loses.</p> <p>In Factorisation Nim the initial position of the game is chosen according to the prime ...
https://projecteuler.net/problem=953
176907658
954
A positive integer is called heptaphobic if it is not divisible by seven and no number divisible by seven can be produced by swapping two of its digits. Note that leading zeros are not allowed before or after the swap. For example, $17$ and $1305$ are heptaphobic, but $14$ and $132$ are not because $14$ and $231$ are ...
<p>A positive integer is called <i>heptaphobic</i> if it is not divisible by seven and no number divisible by seven can be produced by swapping two of its digits. Note that leading zeros are not allowed before or after the swap.</p> <p>For example, $17$ and $1305$ are heptaphobic, but $14$ and $132$ are not because $1...
https://projecteuler.net/problem=954
736463823
955
A sequence $(a_n)_{n \ge 0}$ starts with $a_0 = 3$ and for each $n \ge 0$, - if $a_n$ is a triangle numberA triangle number is a number of the form $m(m + 1)/2$ for some integer $m$., then $a_{n + 1} = a_n + 1$; - otherwise, $a_{n + 1} = 2a_n - a_{n - 1} + 1$. The sequence begins: $${\color{red}3}, 4, {\color{red}6}...
<p> A sequence $(a_n)_{n \ge 0}$ starts with $a_0 = 3$ and for each $n \ge 0$,</p> <ul> <li>if $a_n$ is a <strong class="tooltip">triangle number<span class="tooltiptext">A triangle number is a number of the form $m(m + 1)/2$ for some integer $m$.</span></strong>, then $a_{n + 1} = a_n + 1$;</li> <li>otherwise, $a_{n +...
https://projecteuler.net/problem=955
6795261671274
956
The total number of prime factors of $n$, counted with multiplicity, is denoted $\Omega(n)$. For example, $\Omega(12)=3$, counting the factor $2$ twice, and the factor $3$ once. Define $D(n, m)$ to be the sum of all divisors $d$ of $n$ where $\Omega(d)$ is divisible by $m$. For example, $D(24, 3)=1+8+12=21$. The su...
<p> The total number of prime factors of $n$, counted with multiplicity, is denoted $\Omega(n)$.<br> For example, $\Omega(12)=3$, counting the factor $2$ twice, and the factor $3$ once.</p> <p> Define $D(n, m)$ to be the sum of all divisors $d$ of $n$ where $\Omega(d)$ is divisible by $m$. <br> For example, $D(24, 3)=...
https://projecteuler.net/problem=956
882086212
957
There is a plane on which all points are initially white, except three red points and two blue points. On each day, every line passing through a red point and a blue point is constructed. Then every white point, where two different such lines meet, turns blue. Let $g(n)$ be the maximal possible number of blue points ...
<p> There is a plane on which all points are initially white, except three red points and two blue points.<br> On each day, every line passing through a red point and a blue point is constructed. Then every white point, where two different such lines meet, turns blue.</p> <p> Let $g(n)$ be the maximal possible number ...
https://projecteuler.net/problem=957
234897386493229284
958
The Euclidean algorithm can be used to find the greatest common divisor of two positive integers. At each step of the algorithm the smaller number is subtracted from the larger one. The algorithm terminates when the numbers are equal, which is then the greatest common divisor of the original numbers. For two numbers $...
<p>The <b>Euclidean algorithm</b> can be used to find the <b>greatest common divisor</b> of two positive integers. At each step of the algorithm the smaller number is subtracted from the larger one. The algorithm terminates when the numbers are equal, which is then the greatest common divisor of the original numbers.</...
https://projecteuler.net/problem=958
367554579311
959
A frog is placed on the number line. Every step the frog jumps either $a$ units to the left or $b$ units to the right, both with $1/2$ probability. Define $f(a, b)$ as the limit $\lim_{n \to \infty} \frac{c_n}n$ where $c_n$ is the expected number of unique numbers visited in the first $n$ steps. You are given $f(1, 1)...
<p>A frog is placed on the number line. Every step the frog jumps either $a$ units to the left or $b$ units to the right, both with $1/2$ probability.</p> <p>Define $f(a, b)$ as the limit $\lim_{n \to \infty} \frac{c_n}n$ where $c_n$ is the expected number of unique numbers visited in the first $n$ steps. You are give...
https://projecteuler.net/problem=959
0.857162085
960
There are $n$ distinct piles of stones, each of size $n-1$. Starting with an initial score of $0$, the following procedure is repeated: - Choose any two piles and remove exactly $n$ stones in total from the two piles. - If the number of stones removed from the two piles were $a$ and $b$, add $\min(a,b)$ to the score....
<p> There are $n$ distinct piles of stones, each of size $n-1$. Starting with an initial score of $0$, the following procedure is repeated:</p> <ol> <li>Choose any two piles and remove exactly $n$ stones in total from the two piles.</li> <li>If the number of stones removed from the two piles were $a$ and $b$, add $\min...
https://projecteuler.net/problem=960
243559751
961
This game starts with a positive integer. Two players take turns to remove a single digit from that integer. After the digit is removed any resulting leading zeros are removed. For example, removing a digit from $105$ results in either $5$, $10$ or $15$. The winner is the person who removes the last nonzero digit. D...
<p> This game starts with a positive integer. Two players take turns to remove a single digit from that integer. After the digit is removed any resulting leading zeros are removed.</p> <p> For example, removing a digit from $105$ results in either $5$, $10$ or $15$.</p> <p> The winner is the person who removes the la...
https://projecteuler.net/problem=961
166666666689036288
962
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 exceedin...
<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 src="reso...
https://projecteuler.net/problem=962
7259046
963
NOTE: This problem is related to Problem 882. It is recommended to solve that problem before doing this one. Two players are playing a game. When the game starts, each player holds a paper with two positive integers written on it. They make moves in turn. At a player's turn, the player can do one of the following: -...
<p class="note"><b>NOTE</b>: This problem is related to <a href="problem=882">Problem 882</a>. It is recommended to solve that problem before doing this one.</p> <p> Two players are playing a game. When the game starts, each player holds a paper with two positive integers written on it.<br> They make moves in turn. At...
https://projecteuler.net/problem=963
55129975871328418
964
A group of $k(k-1) / 2 + 1$ children play a game of $k$ rounds. At the beginning, they are all seated on chairs arranged in a circle. During the $i$-th round: - The music starts playing and $i$ children are randomly selected, with all combinations being equally likely. The selected children stand up and dance aroun...
<p>A group of $k(k-1) / 2 + 1$ children play a game of $k$ rounds.<br> At the beginning, they are all seated on chairs arranged in a circle.</p> <p>During the $i$-th round:</p> <ol> <li>The music starts playing and $i$ children are randomly selected, with all combinations being equally likely. The selected children s...
https://projecteuler.net/problem=964
4.7126135532e-29
965
Let $\{x\}$ denote the fractional part of a real number $x$. Define $f_N(x)$ to be the minimal value of $\{nx\}$ for integer $n$ satisfying $0 < n \le N$. Further define $F(N)$ to be the expected value of $f_N(x)$ when $x$ is sampled uniformly in $[0, 1]$. You are given $F(1) = \frac{1}{2}$, $F(4) = \frac{1}{4}$ and...
<p>Let $\{x\}$ denote the fractional part of a real number $x$.</p> <p>Define $f_N(x)$ to be the <b>minimal</b> value of $\{nx\}$ for integer $n$ satisfying $0 &lt; n \le N$.<br> Further define $F(N)$ to be the expected value of $f_N(x)$ when $x$ is sampled uniformly in $[0, 1]$.</p> <p>You are given $F(1) = \frac{1}...
https://projecteuler.net/problem=965
0.0003452201133
966
Let $I(a, b, c)$ be the largest possible area of intersection between a triangle of side lengths $a, b, c$ and a circle which has the same area as the triangle. For example $I(3, 4, 5) \approx 4.593049$ and $I(3, 4, 6) \approx 3.552564$. Find the sum of $I(a, b, c)$ for integers $a, b, c$ such that $1 \le a \le b \le...
<p> Let $I(a, b, c)$ be the largest possible area of intersection between a triangle of side lengths $a, b, c$ and a circle which has the same area as the triangle.<br> For example $I(3, 4, 5) \approx 4.593049$ and $I(3, 4, 6) \approx 3.552564$.</p> <p> Find the sum of $I(a, b, c)$ for integers $a, b, c$ such that $1 ...
https://projecteuler.net/problem=966
29337152.09
967
A positive integer $n$ is considered $B$-trivisible if the sum of all different prime factors of $n$ which are not larger than $B$ is divisible by $3$. For example, $175 = 5^2 \cdot 7$ is $10$-trivisible because $5 + 7 = 12$ which is divisible by $3$. Similarly, $175$ is $4$-trivisible because all primes dividing $175...
<p> A positive integer $n$ is considered <i>$B$-trivisible</i> if the sum of all different prime factors of $n$ which are not larger than $B$ is divisible by $3$.</p> <p> For example, $175 = 5^2 \cdot 7$ is $10$-trivisible because $5 + 7 = 12$ which is divisible by $3$. Similarly, $175$ is $4$-trivisible because all p...
https://projecteuler.net/problem=967
357591131712034236
968
Define $$P(X_{a,b},X_{a,c},X_{a,d},X_{a,e},X_{b,c},X_{b,d},X_{b,e},X_{c,d},X_{c,e},X_{d,e})$$ as the sum of $2^a3^b5^c7^d11^e$ over all quintuples of non-negative integers $(a, b, c, d, e)$ such that the sum of each two of the five variables is restricted by a given value. In other words, $a+b \le X_{a,b}$, $a+d \le X_...
<p> Define $$P(X_{a,b},X_{a,c},X_{a,d},X_{a,e},X_{b,c},X_{b,d},X_{b,e},X_{c,d},X_{c,e},X_{d,e})$$ as the sum of $2^a3^b5^c7^d11^e$ over all quintuples of non-negative integers $(a, b, c, d, e)$ such that the sum of each two of the five variables is restricted by a given value. In other words, $a+b \le X_{a,b}$, $a+d \l...
https://projecteuler.net/problem=968
885362394
969
Starting at zero, a kangaroo hops along the real number line in the positive direction. Each successive hop takes the kangaroo forward a uniformly random distance between $0$ and $1$. Let $H(n)$ be the expected number of hops needed for the kangaroo to pass $n$ on the real line. If we write $\alpha = H(1)$, then for a...
<p> Starting at zero, a kangaroo hops along the real number line in the positive direction. Each successive hop takes the kangaroo forward a uniformly random distance between $0$ and $1$. Let $H(n)$ be the expected number of hops needed for the kangaroo to pass $n$ on the real line. </p> <p> If we write $\alpha = H(1)$...
https://projecteuler.net/problem=969
412543690
970
Starting at zero, a kangaroo hops along the real number line in the positive direction. Each successive hop takes the kangaroo forward a uniformly random distance between $0$ and $1$. Let $H(n)$ be the expected number of hops needed for the kangaroo to pass $n$ on the real line. For example, $H(2) \approx 4.6707742704...
<p> Starting at zero, a kangaroo hops along the real number line in the positive direction. Each successive hop takes the kangaroo forward a uniformly random distance between $0$ and $1$. Let $H(n)$ be the expected number of hops needed for the kangaroo to pass $n$ on the real line. </p> <p> For example, $H(2) \approx ...
https://projecteuler.net/problem=970
44754029
971
Let $p$ be a prime of the form $5k-4$ and define $f_p(x) = \left(x^k+x\right) \bmod p$. Let $C(p)$ be the number of values $0 \le x \lt p$ such that $f_p^{(m)}(x) = x$ for some positive integer $m$, that is, $x$ can be obtained by iteratively applying $f_p$ on itself starting at $x$. For example, $C(11) = 7$, due to ...
<p>Let $p$ be a prime of the form $5k-4$ and define $f_p(x) = \left(x^k+x\right) \bmod p$.</p> <p>Let $C(p)$ be the number of values $0 \le x \lt p$ such that $f_p^{(m)}(x) = x$ for some positive integer $m$, that is, $x$ can be obtained by iteratively applying $f_p$ on itself starting at $x$.</p> <p>For example, $C(...
https://projecteuler.net/problem=971
33626723890930
972
The hyperbolic plane can be represented by the open unit disc, namely the set of points $(x, y)$ in $\Bbb R^2$ with $x^2 + y^2 < 1$. A geodesic is defined as either a diameter of the open unit disc or a circular arc contained within the disc that is orthogonal to the boundary of the disc. The following diagram shows ...
<p> The <b>hyperbolic plane</b> can be represented by the <b>open unit disc</b>, namely the set of points $(x, y)$ in $\Bbb R^2$ with $x^2 + y^2 &lt; 1$.</p> <p> A <b>geodesic</b> is defined as either a diameter of the open unit disc or a circular arc contained within the disc that is orthogonal to the boundary of the...
https://projecteuler.net/problem=972
3575508
973
A game is played with $n$ cards. At the start the cards are dealt out onto a table to get $n$ piles of size one. Each round proceeds as follows: - Select a pile at random and pick it up. - Randomly choose a pile from the table and add the top card of the picked-up pile to it. - Redistribute any remaining cards from...
<p> A game is played with $n$ cards. At the start the cards are dealt out onto a table to get $n$ piles of size one.</p> <p> Each round proceeds as follows:</p> <ol> <li>Select a pile at random and pick it up.</li> <li>Randomly choose a pile from the table and add the top card of the picked-up pile to it.</li> <li>Red...
https://projecteuler.net/problem=973
427278142
974
A very odd number is a number which contains only odd digits and is divisible by $105$. Further each odd digit occurs an odd number of times. Define $\Theta (n)$ be the $n$th very odd number, then $\Theta (1) = 1117935$ and $\Theta(10^3) = 11137955115$. Find $\Theta(10^{16})$.
<p> A <i>very odd number</i> is a number which contains only odd digits and is divisible by $105$. Further each odd digit occurs an odd number of times.</p> <p> Define $\Theta (n)$ be the $n$th very odd number, then $\Theta (1) = 1117935$ and $\Theta(10^3) = 11137955115$.</p> <p> Find $\Theta(10^{16})$.</p>
https://projecteuler.net/problem=974
13313751171933973557517973175
975
Given a pair $(a,b)$ of coprime odd positive integers, define the function $$H_{a,b}(x)=\frac{1}{2}-\frac{1}{2(a+b)}\Bigl(b\cos(a\pi x)+a\cos(b\pi x)\Bigr) $$It can be seen that $H_{a,b}(0)=0$, $H_{a,b}(1)=1$, and $0 < H_{a,b}(x) < 1$ for all $x$ strictly between $0$ and $1$. Given two such pairs $(a,b)$ and $(c,d)$, ...
<p> Given a pair $(a,b)$ of <b>coprime odd positive integers</b>, define the function $$H_{a,b}(x)=\frac{1}{2}-\frac{1}{2(a+b)}\Bigl(b\cos(a\pi x)+a\cos(b\pi x)\Bigr) $$It can be seen that $H_{a,b}(0)=0$, $H_{a,b}(1)=1$, and $0 &lt; H_{a,b}(x) &lt; 1$ for all $x$ strictly between $0$ and $1$. </p><p> Given two such pai...
https://projecteuler.net/problem=975
88597366.47748
976
Two players X and O play a game with $k$ strips of squares of lengths $n_1,\dots,n_k$, originally all blank. Starting with X, they make moves in turn. At X's turn, X draws an "X" symbol; at O's turn, O draws an "O" symbol. The symbol must be drawn in one blank square with either red or blue pen, subject to the follow...
<p> Two players X and O play a game with $k$ strips of squares of lengths $n_1,\dots,n_k$, originally all blank.</p> <p> Starting with X, they make moves in turn. At X's turn, X draws an "X" symbol; at O's turn, O draws an "O" symbol.<br> The symbol must be drawn in one blank square with either red or blue pen, subjec...
https://projecteuler.net/problem=976
675608326
977
For a positive integer $n$, let $F(n)$ denote the number of functions $f$ from the set $S_n=\{1,2,\dots,n\}$ to itself such that $f^{(x)}(y)=f^{(y)}(x)$ for any $x,y$ in $S_n$. Here $f^{(k)}$ denotes the $k$-th iterated composition of $f$, e.g. $f^{(2)}(x)=f(f(x))$. For example, $F(3)=8$, $F(7)=174$, $F(100)=570271270...
<p>For a positive integer $n$, let $F(n)$ denote the number of functions $f$ from the set $S_n=\{1,2,\dots,n\}$ to itself such that $f^{(x)}(y)=f^{(y)}(x)$ for any $x,y$ in $S_n$. Here $f^{(k)}$ denotes the $k$-th iterated composition of $f$, e.g. $f^{(2)}(x)=f(f(x))$.</p> <p>For example, $F(3)=8$, $F(7)=174$, $F(100)...
https://projecteuler.net/problem=977
537945304
978
In this problem we consider a random walk on the integers $\mathbb{Z}$, in which our position at time $t$ is denoted as $X_t$. At time $0$ we start at position $0$. That is, $X_0=0$. At time $1$ we jump to position $1$. That is, $X_1=1$. Thereafter, at time $t=2,3,\dots$ we make a jump of size $|X_{t-2}|$ in either ...
<p> In this problem we consider a <b>random walk</b> on the integers $\mathbb{Z}$, in which our position at time $t$ is denoted as $X_t$. </p> <p> At time $0$ we start at position $0$. That is, $X_0=0$.<br> At time $1$ we jump to position $1$. That is, $X_1=1$.<br> Thereafter, at time $t=2,3,\dots$ we make a jump of si...
https://projecteuler.net/problem=978
254.54470757
979
The hyperbolic plane, represented by the open unit disc, can be tiled by heptagons. Every tile is a hyperbolic heptagon (i.e. it has seven edges which are segments of geodesics in the hyperbolic plane) and every vertex is shared by three tiles. Please refer to Problem 972 for some of the definitions. The diagram belo...
<p>The <b>hyperbolic plane</b>, represented by the <b>open unit disc</b>, can be tiled by heptagons. Every tile is a hyperbolic heptagon (i.e. it has seven edges which are segments of <b>geodesics</b> in the hyperbolic plane) and every vertex is shared by three tiles.<br> Please refer to <a href="problem=972">Problem 9...
https://projecteuler.net/problem=979
189306828278449
980
Starting from an empty string, we want to build a string with letters "x", "y", "z". At each step, one of the following operations is performed: - insert two consecutive identical letters "xx", "yy" or "zz" anywhere into the string; - replace one letter in the string with two consecutive letters, according to the rul...
<p> Starting from an empty string, we want to build a string with letters "x", "y", "z". At each step, one of the following operations is performed:</p> <ul> <li>insert two consecutive identical letters "xx", "yy" or "zz" anywhere into the string;</li> <li>replace one letter in the string with two consecutive letters, ...
https://projecteuler.net/problem=980
124999683766
981
Starting from an empty string, we want to build a string with letters "x", "y", "z". At each step, one of the following operations is performed: - insert two consecutive identical letters "xx", "yy" or "zz" anywhere into the string; - replace one letter in the string with two consecutive letters, according to the rul...
<p> Starting from an empty string, we want to build a string with letters "x", "y", "z". At each step, one of the following operations is performed:</p> <ul> <li>insert two consecutive identical letters "xx", "yy" or "zz" anywhere into the string;</li> <li>replace one letter in the string with two consecutive letters, ...
https://projecteuler.net/problem=981
794963735