task
stringlengths
0
154k
__index_level_0__
int64
0
39.2k
Given a character string s, we define L(k,s) to be the length of the longest substring of s which appears at least k times in s, or 0 if such a substring does not exist. For example, L(3,\text{“bbabcabcabcacba”})=4 because of the three occurrences of the substring \text{“abca”}, and L(2,\text{“bbabcabcabcacba”})=7 beca...
25,700
Siegbert and Jo take turns playing a game with a heap of N pebbles: 1. Siegbert is the first to take some pebbles. He can take as many pebbles as he wants. (Between 1 and N inclusive.) 2. In each of the following turns the current player must take at least one pebble and at most twice the amount of pebbles taken by the...
25,701
Two positive integers x and y (x > y) can generate a sequence in the following manner: a_x = y is the first term, a_{z+1} = a_z^2 \bmod z for z = x, x+1,x+2,\ldots and the generation stops when a term becomes 0 or 1. The number of terms in this sequence is denoted l(x,y). For example, with x = 5 and y = 3, we get a_5 =...
25,702
A positive integer n is considered cube-full , if for every prime p that divides n, so does p^3. Note that 1 is considered cube-full. Let s(n) be the function that counts the number of cube-full divisors of n. For example, 1, 8 and 16 are the three cube-full divisors of 16. Therefore, s(16)=3. Let S(n) represent the su...
25,703
Three points, P_1, P_2 and P_3, are randomly selected within a unit square. Consider the three rectangles with sides parallel to the sides of the unit square and a diagonal that is one of the three line segments \overline{P_1P_2}, \overline{P_1P_3} or \overline{P_2P_3} (see picture below). We are interested in the rect...
25,704
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 pr...
25,705
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 prec...
25,706
We define 123-numbers as follows: 1 is the smallest 123-number. When written in base 10 the only digits that can be present are "1", "2" and "3" and if present the number of times they each occur is also a 123-number. So 2 is a 123-number, since it consists of one digit "2" and 1 is a 123-number. Therefore, 33 is a 12...
25,707
Let \sigma(n) be the sum of all the divisors of the positive integer n, for example: \sigma(10) = 1+2+5+10 = 18. Define T(N) to be the sum of all numbers n \le N such that when the fraction \frac{\sigma(n)}{n} is written in its lowest form \frac ab, the denominator is a power of 3 i.e. b = 3^k, k > 0. You are given T(1...
25,708
Leonhard Euler was born on 15 April 1707. Consider the sequence 1504170715041707 n mod 4503599627370517. An element of this sequence is defined to be an Eulercoin if it is strictly smaller than all previously found Eulercoins. For example, the first term is 1504170715041707 which is the first Eulercoin. The second ter...
25,709
Consider a rectangle made up of W \times H square cells each with area 1. Each cell is independently coloured black with probability 0.5 otherwise white. Black cells sharing an edge are assumed to be connected. Consider the maximum area of connected cells. Define E(W,H) to be the expected value of this maximum area. Fo...
25,710
A regular hexagon table of side length N is divided into equilateral triangles of side length 1. The picture below is an illustration of the case N = 3. An flea of negligible size is jumping on this table. The flea starts at the centre of the table. Thereafter, at each step, it chooses one of the six corners of the tab...
25,711
Given an integer n, n \geq 3, let B=\{\mathrm{false},\mathrm{true}\} and let B^n be the set of sequences of n values from B. The function f from B^n to B^n is defined by f(b_1 \dots b_n) = c_1 \dots c_n where: c_i = b_{i+1} for 1 \leq i < n. c_n = b_1 \;\mathrm{AND}\; (b_2 \;\mathrm{XOR}\; b_3), where \mathrm{AND} and ...
25,712
Define g(n, m) to be the largest integer k such that 2^k divides \binom{n}m. For example, \binom{12}5 = 792 = 2^3 \cdot 3^2 \cdot 11, hence g(12, 5) = 3. Then define F(n) = \max \{ g(n, m) : 0 \le m \le n \}. F(10) = 3 and F(100) = 6. Let S(N) = \displaystyle\sum_{n=1}^N{F(n)}. You are given that S(100) = 389 and S(1...
25,713
The inversion count of a sequence of digits is the smallest number of adjacent pairs that must be swapped to sort the sequence. For example, 34214 has inversion count of 5: 34214 \to 32414 \to 23414 \to 23144 \to 21344 \to12344. If each digit of a sequence is replaced by one of its divisors a divided sequence is obtain...
25,714
For a positive integer n, define f(n) to be the number of non-empty substrings of n that are divisible by 3. For example, the string "2573" has 10 non-empty substrings, three of which represent numbers that are divisible by 3, namely 57, 573 and 3. So f(2573) = 3. If f(n) is divisible by 3 then we say that n is 3-like ...
25,715
Consider a w\times h grid. A cell is either ON or OFF. When a cell is selected, that cell and all cells connected to that cell by an edge are toggled on-off, off-on. See the diagram for the 3 cases of selecting a corner cell, an edge cell or central cell in a grid that has all cells on (white). The goal is to get every...
25,716
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}^{...
25,717
Every day for the past n days Even Stevens brings home his groceries in a plastic bag. He stores these plastic bags in a cupboard. He either puts the plastic bag into the cupboard with the rest, or else he takes an even number of the existing bags (which may either be empty or previously filled with other bags themselv...
25,718
On Sunday 5 April 2020 the Project Euler membership first exceeded one million members. We would like to present this problem to celebrate that milestone. Thank you to everyone for being a part of Project Euler. The number 6 can be written as a palindromic sum in exactly eight different ways: (1, 1, 1, 1, 1, 1), (1, 1,...
25,719
Oscar and Eric play the following game. First, they agree on a positive integer n, and they begin by writing its binary representation on a blackboard. They then take turns, with Oscar going first, to write a number on the blackboard in binary representation, such that the sum of all written numbers does not exceed 2n....
25,720
For any integer n>0 and prime number p, define \nu_p(n) as the greatest integer r such that p^r divides n. Define D(n, m) = \sum_{p \text{ prime}} \left| \nu_p(n) - \nu_p(m)\right|. For example, D(14,24) = 4. Furthermore, define S(N) = \sum_{1 \le n, m \le N} D(n, m). You are given S(10) = 210 and S(10^2) = 37018. Fin...
25,721
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 syste...
25,722
We call a natural number a duodigit if its decimal representation uses no more than two different digits. For example, 12, 110 and 33333 are duodigits, while 102 is not. It can be shown that every natural number has duodigit multiples. Let d(n) be the smallest (positive) multiple of the number n that happens to be a du...
25,723
Let f(n) be the number of 6-tuples (x_1,x_2,x_3,x_4,x_5,x_6) such that: All x_i are integers with 0 \leq x_i < n \gcd(x_1^2+x_2^2+x_3^2+x_4^2+x_5^2+x_6^2,\ n^2)=1 Let \displaystyle G(n)=\displaystyle\sum_{k=1}^n \frac{f(k)}{k^2\varphi(k)} where \varphi(n) is Euler's totient function. For example, G(10)=3053 and G(10^5)...
25,724
Consider a directed graph made from an orthogonal lattice of H\times W nodes. The edges are the horizontal and vertical connections between adjacent nodes. W vertical directed lines are drawn and all the edges on these lines inherit that direction. Similarly, H horizontal directed lines are drawn and all the edges on ...
25,725
For an odd prime p, define f(p) = \left\lfloor\frac{2^{(2^p)}}{p}\right\rfloor\bmod{2^p} For example, when p=3, \lfloor 2^8/3\rfloor = 85 \equiv 5 \pmod 8 and so f(3) = 5. Further define g(p) = f(p)\bmod p. You are given g(31) = 17. Now define G(N) to be the summation of g(p) for all odd primes less than N. You are giv...
25,726
Consider the equation 17^pa+19^pb+23^pc = n where a, b, c and p are positive integers, i.e. a,b,c,p \gt 0. For a given p there are some values of n > 0 for which the equation cannot be solved. We call these unreachable values . Define G(p) to be the sum of all unreachable values of n for the given value of p. For examp...
25,727
We define an S-number to be a natural number, n, that is a perfect square and its square root can be obtained by splitting the decimal representation of n into 2 or more numbers then adding the numbers. For example, 81 is an S-number because \sqrt{81} = 8+1. 6724 is an S-number: \sqrt{6724} = 6+72+4. 8281 is an S-numbe...
25,728
Consider all permutations of \{1, 2, \ldots N\}, listed in lexicographic order. For example, for N=4, the list starts as follows: \displaylines{ (1, 2, 3, 4) \\ (1, 2, 4, 3) \\ (1, 3, 2, 4) \\ (1, 3, 4, 2) \\ (1, 4, 2, 3) \\ (1, 4, 3, 2) \\ (2, 1, 3, 4) \\ \vdots } Let us call a permutation P unpredictable if there is ...
25,729
Given is the function f(a,n)=\lfloor (\lceil \sqrt a \rceil + \sqrt a)^n \rfloor. \lfloor \cdot \rfloor denotes the floor function and \lceil \cdot \rceil denotes the ceiling function. f(5,2)=27 and f(5,5)=3935. G(n) = \displaystyle \sum_{a=1}^n f(a, a^2). G(1000) \bmod 999\,999\,937=163861845. Find G(5\,000\,000). Gi...
25,730
For a non-negative integer k, define \[ E_k(q) = \sum\limits_{n = 1}^\infty \sigma_k(n)q^n \] where \sigma_k(n) = \sum_{d \mid n} d^k is the sum of the k-th powers of the positive divisors of n. It can be shown that, for every k, the series E_k(q) converges for any 0 < q < 1. For example, E_1(1 - \frac{1}{2^4}) = 3.872...
25,731
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 ...
25,732
A depot uses n drones to disperse packages containing essential supplies along a long straight road. Initially all drones are stationary, loaded with a supply package. Every second, the depot selects a drone at random and sends it this instruction: If you are stationary, start moving at one centimetre per second along ...
25,733
A number where one digit is the sum of the other digits is called a digit sum number or DS-number for short. For example, 352, 3003 and 32812 are DS-numbers. We define S(n) to be the sum of all DS-numbers of n digits or less. You are given S(3) = 63270 and S(7) = 85499991450. Find S(2020). Give your answer modulo 10^{1...
25,734
Consider a stack of bottles of wine. There are n layers in the stack with the top layer containing only one bottle and the bottom layer containing n bottles. For n=4 the stack looks like the picture below. The collapsing process happens every time a bottle is taken. A space is created in the stack and that space is fil...
25,735
Let r_a, r_b and r_c be the radii of three circles that are mutually and externally tangent to each other. The three circles then form a triangle of circular arcs between their tangency points as shown for the three blue circles in the picture below. Define the circumcircle of this triangle to be the red circle, with c...
25,736
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 ...
25,737
Consider the sequence of real numbers a_n defined by the starting value a_0 and the recurrence \displaystyle a_{n+1}=a_n-\frac 1 {a_n} for any n \ge 0. For some starting values a_0 the sequence will be periodic. For example, a_0=\sqrt{\frac 1 2} yields the sequence: \sqrt{\frac 1 2},-\sqrt{\frac 1 2},\sqrt{\frac 1 2},...
25,738
For a non-negative integer k, the triple (p,q,r) of positive integers is called a k-shifted Pythagorean triple if p^2 + q^2 + k = r^2 (p, q, r) is said to be primitive if \gcd(p, q, r)=1. Let P_k(n) be the number of primitive k-shifted Pythagorean triples such that 1 \le p \le q \le r and p + q + r \le n. For example, ...
25,739
A=\sum_{i=1}^{\infty} \frac{1}{3^i 10^{3^i}} Define A(n) to be the 10 decimal digits from the nth digit onward. For example, A(100) = 4938271604 and A(10^8)=2584642393. Find A(10^{16}).
25,740
N trolls are in a hole that is D_N cm deep. The n-th troll is characterized by: the distance from his feet to his shoulders in cm, h_n the length of his arms in cm, l_n his IQ (Irascibility Quotient), q_n. Trolls can pile up on top of each other, with each troll standing on the shoulders of the one below him. A troll c...
25,741
Let a_i be the sequence defined by a_i=153^i \bmod 10\,000\,019 for i \ge 1. The first terms of a_i are: 153, 23409, 3581577, 7980255, 976697, 9434375, \dots Consider the subsequences consisting of 4 terms in ascending order. For the part of the sequence shown above, these are: 153, 23409, 3581577, 7980255 153, 23409, ...
25,742
The logical-OR of two bits is 0 if both bits are 0, otherwise it is 1. The bitwise-OR of two positive integers performs a logical-OR operation on each pair of corresponding bits in the binary expansion of its inputs. For example, the bitwise-OR of 10 and 6 is 14 because 10 = 1010_2, 6 = 0110_2 and 14 = 1110_2. Let T(n,...
25,743
Let f(n) be the number of divisors of 2n^2 that are no greater than n. For example, f(15)=8 because there are 8 such divisors: 1,2,3,5,6,9,10,15. Note that 18 is also a divisor of 2\times 15^2 but it is not counted because it is greater than 15. Let \displaystyle F(N) = \sum_{n=1}^N f(n). You are given F(15)=63, and F(...
25,744
Define two functions on lattice points: r(x,y) = (x+1,2y) s(x,y) = (2x,y+1) A path to equality of length n for a pair (a,b) is a sequence \Big((a_1,b_1),(a_2,b_2),\ldots,(a_n,b_n)\Big), where: (a_1,b_1) = (a,b) (a_k,b_k) = r(a_{k-1},b_{k-1}) or (a_k,b_k) = s(a_{k-1},b_{k-1}) for k > 1 a_k \ne b_k for k < n a_n = b_n a_...
25,745
A game is played with many identical, round coins on a flat table. Consider a line perpendicular to the table. The first coin is placed on the table touching the line. Then, one by one, the coins are placed horizontally on top of the previous coin and touching the line. The complete stack of coins must be balanced afte...
25,746
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. F...
25,747
Take a sequence of length n. Discard the first term then make a sequence of the partial summations. Continue to do this over and over until we are left with a single term. We define this to be f(n). Consider the example where we start with a sequence of length 8: \begin{array}{rrrrrrrr} 1&1&1&1&1&1&1&1\\ &1&2&3&4&5& ...
25,748
Secret Santa is a process that allows n people to give each other presents, so that each person gives a single present and receives a single present. At the beginning each of the n people write their name on a slip of paper and put the slip into a hat. Each person takes a random slip from the hat. If the slip has their...
25,749
Let f(n) be the number of ways an n\times n square grid can be coloured, each cell either black or white, such that each row and each column contains exactly two black cells. For example, f(4)=90, f(7) = 3110940 and f(8) = 187530840. Let g(n) be the number of colourings in f(n) that are unique up to rotations and refle...
25,750
A symmetrical convex grid polygon is a polygon such that: All its vertices have integer coordinates. All its internal angles are strictly smaller than 180^\circ. It has both horizontal and vertical symmetry. For example, the left polygon is a convex grid polygon which has neither horizontal nor vertical symmetry, while...
25,751
A window into a matrix is a contiguous sub matrix. Consider a 2\times n matrix where every entry is either 0 or 1. Let A(k,n) be the total number of these matrices such that the sum of the entries in every 2\times k window is k. You are given that A(3,9) = 560 and A(4,20) = 1060870. Find A(10^8,10^{16}). Give your answ...
25,752
"What? Where? When?" is a TV game show in which a team of experts attempt to answer questions. The following is a simplified version of the game. It begins with 2n+1 envelopes. 2n of them contain a question and one contains a RED card. In each round one of the remaining envelopes is randomly chosen. If the envelope con...
25,753
For a positive integer, n, define g(n) to be the maximum perfect square that divides n. For example, g(18) = 9, g(19) = 1. Also define \displaystyle S(N) = \sum_{n=1}^N g(n) For example, S(10) = 24 and S(100) = 767. Find S(10^{14}). Give your answer modulo 1\,000\,000\,007.
25,754
n families, each with four members, a father, a mother, a son and a daughter, were invited to a restaurant. They were all seated at a large circular table with 4n seats such that men and women alternate. Let M(n) be the number of ways the families can be seated such that none of the families were seated together. A fam...
25,755
Mamma Triangolo baked a triangular pizza. She wants to cut the pizza into n pieces. She first chooses a point P in the interior (not boundary) of the triangle pizza, and then performs n cuts, which all start from P and extend straight to the boundary of the pizza so that the n pieces are all triangles and all have the ...
25,756
Upside Down is a modification of the famous Pythagorean equation: \begin{align} \frac{1}{x^2}+\frac{1}{y^2}=\frac{13}{z^2}. \end{align} A solution (x,y,z) to this equation with x,y and z positive integers is a primitive solution if \gcd(x,y,z)=1. Let S(N) be the sum of x+y+z over primitive Upside Down solutions such t...
25,757
A positive integer, n, is a near power sum if there exists a positive integer, k, such that the sum of the kth powers of the digits in its decimal representation is equal to either n+1 or n-1. For example 35 is a near power sum number because 3^2+5^2 = 34. Define S(d) to be the sum of all near power sum numbers of d di...
25,758
Card Stacking is a game on a computer starting with an array of N cards labelled 1,2,\ldots,N. A stack of cards can be moved by dragging horizontally with the mouse to another stack but only when the resulting stack is in sequence. The goal of the game is to combine the cards into a single stack using minimal total dra...
25,759
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...
25,760
When (1+\sqrt 7) is raised to an integral power, n, we always get a number of the form (a+b\sqrt 7). We write (1+\sqrt 7)^n = \alpha(n) + \beta(n)\sqrt 7. For a given number x we define g(x) to be the smallest positive integer n such that: \begin{align} \alpha(n) &\equiv 1 \pmod x\qquad \text{and }\\ \beta(n) &\equiv ...
25,761
Fermat's Last Theorem states that no three positive integers a, b, c satisfy the equation a^n+b^n=c^n for any integer value of n greater than 2. For this problem we are only considering the case n=3. For certain values of p, it is possible to solve the congruence equation: a^3+b^3 \equiv c^3 \pmod{p} For a prime p, we...
25,762
The Gauss Factorial of a number n is defined as the product of all positive numbers \leq n that are relatively prime to n. For example g(10)=1\times 3\times 7\times 9 = 189. Also we define \displaystyle G(n) = \prod_{i=1}^{n}g(i) You are given G(10) = 23044331520000. Find G(10^8). Give your answer modulo 1\,000\,000\,0...
25,763
Consider the Fibonacci sequence \{1,2,3,5,8,13,21,\ldots\}. We let f(n) be the number of ways of representing an integer n\ge 0 as the sum of different Fibonacci numbers. For example, 16 = 3+13 = 1+2+13 = 3+5+8 = 1+2+5+8 and hence f(16) = 4. By convention f(0) = 1. Further we define S(n) = \sum_{k=0}^n f(k). You are g...
25,764
Consider a function f(k) defined for all positive integers k>0. Let S be the sum of the first n values of f. That is, S=f(1)+f(2)+f(3)+\cdots+f(n)=\sum_{k=1}^n f(k). In this problem, we employ randomness to approximate this sum. That is, we choose a random, uniformly distributed, m-tuple of positive integers (X_1,X_2,X...
25,765
A positive integer N is stealthy , if there exist positive integers a, b, c, d such that ab = cd = N and a+b = c+d+1. For example, 36 = 4\times 9 = 6\times 6 is stealthy. You are also given that there are 2851 stealthy numbers not exceeding 10^6. How many stealthy numbers are there that don't exceed 10^{14}?
25,766
There are 3 buckets labelled S (small) of 3 litres, M (medium) of 5 litres and L (large) of 8 litres. Initially S and M are full of water and L is empty. By pouring water between the buckets exactly one litre of water can be measured. Since there is no other way to measure, once a pouring starts it cannot stop until ei...
25,767
The function f is defined for all positive integers as follows: \begin{align*} f(1) &= 1\\ f(2n) &= 2f(n)\\ f(2n+1) &= 2n+1 + 2f(n)+\tfrac 1n f(n) \end{align*} It can be proven that f(n) is integer for all values of n. The function S(n) is defined as S(n) = \displaystyle \sum_{i=1}^n f(i) ^2. For example, S(10)=1530 a...
25,768
Define \displaystyle g(m,n) = (m\oplus n)+(m\vee n)+(m\wedge n) where \oplus, \vee, \wedge are the bitwise XOR, OR and AND operator respectively. Also set \displaystyle G(N) = \sum_{n=0}^N\sum_{k=0}^n g(k,n-k) For example, G(10) = 754 and G(10^2) = 583766. Find G(10^{18}). Give your answer modulo 1\,000\,000\,007.
25,769
Two friends, a runner and a swimmer, are playing a sporting game: The swimmer is swimming within a circular pool while the runner moves along the pool edge. While the runner tries to catch the swimmer at the very moment that the swimmer leaves the pool, the swimmer tries to reach the edge before the runner arrives ther...
25,770
Consider a two dimensional grid of squares. The grid has 4 rows but infinitely many columns. An amoeba in square (x, y) can divide itself into two amoebas to occupy the squares (x+1,y) and (x+1,(y+1) \bmod 4), provided these squares are empty. The following diagrams show two cases of an amoeba placed in square A of eac...
25,771
Consider a three dimensional grid of cubes. An amoeba in cube (x, y, z) can divide itself into three amoebas to occupy the cubes (x + 1, y, z), (x, y + 1, z) and (x, y, z + 1), provided these cubes are empty. Originally there is only one amoeba in the cube (0, 0, 0). After N divisions there will be 2N+1 amoebas arrange...
25,772
Consider the following Diophantine equation: 16x^2+y^4=z^2 where x, y and z are positive integers. Let S(N) = \displaystyle{\sum(x+y+z)} where the sum is over all solutions (x,y,z) such that 1 \leq x,y,z \leq N and \gcd(x,y,z)=1. For N=100, there are only two such solutions: (3,4,20) and (10,3,41). So S(10^2)=81. You a...
25,773
Starting with 1 gram of gold you play a game. Each round you bet a certain amount of your gold: if you have x grams you can bet b grams for any 0 \le b \le x. You then toss an unfair coin: with a probability of 0.6 you double your bet (so you now have x+b), otherwise you lose your bet (so you now have x-b). Choosing yo...
25,774
A sliding block puzzle is a puzzle where pieces are confined to a grid and by sliding the pieces a final configuration is reached. In this problem the pieces can only be slid in multiples of one unit in the directions up, down, left, right. A reachable configuration is any arrangement of the pieces that can be achieved...
25,775
A window into a matrix is a contiguous sub matrix. Consider a 16\times n matrix where every entry is either 0 or 1. Let B(k,n) be the total number of these matrices such that the sum of the entries in every 2\times k window is k. You are given that B(2,4) = 65550 and B(3,9) \equiv 87273560 \pmod{1\,000\,000\,007}. Find...
25,776
A certain type of chandelier contains a circular ring of n evenly spaced candleholders. If only one candle is fitted, then the chandelier will be imbalanced. However, if a second identical candle is placed in the opposite candleholder (assuming n is even) then perfect balance will be achieved and the chandelier will ha...
25,777
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^...
25,778
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 gol...
25,779
We define a pseudo-geometric sequence to be a finite sequence a_0, a_1, \dotsc, a_n of positive integers, satisfying the following conditions: n \geq 4, i.e. the sequence has at least 5 terms. 0 \lt a_0 \lt a_1 \lt \cdots \lt a_n, i.e. the sequence is strictly increasing. | a_i^2 - a_{i - 1}a_{i + 1} | \le 2 for 1 \le ...
25,780
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. C...
25,781
Let S_k be the set containing 2 and 5 and the first k primes that end in 7. For example, S_3 = \{2,5,7,17,37\}. Define a k-Ruff number to be one that is not divisible by any element in S_k. If N_k is the product of the numbers in S_k then define F(k) to be the sum of all k-Ruff numbers less than N_k that have last digi...
25,782
Let '\&' denote the bitwise AND operation. For example, 10\,\&\, 12 = 1010_2\,\&\, 1100_2 = 1000_2 = 8. We shall call a finite sequence of non-negative integers (a_1, a_2, \ldots, a_n) conjunctive if a_i\,\&\, a_{i+1} \neq 0 for all i=1\ldots n-1. Define c(n,b) to be the number of conjunctive sequences of length n in w...
25,783
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...
25,784
For a positive integer n, d(n) is defined to be the sum of the digits of n. For example, d(12345)=15. Let \displaystyle F(N)=\sum_{n=1}^N \frac n{d(n)}. You are given F(10)=19, F(123)\approx 1.187764610390e3 and F(12345)\approx 4.855801996238e6. Find F(1234567890123456789). Write your answer in scientific notation roun...
25,785
For coprime positive integers a and b, let C_{a,b} be the curve defined by: \[ \begin{align} x &= \cos \left(at\right) \\ y &= \cos \left(b\left(t-\frac{\pi}{10}\right)\right) \end{align} \] where t varies between 0 and 2\pi. For example, the images below show C_{2,5} (left) and C_{7,4} (right): Define d(a,b) = \sum (x...
25,786
If a,b are two nonnegative integers with decimal representations a=(\dots a_2a_1a_0) and b=(\dots b_2b_1b_0) respectively, then the freshman's product of a and b, denoted a\boxtimes b, is the integer c with decimal representation c=(\dots c_2c_1c_0) such that c_i is the last digit of a_i\cdot b_i. For example, 234 \box...
25,787
For a positive integer n \gt 1, let p(n) be the smallest prime dividing n, and let \alpha(n) be its p-adic order , i.e. the largest integer such that p(n)^{\alpha(n)} divides n. For a positive integer K, define the function f_K(n) by: f_K(n)=\frac{\alpha(n)-1}{(p(n))^K}. Also define \overline{f_K} by: \overline{f_K}=\l...
25,788
For positive real numbers a,b, an a\times b torus is a rectangle of width a and height b, with left and right sides identified, as well as top and bottom sides identified. In other words, when tracing a path on the rectangle, reaching an edge results in "wrapping round" to the corresponding point on the opposite edge. ...
25,789
Let F(n) be the number of connected graphs with blue edges (directed) and red edges (undirected) containing: two vertices of degree 1, one with a single outgoing blue edge and the other with a single incoming blue edge. n vertices of degree 3, each of which has an incoming blue edge, a different outgoing blue edge and ...
25,790
The complexity of an n\times n binary matrix is the number of distinct rows and columns. For example, consider the 3\times 3 matrices \mathbf{A} = \begin{pmatrix} 1&0&1\\0&0&0\\1&0&1\end{pmatrix} \quad \mathbf{B} = \begin{pmatrix} 0&0&0\\0&0&0\\1&1&1\end{pmatrix} \mathbf{A} has complexity 2 because the set of rows...
25,791
Given n and k two positive integers we begin with an urn that contains kn white balls. We then proceed through n turns where on each turn k black balls are added to the urn and then 2k random balls are removed from the urn. We let B_t(n,k) be the number of black balls that are removed on turn t. Further define E(n,k) a...
25,792
Let's call a pair of positive integers p, q (p \lt q) reciprocal , if there is a positive integer r\lt p such that r equals both the inverse of p modulo q and the inverse of q modulo p. For example, (3,5) is one reciprocal pair for r=2. Let F(N) be the total sum of p+q for all reciprocal pairs (p,q) where p \le N. F(5)...
25,793
Consider the following Diophantine equation: 15 (x^2 + y^2 + z^2) = 34 (xy + yz + zx) where x, y and z are positive integers. Let S(N) be the sum of all solutions, (x,y,z), of this equation such that, 1 \le x \le y \le z \le N and \gcd(x, y, z) = 1. For N = 10^2, there are three such solutions - (1, 7, 16), (8, 9, 39...
25,794
The following diagram shows a billiard table of a special quadrilateral shape. The four angles A, B, C, D are 120^\circ, 90^\circ, 60^\circ, 90^\circ respectively, and the lengths AB and AD are equal. The diagram on the left shows the trace of an infinitesimally small billiard ball, departing from point A, bouncing twi...
25,795
Two players play a game with two piles of stones. They take alternating turns. If there are currently a stones in the first pile and b stones in the second, a turn consists of removing c\geq 0 stones from the first pile and d\geq 0 from the second in such a way that ad-bc=\pm1. The winner is the player who first emptie...
25,796
A dominating number is a positive integer that has more than half of its digits equal. For example, 2022 is a dominating number because three of its four digits are equal to 2. But 2021 is not a dominating number. Let D(N) be how many dominating numbers are less than 10^N. For example, D(4) = 603 and D(10) = 21893256. ...
25,797
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 op...
25,798
There is a grid of length and width 50515093 points. A clock is placed on each grid point. The clocks are all analogue showing a single hour hand initially pointing at 12. A sequence S_t is created where: \begin{align} S_0 &= 290797\\ S_t &= S_{t-1}^2 \bmod 50515093 &t>0 \end{align} The four numbers N_t = (S_{4t-4}, ...
25,799