freeCodeCamp/curriculum/requiresTests/project-euler-problems.json

4033 lines
169 KiB
JSON
Raw Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

[
{
"id": "5900f54d1000cf542c510060",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 481: Chef Showdown",
"tests": [
"assert.strictEqual(euler481(), TODO: MISSING ANSWER, 'message: <code>euler481()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler481() {",
" // Good luck!",
" return true;",
"}",
"",
"euler481();"
],
"description": [
"A group of chefs (numbered #1, #2, etc) participate in a turn-based strategic cooking competition. On each chef's turn, he/she cooks up a dish to the best of his/her ability and gives it to a separate panel of judges for taste-testing. Let S(k) represent chef #k's skill level (which is publicly known). More specifically, S(k) is the probability that chef #k's dish will be assessed favorably by the judges (on any/all turns). If the dish receives a favorable rating, then the chef must choose one other chef to be eliminated from the competition. The last chef remaining in the competition is the winner.",
"",
"The game always begins with chef #1, with the turn order iterating sequentially over the rest of the chefs still in play. Then the cycle repeats from the lowest-numbered chef. All chefs aim to optimize their chances of winning within the rules as stated, assuming that the other chefs behave in the same manner. In the event that a chef has more than one equally-optimal elimination choice, assume that the chosen chef is always the one with the next-closest turn.",
"",
"Define Wn(k) as the probability that chef #k wins in a competition with n chefs. If we have S(1) = 0.25, S(2) = 0.5, and S(3) = 1, then W3(1) = 0.29375.",
"",
"Going forward, we assign S(k) = Fk/Fn+1 over all 1 ≤ k ≤ n, where Fk is a Fibonacci number: Fk = Fk-1 + Fk-2 with base cases F1 = F2 = 1. Then, for example, when considering a competition with n = 7 chefs, we have W7(1) = 0.08965042, W7(2) = 0.20775702, W7(3) = 0.15291406, W7(4) = 0.14554098, W7(5) = 0.15905291, W7(6) = 0.10261412, and W7(7) = 0.14247050, rounded to 8 decimal places each.",
"",
"Let E(n) represent the expected number of dishes cooked in a competition with n chefs. For instance, E(7) = 42.28176050.",
"",
"Find E(14) rounded to 8 decimal places."
]
},
{
"id": "5900f54f1000cf542c510061",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 482: The incenter of a triangle",
"tests": [
"assert.strictEqual(euler482(), TODO: MISSING ANSWER, 'message: <code>euler482()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler482() {",
" // Good luck!",
" return true;",
"}",
"",
"euler482();"
],
"description": [
"ABC is an integer sided triangle with incenter I and perimeter p.",
"The segments IA, IB and IC have integral length as well. ",
"",
"",
"Let L = p + |IA| + |IB| + |IC|. ",
"",
"",
"Let S(P) = ∑L for all such triangles where p ≤ P. For example, S(103) = 3619.",
"",
"",
"Find S(107)."
]
},
{
"id": "5900f54f1000cf542c510062",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 483: Repeated permutation",
"tests": [
"assert.strictEqual(euler483(), TODO: MISSING ANSWER, 'message: <code>euler483()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler483() {",
" // Good luck!",
" return true;",
"}",
"",
"euler483();"
],
"description": [
"We define a permutation as an operation that rearranges the order of the elements {1, 2, 3, ..., n}.",
"There are n! such permutations, one of which leaves the elements in their initial order.",
"For n = 3 we have 3! = 6 permutations:",
"- P1 = keep the initial order",
"- P2 = exchange the 1st and 2nd elements",
"- P3 = exchange the 1st and 3rd elements",
"- P4 = exchange the 2nd and 3rd elements",
"- P5 = rotate the elements to the right",
"- P6 = rotate the elements to the left",
"",
"",
"If we select one of these permutations, and we re-apply the same permutation repeatedly, we eventually restore the initial order.For a permutation Pi, let f(Pi) be the number of steps required to restore the initial order by applying the permutation Pi repeatedly.For n = 3, we obtain:- f(P1) = 1 : (1,2,3) → (1,2,3)- f(P2) = 2 : (1,2,3) → (2,1,3) → (1,2,3)- f(P3) = 2 : (1,2,3) → (3,2,1) → (1,2,3)- f(P4) = 2 : (1,2,3) → (1,3,2) → (1,2,3)- f(P5) = 3 : (1,2,3) → (3,1,2) → (2,3,1) → (1,2,3)- f(P6) = 3 : (1,2,3) → (2,3,1) → (3,1,2) → (1,2,3)",
"",
"",
"Let g(n) be the average value of f2(Pi) over all permutations Pi of length n.g(3) = (12 + 22 + 22 + 22 + 32 + 32)/3! = 31/6 ≈ 5.166666667e0g(5) = 2081/120 ≈ 1.734166667e1g(20) = 12422728886023769167301/2432902008176640000 ≈ 5.106136147e3",
"",
"",
"Find g(350) and write the answer in scientific notation rounded to 10 significant digits, using a lowercase e to separate mantissa and exponent, as in the examples above."
]
},
{
"id": "5900f5501000cf542c510063",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 484: Arithmetic Derivative",
"tests": [
"assert.strictEqual(euler484(), TODO: MISSING ANSWER, 'message: <code>euler484()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler484() {",
" // Good luck!",
" return true;",
"}",
"",
"euler484();"
],
"description": [
"The arithmetic derivative is defined by",
"p' = 1 for any prime p",
"(ab)' = a'b + ab' for all integers a, b (Leibniz rule)",
"For example, 20' = 24",
"",
"Find ∑ gcd(k,k') for 1 < k ≤ 5·1015",
"",
"Note: gcd(x,y) denotes the greatest common divisor of x and y."
]
},
{
"id": "5900f5511000cf542c510064",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 485: Maximum number of divisors",
"tests": [
"assert.strictEqual(euler485(), 51281274340, 'message: <code>euler485()</code> should return 51281274340.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler485() {",
" // Good luck!",
" return true;",
"}",
"",
"euler485();"
],
"description": [
"Let d(n) be the number of divisors of n.",
"Let M(n,k) be the maximum value of d(j) for n ≤ j ≤ n+k-1.",
"Let S(u,k) be the sum of M(n,k) for 1 ≤ n ≤ u-k+1.",
"",
"",
"You are given that S(1000,10)=17176.",
"",
"",
"Find S(100 000 000,100 000)."
]
},
{
"id": "5900f5531000cf542c510065",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 486: Palindrome-containing strings",
"tests": [
"assert.strictEqual(euler486(), 11408450515, 'message: <code>euler486()</code> should return 11408450515.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler486() {",
" // Good luck!",
" return true;",
"}",
"",
"euler486();"
],
"description": [
"Let F5(n) be the number of strings s such that:",
"s consists only of '0's and '1's,",
"s has length at most n, and",
"s contains a palindromic substring of length at least 5.",
"For example, F5(4) = 0, F5(5) = 8, ",
"F5(6) = 42 and F5(11) = 3844.",
"",
"Let D(L) be the number of integers n such that ",
"5  n  L and F5(n) is divisible by 87654321.",
"",
"For example, D(107) = 0 and D(5·109) = 51.",
"",
"Find D(1018)."
]
},
{
"id": "5900f5531000cf542c510066",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 487: Sums of power sums",
"tests": [
"assert.strictEqual(euler487(), 106650212746, 'message: <code>euler487()</code> should return 106650212746.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler487() {",
" // Good luck!",
" return true;",
"}",
"",
"euler487();"
],
"description": [
"Let fk(n) be the sum of the kth powers of the first n positive integers.",
"",
"For example, f2(10) = 12 + 22 + 32 + 42 + 52 + 62 + 72 + 82 + 92 + 102 = 385.",
"",
"Let Sk(n) be the sum of fk(i) for 1 ≤ i ≤ n. For example, S4(100) = 35375333830.",
"",
"What is ∑ (S10000(1012) mod p) over all primes p between 2 ⋅ 109 and 2 ⋅ 109 + 2000?"
]
},
{
"id": "5900f5541000cf542c510067",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 488: Unbalanced Nim",
"tests": [
"assert.strictEqual(euler488(), TODO: MISSING ANSWER, 'message: <code>euler488()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler488() {",
" // Good luck!",
" return true;",
"}",
"",
"euler488();"
],
"description": [
"Alice and Bob have enjoyed playing Nim every day. However, they finally got bored of playing ordinary three-heap Nim.",
"So, they added an extra rule:",
"",
"- Must not make two heaps of the same size.",
"",
"The triple (a,b,c) indicates the size of three heaps.",
"Under this extra rule, (2,4,5) is one of the losing positions for the next player.",
"",
"To illustrate:",
"- Alice moves to (2,4,3)",
"- Bob moves to (0,4,3)",
"- Alice moves to (0,2,3)",
"- Bob moves to (0,2,1)",
"",
"Unlike ordinary three-heap Nim, (0,1,2) and its permutations are the end states of this game.",
"",
"For an integer N, we define F(N) as the sum of a+b+c for all the losing positions for the next player, with 0 < a < b < c < N.",
"",
"For example, F(8) = 42, because there are 4 losing positions for the next player, (1,3,5), (1,4,6), (2,3,6) and (2,4,5).",
"We can also verify that F(128) = 496062.",
"",
"Find the last 9 digits of F(1018)."
]
},
{
"id": "5900f5561000cf542c510068",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 489: Common factors between two sequences",
"tests": [
"assert.strictEqual(euler489(), TODO: MISSING ANSWER, 'message: <code>euler489()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler489() {",
" // Good luck!",
" return true;",
"}",
"",
"euler489();"
],
"description": [
"Let G(a, b) be the smallest non-negative integer n for which gcd(n3 + b, (n + a)3 + b) is maximized.",
"For example, G(1, 1) = 5 because gcd(n3 + 1, (n + 1)3 + 1) reaches its maximum value of 7 for n = 5, and is smaller for 0 ≤ n < 5.",
"Let H(m, n) = Σ G(a, b) for 1 ≤ a ≤ m, 1 ≤ b ≤ n.",
"You are given H(5, 5) = 128878 and H(10, 10) = 32936544.",
"Find H(18, 1900)."
]
},
{
"id": "5900f5561000cf542c510069",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 490: Jumping frog",
"tests": [
"assert.strictEqual(euler490(), TODO: MISSING ANSWER, 'message: <code>euler490()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler490() {",
" // Good luck!",
" return true;",
"}",
"",
"euler490();"
],
"description": [
"There are n stones in a pond, numbered 1 to n. Consecutive stones are spaced one unit apart.",
"",
"A frog sits on stone 1. He wishes to visit each stone exactly once, stopping on stone n. However, he can only jump from one stone to another if they are at most 3 units apart. In other words, from stone i, he can reach a stone j if 1 ≤ j ≤ n and j is in the set {i-3, i-2, i-1, i+1, i+2, i+3}.",
"",
"Let f(n) be the number of ways he can do this. For example, f(6) = 14, as shown below:",
"1 → 2 → 3 → 4 → 5 → 6 ",
"1 → 2 → 3 → 5 → 4 → 6 ",
"1 → 2 → 4 → 3 → 5 → 6 ",
"1 → 2 → 4 → 5 → 3 → 6 ",
"1 → 2 → 5 → 3 → 4 → 6 ",
"1 → 2 → 5 → 4 → 3 → 6 ",
"1 → 3 → 2 → 4 → 5 → 6 ",
"1 → 3 → 2 → 5 → 4 → 6 ",
"1 → 3 → 4 → 2 → 5 → 6 ",
"1 → 3 → 5 → 2 → 4 → 6 ",
"1 → 4 → 2 → 3 → 5 → 6 ",
"1 → 4 → 2 → 5 → 3 → 6 ",
"1 → 4 → 3 → 2 → 5 → 6 ",
"1 → 4 → 5 → 2 → 3 → 6",
"",
"Other examples are f(10) = 254 and f(40) = 1439682432976.",
"",
"Let S(L) = ∑ f(n)3 for 1 ≤ n ≤ L.",
"Examples:",
"S(10) = 18230635",
"S(20) = 104207881192114219",
"S(1 000) mod 109 = 225031475",
"S(1 000 000) mod 109 = 363486179",
"",
"Find S(1014) mod 109."
]
},
{
"id": "5900f5591000cf542c51006b",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 491: Double pandigital number divisible by 11",
"tests": [
"assert.strictEqual(euler491(), 194505988824000, 'message: <code>euler491()</code> should return 194505988824000.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler491() {",
" // Good luck!",
" return true;",
"}",
"",
"euler491();"
],
"description": [
"We call a positive integer double pandigital if it uses all the digits 0 to 9 exactly twice (with no leading zero). For example, 40561817703823564929 is one such number.",
"",
"How many double pandigital numbers are divisible by 11?"
]
},
{
"id": "5900f5581000cf542c51006a",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 492: Exploding sequence",
"tests": [
"assert.strictEqual(euler492(), TODO: MISSING ANSWER, 'message: <code>euler492()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler492() {",
" // Good luck!",
" return true;",
"}",
"",
"euler492();"
],
"description": [
"Define the sequence a1, a2, a3, ... as:",
"a1 = 1",
"an+1 = 6an2 + 10an + 3 for n ≥ 1.",
"",
"Examples:",
"a3 = 2359",
"a6 = 269221280981320216750489044576319",
"a6 mod 1 000 000 007 = 203064689",
"a100 mod 1 000 000 007 = 456482974",
"",
"",
"",
"Define B(x,y,n) as ∑ (an mod p) for every prime p such that x ≤ p ≤ x+y.",
"",
"",
"",
"Examples:",
"B(109, 103, 103) = 23674718882",
"B(109, 103, 1015) = 20731563854",
"",
"",
"Find B(109, 107, 1015)."
]
},
{
"id": "5900f55a1000cf542c51006c",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 493: Under The Rainbow",
"tests": [
"assert.strictEqual(euler493(), 6.818741802, 'message: <code>euler493()</code> should return 6.818741802.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler493() {",
" // Good luck!",
" return true;",
"}",
"",
"euler493();"
],
"description": [
"70 colored balls are placed in an urn, 10 for each of the seven rainbow colors.",
"What is the expected number of distinct colors in 20 randomly picked balls?",
"Give your answer with nine digits after the decimal point (a.bcdefghij)."
]
},
{
"id": "5900f55a1000cf542c51006d",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 494: Collatz prefix families",
"tests": [
"assert.strictEqual(euler494(), TODO: MISSING ANSWER, 'message: <code>euler494()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler494() {",
" // Good luck!",
" return true;",
"}",
"",
"euler494();"
],
"description": [
"The Collatz sequence is defined as:",
"$a_{i+1} = \\left\\{ \\large{\\frac {a_i} 2 \\atop 3 a_i+1} {\\text{if }a_i\\text{ is even} \\atop \\text{if }a_i\\text{ is odd}} \\right.$.",
"",
"",
"The Collatz conjecture states that starting from any positive integer, the sequence eventually reaches the cycle 1,4,2,1....",
"We shall define the sequence prefix p(n) for the Collatz sequence starting with a1 = n as the sub-sequence of all numbers not a power of 2 (20=1 is considered a power of 2 for this problem). For example:p(13) = {13, 40, 20, 10, 5} p(8) = {}",
"Any number invalidating the conjecture would have an infinite length sequence prefix.",
"",
"",
"Let Sm be the set of all sequence prefixes of length m. Two sequences {a1, a2, ..., am} and {b1, b2, ..., bm} in Sm are said to belong to the same prefix family if ai < aj if and only if bi < bj for all 1 ≤ i,j ≤ m.",
"",
"",
"For example, in S4, {6, 3, 10, 5} is in the same family as {454, 227, 682, 341}, but not {113, 340, 170, 85}.",
"Let f(m) be the number of distinct prefix families in Sm.",
"You are given f(5) = 5, f(10) = 55, f(20) = 6771.",
"",
"",
"Find f(90)."
]
},
{
"id": "5900f55b1000cf542c51006e",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 495: Writing n as the product of k distinct positive integers",
"tests": [
"assert.strictEqual(euler495(), TODO: MISSING ANSWER, 'message: <code>euler495()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler495() {",
" // Good luck!",
" return true;",
"}",
"",
"euler495();"
],
"description": [
"Let W(n,k) be the number of ways in which n can be written as the product of k distinct positive integers.",
"For example, W(144,4) = 7. There are 7 ways in which 144 can be written as a product of 4 distinct positive integers:",
"144 = 1×2×4×18",
"144 = 1×2×8×9",
"144 = 1×2×3×24",
"144 = 1×2×6×12",
"144 = 1×3×4×12",
"144 = 1×3×6×8",
"144 = 2×3×4×6",
"Note that permutations of the integers themselves are not considered distinct.",
"Furthermore, W(100!,10) modulo 1 000 000 007 = 287549200.",
"Find W(10000!,30) modulo 1 000 000 007."
]
},
{
"id": "5900f55d1000cf542c51006f",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 496: Incenter and circumcenter of triangle",
"tests": [
"assert.strictEqual(euler496(), 2042473533769142800, 'message: <code>euler496()</code> should return 2042473533769142800.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler496() {",
" // Good luck!",
" return true;",
"}",
"",
"euler496();"
],
"description": [
"Given an integer sided triangle ABC:",
"Let I be the incenter of ABC.",
"Let D be the intersection between the line AI and the circumcircle of ABC (A ≠ D).",
"",
"We define F(L) as the sum of BC for the triangles ABC that satisfy AC = DI and BC ≤ L.",
"",
"For example, F(15) = 45 because the triangles ABC with (BC,AC,AB) = (6,4,5), (12,8,10), (12,9,7), (15,9,16) satisfy the conditions.",
"",
"Find F(109)."
]
},
{
"id": "5900f55f1000cf542c510070",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 497: Drunken Tower of Hanoi",
"tests": [
"assert.strictEqual(euler497(), 684901360, 'message: <code>euler497()</code> should return 684901360.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler497() {",
" // Good luck!",
" return true;",
"}",
"",
"euler497();"
],
"description": [
"Bob is very familiar with the famous mathematical puzzle/game, \"Tower of Hanoi,\" which consists of three upright rods and disks of different sizes that can slide onto any of the rods. The game begins with a stack of n disks placed on the leftmost rod in descending order by size. The objective of the game is to move all of the disks from the leftmost rod to the rightmost rod, given the following restrictions:",
"",
"Only one disk can be moved at a time.",
"A valid move consists of taking the top disk from one stack and placing it onto another stack (or an empty rod).",
"No disk can be placed on top of a smaller disk.",
"Moving on to a variant of this game, consider a long room k units (square tiles) wide, labeled from 1 to k in ascending order. Three rods are placed at squares a, b, and c, and a stack of n disks is placed on the rod at square a.",
"",
"Bob begins the game standing at square b. His objective is to play the Tower of Hanoi game by moving all of the disks to the rod at square c. However, Bob can only pick up or set down a disk if he is on the same square as the rod / stack in question.",
"",
"Unfortunately, Bob is also drunk. On a given move, Bob will either stumble one square to the left or one square to the right with equal probability, unless Bob is at either end of the room, in which case he can only move in one direction. Despite Bob's inebriated state, he is still capable of following the rules of the game itself, as well as choosing when to pick up or put down a disk.",
"",
"The following animation depicts a side-view of a sample game for n = 3, k = 7, a = 2, b = 4, and c = 6:",
"",
"",
"",
"Let E(n,k,a,b,c) be the expected number of squares that Bob travels during a single optimally-played game. A game is played optimally if the number of disk-pickups is minimized.",
"",
"Interestingly enough, the result is always an integer. For example, E(2,5,1,3,5) = 60 and E(3,20,4,9,17) = 2358.",
"",
"Find the last nine digits of ∑1≤n≤10000 E(n,10n,3n,6n,9n)."
]
},
{
"id": "5900f55f1000cf542c510071",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 498: Remainder of polynomial division",
"tests": [
"assert.strictEqual(euler498(), 472294837, 'message: <code>euler498()</code> should return 472294837.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler498() {",
" // Good luck!",
" return true;",
"}",
"",
"euler498();"
],
"description": [
"For positive integers n and m, we define two polynomials Fn(x) = xn and Gm(x) = (x-1)m.",
"We also define a polynomial Rn,m(x) as the remainder of the division of Fn(x) by Gm(x).",
"For example, R6,3(x) = 15x2 - 24x + 10.",
"",
"Let C(n, m, d) be the absolute value of the coefficient of the d-th degree term of Rn,m(x).",
"We can verify that C(6, 3, 1) = 24 and C(100, 10, 4) = 227197811615775.",
"",
"Find C(1013, 1012, 104) mod 999999937."
]
},
{
"id": "5900f5611000cf542c510072",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 499: St. Petersburg Lottery",
"tests": [
"assert.strictEqual(euler499(), 0.8660312, 'message: <code>euler499()</code> should return 0.8660312.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler499() {",
" // Good luck!",
" return true;",
"}",
"",
"euler499();"
],
"description": [
"A gambler decides to participate in a special lottery. In this lottery the gambler plays a series of one or more games.",
"Each game costs m pounds to play and starts with an initial pot of 1 pound. The gambler flips an unbiased coin. Every time a head appears, the pot is doubled and the gambler continues. When a tail appears, the game ends and the gambler collects the current value of the pot. The gambler is certain to win at least 1 pound, the starting value of the pot, at the cost of m pounds, the initial fee.",
"",
"The gambler cannot continue to play if his fortune falls below m pounds.",
"Let pm(s) denote the probability that the gambler will never run out of money in this lottery given his initial fortune s and the cost per game m.",
"For example p2(2)  0.2522, p2(5)  0.6873 and p6(10 000)  0.9952 (note: pm(s) = 0 for s < m).",
"",
"Find p15(109) and give your answer rounded to 7 decimal places behind the decimal point in the form 0.abcdefg."
]
},
{
"id": "5900f5611000cf542c510073",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 500: Problem 500!!!",
"tests": [
"assert.strictEqual(euler500(), 35407281, 'message: <code>euler500()</code> should return 35407281.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler500() {",
" // Good luck!",
" return true;",
"}",
"",
"euler500();"
],
"description": [
"The number of divisors of 120 is 16.",
"In fact 120 is the smallest number having 16 divisors.",
"",
"",
"Find the smallest number with 2500500 divisors.",
"Give your answer modulo 500500507."
]
},
{
"id": "5900f5621000cf542c510074",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 501: Eight Divisors",
"tests": [
"assert.strictEqual(euler501(), 197912312715, 'message: <code>euler501()</code> should return 197912312715.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler501() {",
" // Good luck!",
" return true;",
"}",
"",
"euler501();"
],
"description": [
"The eight divisors of 24 are 1, 2, 3, 4, 6, 8, 12 and 24.",
"The ten numbers not exceeding 100 having exactly eight divisors are 24, 30, 40, 42, 54, 56, 66, 70, 78 and 88.",
"Let f(n) be the count of numbers not exceeding n with exactly eight divisors.",
"You are given f(100) = 10, f(1000) = 180 and f(106) = 224427.",
"Find f(1012)."
]
},
{
"id": "5900f5621000cf542c510075",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 502: Counting Castles",
"tests": [
"assert.strictEqual(euler502(), TODO: MISSING ANSWER, 'message: <code>euler502()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler502() {",
" // Good luck!",
" return true;",
"}",
"",
"euler502();"
],
"description": [
"We define a block to be a rectangle with a height of 1 and an integer-valued length. Let a castle be a configuration of stacked blocks.",
"",
"Given a game grid that is w units wide and h units tall, a castle is generated according to the following rules:",
"",
"",
"Blocks can be placed on top of other blocks as long as nothing sticks out past the edges or hangs out over open space.",
"All blocks are aligned/snapped to the grid.",
"Any two neighboring blocks on the same row have at least one unit of space between them.",
"The bottom row is occupied by a block of length w.",
"The maximum achieved height of the entire castle is exactly h.",
"The castle is made from an even number of blocks.",
"The following is a sample castle for w=8 and h=5:",
"",
"",
"",
"Let F(w,h) represent the number of valid castles, given grid parameters w and h.",
"",
"For example, F(4,2) = 10, F(13,10) = 3729050610636, F(10,13) = 37959702514, and F(100,100) mod 1 000 000 007 = 841913936.",
"",
"Find (F(1012,100) + F(10000,10000) + F(100,1012)) mod 1 000 000 007."
]
},
{
"id": "5900f5631000cf542c510076",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 503: Compromise or persist",
"tests": [
"assert.strictEqual(euler503(), 3.8694550145, 'message: <code>euler503()</code> should return 3.8694550145.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler503() {",
" // Good luck!",
" return true;",
"}",
"",
"euler503();"
],
"description": [
"Alice is playing a game with n cards numbered 1 to n.",
"",
"A game consists of iterations of the following steps.",
"(1) Alice picks one of the cards at random.",
"(2) Alice cannot see the number on it. Instead, Bob, one of her friends, sees the number and tells Alice how many previously-seen numbers are bigger than the number which he is seeing.",
"(3) Alice can end or continue the game. If she decides to end, the number becomes her score. If she decides to continue, the card is removed from the game and she returns to (1). If there is no card left, she is forced to end the game.",
"",
"Let F(n) be the Alice's expected score if she takes the optimized strategy to minimize her score.",
"",
"For example, F(3) = 5/3. At the first iteration, she should continue the game. At the second iteration, she should end the game if Bob says that one previously-seen number is bigger than the number which he is seeing, otherwise she should continue the game.",
"",
"We can also verify that F(4) = 15/8 and F(10) ≈ 2.5579365079.",
"",
"Find F(106). Give your answer rounded to 10 decimal places behind the decimal point."
]
},
{
"id": "5900f5641000cf542c510077",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 504: Square on the Inside",
"tests": [
"assert.strictEqual(euler504(), 694687, 'message: <code>euler504()</code> should return 694687.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler504() {",
" // Good luck!",
" return true;",
"}",
"",
"euler504();"
],
"description": [
"Let ABCD be a quadrilateral whose vertices are lattice points lying on the coordinate axes as follows:",
"",
"A(a, 0), B(0, b), C(c, 0), D(0, d), where 1 ≤ a, b, c, d ≤ m and a, b, c, d, m are integers.",
"",
"It can be shown that for m = 4 there are exactly 256 valid ways to construct ABCD. Of these 256 quadrilaterals, 42 of them strictly contain a square number of lattice points.",
"",
"How many quadrilaterals ABCD strictly contain a square number of lattice points for m = 100?"
]
},
{
"id": "5900f5661000cf542c510078",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 505: Bidirectional Recurrence",
"tests": [
"assert.strictEqual(euler505(), TODO: MISSING ANSWER, 'message: <code>euler505()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler505() {",
" // Good luck!",
" return true;",
"}",
"",
"euler505();"
],
"description": [
"Let:",
"$\\begin{array}{ll} x(0)&=0 \\\\ x(1)&=1 \\\\ x(2k)&=(3x(k)+2x(\\lfloor \\frac k 2 \\rfloor)) \\text{ mod } 2^{60} \\text{ for } k \\ge 1 \\text {, where } \\lfloor \\text { } \\rfloor \\text { is the floor function} \\\\ x(2k+1)&=(2x(k)+3x(\\lfloor \\frac k 2 \\rfloor)) \\text{ mod } 2^{60} \\text{ for } k \\ge 1 \\\\ y_n(k)&=\\left\\{{\\begin{array}{lc} x(k) && \\text{if } k \\ge n \\\\ 2^{60} - 1 - max(y_n(2k),y_n(2k+1)) && \\text{if } k < n \\end{array}} \\right. \\\\ A(n)&=y_n(1) \\end{array}$",
"You are given:",
"$\\begin{array}{ll} x(2)&=3 \\\\ x(3)&=2 \\\\ x(4)&=11 \\\\ y_4(4)&=11 \\\\ y_4(3)&=2^{60}-9\\\\ y_4(2)&=2^{60}-12 \\\\ y_4(1)&=A(4)=8 \\\\ A(10)&=2^{60}-34\\\\ A(10^3)&=101881 \\end{array}$",
"Find $A(10^{12})$."
]
},
{
"id": "5900f5671000cf542c510079",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 506: Clock sequence",
"tests": [
"assert.strictEqual(euler506(), 18934502, 'message: <code>euler506()</code> should return 18934502.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler506() {",
" // Good luck!",
" return true;",
"}",
"",
"euler506();"
],
"description": [
"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 vn be the n'th value in this sequence. For example, v2 = 2, v5 = 32 and v11 = 32123.",
"Let S(n) be v1 + v2 + ... + vn. For example, S(11) = 36120, and S(1000) mod 123454321 = 18232686.",
"Find S(1014) mod 123454321."
]
},
{
"id": "5900f5671000cf542c51007a",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 507: Shortest Lattice Vector",
"tests": [
"assert.strictEqual(euler507(), TODO: MISSING ANSWER, 'message: <code>euler507()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler507() {",
" // Good luck!",
" return true;",
"}",
"",
"euler507();"
],
"description": [
"Let $t_n$ be the tribonacci numbers defined as:",
"$t_0 = t_1 = 0$;",
"$t_2 = 1$;",
"$t_n = t_{n-1} + t_{n-2} + t_{n-3}$ for $n \\ge 3$",
"and let $r_n = t_n \\text{ mod } 10^7$.",
"",
"",
"For each pair of Vectors $V_n=(v_1,v_2,v_3)$ and $W_n=(w_1,w_2,w_3)$ with $v_1=r_{12n-11}-r_{12n-10}, v_2=r_{12n-9}+r_{12n-8}, v_3=r_{12n-7} \\cdot r_{12n-6}$ and $w_1=r_{12n-5}-r_{12n-4}, w_2=r_{12n-3}+r_{12n-2}, w_3=r_{12n-1} \\cdot r_{12n}$",
"",
"",
"we define $S(n)$ as the minimal value of the manhattan length of the vector $D=k \\cdot V_n+l \\cdot W_n$ measured as $|k \\cdot v_1+l \\cdot w_1|+|k \\cdot v_2+l \\cdot w_2|+|k \\cdot v_3+l \\cdot w_3|$",
" for any integers $k$ and $l$ with $(k,l)\\neq (0,0)$.",
"",
"The first vector pair is (-1, 3, 28), (-11, 125, 40826).",
"You are given that $S(1)=32$ and $\\sum_{n=1}^{10} S(n)=130762273722$.",
"",
"",
"Find $\\sum_{n=1}^{20000000} S(n)$."
]
},
{
"id": "5900f5691000cf542c51007c",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 508: Integers in base i-1",
"tests": [
"assert.strictEqual(euler508(), TODO: MISSING ANSWER, 'message: <code>euler508()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler508() {",
" // Good luck!",
" return true;",
"}",
"",
"euler508();"
],
"description": [
"Consider the Gaussian integer i-1. A base i-1 representation of a Gaussian integer a+bi is a finite sequence of digits dn-1dn-2...d1d0 such that:",
"",
"a+bi = dn-1(i-1)n-1 + dn-2(i-1)n-2 + ... + d1(i-1) + d0",
"Each dk is in {0,1}",
"There are no leading zeroes, i.e. dn-1 ≠ 0, unless a+bi is itself 0",
"Here are base i-1 representations of a few Gaussian integers:",
"11+24i → 111010110001101",
"24-11i → 110010110011",
"8+0i → 111000000",
"-5+0i → 11001101",
"0+0i → 0",
"",
"Remarkably, every Gaussian integer has a unique base i-1 representation!",
"",
"Define f(a+bi) as the number of 1s in the unique base i-1 representation of a+bi. For example, f(11+24i) = 9 and f(24-11i) = 7.",
"",
"Define B(L) as the sum of f(a+bi) for all integers a, b such that |a| ≤ L and |b| ≤ L. For example, B(500) = 10795060.",
"",
"Find B(1015) mod 1 000 000 007."
]
},
{
"id": "5900f5691000cf542c51007b",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 509: Divisor Nim",
"tests": [
"assert.strictEqual(euler509(), 151725678, 'message: <code>euler509()</code> should return 151725678.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler509() {",
" // Good luck!",
" return true;",
"}",
"",
"euler509();"
],
"description": [
"Anton and Bertrand love to play three pile Nim.",
"However, after a lot of games of Nim they got bored and changed the rules somewhat.",
"They may only take a number of stones from a pile that is a proper divisor of the number of stones present in the pile. E.g. if a pile at a certain moment contains 24 stones they may take only 1,2,3,4,6,8 or 12 stones from that pile.",
"So if a pile contains one stone they can't take the last stone from it as 1 isn't a proper divisor of 1.",
"The first player that can't make a valid move loses the game.",
"Of course both Anton and Bertrand play optimally.",
"",
"The triple (a,b,c) indicates the number of stones in the three piles.",
"Let S(n) be the number of winning positions for the next player for 1 ≤ a, b, c ≤ n.S(10) = 692 and S(100) = 735494.",
"",
"Find S(123456787654321) modulo 1234567890."
]
},
{
"id": "5900f56b1000cf542c51007d",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 510: Tangent Circles",
"tests": [
"assert.strictEqual(euler510(), 315306518862563700, 'message: <code>euler510()</code> should return 315306518862563700.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler510() {",
" // Good luck!",
" return true;",
"}",
"",
"euler510();"
],
"description": [
"Circles A and B are tangent to each other and to line L at three distinct points.",
"Circle C is inside the space between A, B and L, and tangent to all three.",
"Let rA, rB and rC be the radii of A, B and C respectively.",
"Let S(n) = Σ rA + rB + rC, for 0 < rA  rB  n where rA, rB and rC are integers.",
"The only solution for 0 < rA  rB  5 is rA = 4, rB = 4 and rC = 1, so S(5) = 4 + 4 + 1 = 9.",
"You are also given S(100) = 3072.",
"Find S(109)."
]
},
{
"id": "5900f56b1000cf542c51007e",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 511: Sequences with nice divisibility properties",
"tests": [
"assert.strictEqual(euler511(), 935247012, 'message: <code>euler511()</code> should return 935247012.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler511() {",
" // Good luck!",
" return true;",
"}",
"",
"euler511();"
],
"description": [
"Let Seq(n,k) be the number of positive-integer sequences {ai}1≤i≤n of length n such that:",
"n is divisible by ai for 1  i  n, and",
" n + a1 + a2 + ... + an is divisible by k.",
"Examples:",
"Seq(3,4) = 4, and the 4 sequences are:",
"{1, 1, 3}",
"{1, 3, 1}",
"{3, 1, 1}",
"{3, 3, 3}",
"Seq(4,11) = 8, and the 8 sequences are:",
"{1, 1, 1, 4}",
"{1, 1, 4, 1}",
"{1, 4, 1, 1}",
"{4, 1, 1, 1}",
"{2, 2, 2, 1}",
"{2, 2, 1, 2}",
"{2, 1, 2, 2}",
"{1, 2, 2, 2}",
"The last nine digits of Seq(1111,24) are 840643584.",
"Find the last nine digits of Seq(1234567898765,4321)."
]
},
{
"id": "5900f56d1000cf542c51007f",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 512: Sums of totients of powers",
"tests": [
"assert.strictEqual(euler512(), 50660591862310320, 'message: <code>euler512()</code> should return 50660591862310320.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler512() {",
" // Good luck!",
" return true;",
"}",
"",
"euler512();"
],
"description": [
"Let $\\varphi(n)$ be Euler's totient function.",
"Let $f(n)=(\\sum_{i=1}^{n}\\varphi(n^i)) \\text{ mod } (n+1)$.",
"Let $g(n)=\\sum_{i=1}^{n} f(i)$.",
"$g(100)=2007$.",
"",
"",
"Find $g(5 \\times 10^8)$."
]
},
{
"id": "5900f56e1000cf542c510080",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 513: Integral median",
"tests": [
"assert.strictEqual(euler513(), TODO: MISSING ANSWER, 'message: <code>euler513()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler513() {",
" // Good luck!",
" return true;",
"}",
"",
"euler513();"
],
"description": [
"ABC is an integral sided triangle with sides a≤b≤c.",
"mc is the median connecting C and the midpoint of AB. ",
"F(n) is the number of such triangles with c≤n for which mc has integral length as well.",
"F(10)=3 and F(50)=165.",
"",
"Find F(100000)."
]
},
{
"id": "5900f56f1000cf542c510081",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 514: Geoboard Shapes",
"tests": [
"assert.strictEqual(euler514(), TODO: MISSING ANSWER, 'message: <code>euler514()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler514() {",
" // Good luck!",
" return true;",
"}",
"",
"euler514();"
],
"description": [
"A geoboard (of order N) is a square board with equally-spaced pins protruding from the surface, representing an integer point lattice for coordinates 0 ≤ x,y ≤ N.",
"",
"John begins with a pinless geoboard. Each position on the board is a hole that can be filled with a pin. John decides to generate a random integer between 1 and N+1 (inclusive) for each hole in the geoboard. If the random integer is equal to 1 for a given hole, then a pin is placed in that hole.",
"",
"After John is finished generating numbers for all (N+1)2 holes and placing any/all corresponding pins, he wraps a tight rubberband around the entire group of pins protruding from the board. Let S represent the shape that is formed. S can also be defined as the smallest convex shape that contains all the pins.",
"",
"",
"",
"The above image depicts a sample layout for N = 4. The green markers indicate positions where pins have been placed, and the blue lines collectively represent the rubberband. For this particular arrangement, S has an area of 6. If there are fewer than three pins on the board (or if all pins are collinear), S can be assumed to have zero area.",
"",
"Let E(N) be the expected area of S given a geoboard of order N. For example, E(1) = 0.18750, E(2) = 0.94335, and E(10) = 55.03013 when rounded to five decimal places each.",
"",
"Calculate E(100) rounded to five decimal places."
]
},
{
"id": "5900f5711000cf542c510083",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 515: Dissonant Numbers",
"tests": [
"assert.strictEqual(euler515(), 2422639000800, 'message: <code>euler515()</code> should return 2422639000800.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler515() {",
" // Good luck!",
" return true;",
"}",
"",
"euler515();"
],
"description": [
"Let d(p,n,0) be the multiplicative inverse of n modulo prime p, defined as n × d(p,n,0) = 1 mod p.",
"Let d(p,n,k) = $\\sum_{i=1}^n$d(p,i,k1) for k  1.",
"Let D(a,b,k) = $\\sum$(d(p,p-1,k) mod p) for all primes a  p < a + b.",
"You are given:",
"D(101,1,10) = 45",
"D(103,102,102) = 8334",
"D(106,103,103) = 38162302Find D(109,105,105)."
]
},
{
"id": "5900f5701000cf542c510082",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 516: 5-smooth totients",
"tests": [
"assert.strictEqual(euler516(), 939087315, 'message: <code>euler516()</code> should return 939087315.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler516() {",
" // Good luck!",
" return true;",
"}",
"",
"euler516();"
],
"description": [
"5-smooth numbers are numbers whose largest prime factor doesn't exceed 5.",
"5-smooth numbers are also called Hamming numbers.",
"Let S(L) be the sum of the numbers n not exceeding L such that Euler's totient function φ(n) is a Hamming number.",
"S(100)=3728.",
"",
"",
"Find S(1012). Give your answer modulo 232."
]
},
{
"id": "5900f5721000cf542c510084",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 517: A real recursion",
"tests": [
"assert.strictEqual(euler517(), 581468882, 'message: <code>euler517()</code> should return 581468882.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler517() {",
" // Good luck!",
" return true;",
"}",
"",
"euler517();"
],
"description": [
"For every real number $a \\gt 1$ is given the sequence $g_a$ by:",
"$g_{a}(x)=1$ for $x \\lt a$",
"$g_{a}(x)=g_{a}(x-1)+g_a(x-a)$ for $x \\ge a$",
"",
"$G(n)=g_{\\sqrt {n}}(n)$",
"$G(90)=7564511$.",
"",
"Find $\\sum G(p)$ for $p$ prime and $10000000 \\lt p \\lt 10010000$",
"Give your answer modulo 1000000007."
]
},
{
"id": "5900f5721000cf542c510085",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 518: Prime triples and geometric sequences",
"tests": [
"assert.strictEqual(euler518(), 100315739184392, 'message: <code>euler518()</code> should return 100315739184392.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler518() {",
" // Good luck!",
" return true;",
"}",
"",
"euler518();"
],
"description": [
"Let S(n) = Σ a+b+c over all triples (a,b,c) such that:",
"",
"a, b, and c are prime numbers.",
"a < b < c < 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(108)."
]
},
{
"id": "5900f5741000cf542c510086",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 519: Tricolored Coin Fountains",
"tests": [
"assert.strictEqual(euler519(), 804739330, 'message: <code>euler519()</code> should return 804739330.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler519() {",
" // Good luck!",
" return true;",
"}",
"",
"euler519();"
],
"description": [
"An arrangement of coins in one or more rows with the bottom row being a block without gaps and every coin in a higher row touching exactly two coins in the row below is called a fountain of coins. Let f(n) be the number of possible fountains with n coins. For 4 coins there are three possible arrangements:",
"",
"Therefore f(4) = 3 while f(10) = 78.",
"Let T(n) be the number of all possible colorings with three colors for all f(n) different fountains with n coins, given the condition that no two touching coins have the same color. Below you see the possible colorings for one of the three valid fountains for 4 coins:",
"",
"You are given that T(4) = 48 and T(10) = 17760.",
"Find the last 9 digits of T(20000)."
]
},
{
"id": "5900f5751000cf542c510087",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 520: Simbers",
"tests": [
"assert.strictEqual(euler520(), 238413705, 'message: <code>euler520()</code> should return 238413705.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler520() {",
" // Good luck!",
" return true;",
"}",
"",
"euler520();"
],
"description": [
"We define a simber to be a positive integer in which any odd digit, if present, occurs an odd number of times, and any even digit, if present, occurs an even number of times.",
"",
"For example, 141221242 is a 9-digit simber because it has three 1's, four 2's and two 4's. ",
"",
"Let Q(n) be the count of all simbers with at most n digits. ",
"",
"You are given Q(7) = 287975 and Q(100) mod 1 000 000 123 = 123864868.",
"",
"Find (∑1≤u≤39 Q(2u)) mod 1 000 000 123."
]
},
{
"id": "5900f5751000cf542c510088",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 521: Smallest prime factor",
"tests": [
"assert.strictEqual(euler521(), 44389811, 'message: <code>euler521()</code> should return 44389811.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler521() {",
" // Good luck!",
" return true;",
"}",
"",
"euler521();"
],
"description": [
"Let smpf(n) be the smallest prime factor of n.",
"smpf(91)=7 because 91=7×13 and smpf(45)=3 because 45=3×3×5.",
"Let S(n) be the sum of smpf(i) for 2 ≤ i ≤ n.",
"E.g. S(100)=1257.",
"",
"",
"",
"Find S(1012) mod 109."
]
},
{
"id": "5900f5761000cf542c510089",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 522: Hilbert's Blackout",
"tests": [
"assert.strictEqual(euler522(), TODO: MISSING ANSWER, 'message: <code>euler522()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler522() {",
" // Good luck!",
" return true;",
"}",
"",
"euler522();"
],
"description": [
"Despite the popularity of Hilbert's infinite hotel, Hilbert decided to try managing extremely large finite hotels, instead. ",
"",
"To cut costs, Hilbert wished to power the new hotel with his own special generator. Each floor would send power to the floor above it, with the top floor sending power back down to the bottom floor. That way, Hilbert could have the generator placed on any given floor (as he likes having the option) and have electricity flow freely throughout the entire hotel.",
"",
"Unfortunately, the contractors misinterpreted the schematics when they built the hotel. They informed Hilbert that each floor sends power to another floor at random, instead. This may compromise Hilbert's freedom to have the generator placed anywhere, since blackouts could occur on certain floors.",
"",
"For example, consider a sample flow diagram for a three-story hotel:",
"",
"",
"",
"If the generator were placed on the first floor, then every floor would receive power. But if it were placed on the second or third floors instead, then there would be a blackout on the first floor. Note that while a given floor can receive power from many other floors at once, it can only send power to one other floor.",
"",
"To resolve the blackout concerns, Hilbert decided to have a minimal number of floors rewired. To rewire a floor is to change the floor it sends power to. In the sample diagram above, all possible blackouts can be avoided by rewiring the second floor to send power to the first floor instead of the third floor.",
"",
"Let F(n) be the sum of the minimum number of floor rewirings needed over all possible power-flow arrangements in a hotel of n floors. For example, F(3) = 6, F(8) = 16276736, and F(100) mod 135707531 = 84326147.",
"",
"Find F(12344321) mod 135707531."
]
},
{
"id": "5900fe885726495c153991c8",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 523: First Sort I",
"tests": [
"assert.strictEqual(euler523(), TODO: MISSING ANSWER, 'message: <code>euler523()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler523() {",
" // Good luck!",
" return true;",
"}",
"",
"euler523();"
],
"description": [
"Consider the following algorithm for sorting a list:",
"1. Starting from the beginning of the list, check each pair of adjacent elements in turn.",
"2. If the elements are out of order:",
"a. Move the smallest element of the pair at the beginning of the list.",
"b. Restart the process from step 1.",
"3. If all pairs are in order, stop.For example, the list { 4 1 3 2 } is sorted as follows:",
"4 1 3 2 (4 and 1 are out of order so move 1 to the front of the list)",
"1 4 3 2 (4 and 3 are out of order so move 3 to the front of the list)",
"3 1 4 2 (3 and 1 are out of order so move 1 to the front of the list)",
"1 3 4 2 (4 and 2 are out of order so move 2 to the front of the list)",
"2 1 3 4 (2 and 1 are out of order so move 1 to the front of the list)",
"1 2 3 4 (The list is now sorted)Let F(L) be the number of times step 2a is executed to sort list L. For example, F({ 4 1 3 2 }) = 5.",
"",
"Let E(n) be the expected value of F(P) over all permutations P of the integers {1, 2, ..., n}.",
"You are given E(4) = 3.25 and E(10) = 115.725.",
"",
"Find E(30). Give your answer rounded to two digits after the decimal point."
]
},
{
"id": "5900fece58d9425c70af4f5e",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 524: First Sort II",
"tests": [
"assert.strictEqual(euler524(), TODO: MISSING ANSWER, 'message: <code>euler524()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler524() {",
" // Good luck!",
" return true;",
"}",
"",
"euler524();"
],
"description": [
"Consider the following algorithm for sorting a list:",
"1. Starting from the beginning of the list, check each pair of adjacent elements in turn.",
"2. If the elements are out of order:",
"a. Move the smallest element of the pair at the beginning of the list.",
"b. Restart the process from step 1.",
"3. If all pairs are in order, stop.For example, the list { 4 1 3 2 } is sorted as follows:",
"4 1 3 2 (4 and 1 are out of order so move 1 to the front of the list)",
"1 4 3 2 (4 and 3 are out of order so move 3 to the front of the list)",
"3 1 4 2 (3 and 1 are out of order so move 1 to the front of the list)",
"1 3 4 2 (4 and 2 are out of order so move 2 to the front of the list)",
"2 1 3 4 (2 and 1 are out of order so move 1 to the front of the list)",
"1 2 3 4 (The list is now sorted)Let F(L) be the number of times step 2a is executed to sort list L. For example, F({ 4 1 3 2 }) = 5.",
"",
"We can list all permutations P of the integers {1, 2, ..., n} in lexicographical order, and assign to each permutation an index In(P) from 1 to n! corresponding to its position in the list.",
"",
"Let Q(n, k) = min(In(P)) for F(P) = k, the index of the first permutation requiring exactly k steps to sort with First Sort. If there is no permutation for which F(P) = k, then Q(n, k) is undefined.",
"",
"For n = 4 we have:",
"",
"PI4(P)F(P){1, 2, 3, 4}10Q(4, 0) = 1{1, 2, 4, 3}24Q(4, 4) = 2{1, 3, 2, 4}32Q(4, 2) = 3{1, 3, 4, 2}42{1, 4, 2, 3}56Q(4, 6) = 5{1, 4, 3, 2}64{2, 1, 3, 4}71Q(4, 1) = 7{2, 1, 4, 3}85Q(4, 5) = 8{2, 3, 1, 4}91{2, 3, 4, 1}101{2, 4, 1, 3}115{2, 4, 3, 1}123Q(4, 3) = 12{3, 1, 2, 4}133{3, 1, 4, 2}143{3, 2, 1, 4}152{3, 2, 4, 1}162{3, 4, 1, 2}173{3, 4, 2, 1}182{4, 1, 2, 3}197Q(4, 7) = 19{4, 1, 3, 2}205{4, 2, 1, 3}216{4, 2, 3, 1}224{4, 3, 1, 2}234{4, 3, 2, 1}243Let R(k) = min(Q(n, k)) over all n for which Q(n, k) is defined.",
"",
"Find R(1212)."
]
},
{
"id": "5900fecf58d9425c70af4f5f",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 525: Rolling Ellipse",
"tests": [
"assert.strictEqual(euler525(), TODO: MISSING ANSWER, 'message: <code>euler525()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler525() {",
" // Good luck!",
" return true;",
"}",
"",
"euler525();"
],
"description": [
"An ellipse E(a, b) is given at its initial position by equation:",
"$\\frac {x^2} {a^2} + \\frac {(y - b)^2} {b^2} = 1$",
"",
"The ellipse rolls without slipping along the x axis for one complete turn. Interestingly, the length of the curve generated by a focus is independent from the size of the minor axis:",
"$F(a,b) = 2 \\pi \\text{ } max(a,b)$",
"",
"",
"",
"This is not true for the curve generated by the ellipse center. Let C(a,b) be the length of the curve generated by the center of the ellipse as it rolls without slipping for one turn.",
"",
"",
"",
"You are given C(2, 4) ~ 21.38816906.",
"",
"Find C(1, 4) + C(3, 4). Give your answer rounded to 8 digits behind the decimal point in the form ab.cdefghij."
]
},
{
"id": "5900fed058d9425c70af4f60",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 526: Largest prime factors of consecutive numbers",
"tests": [
"assert.strictEqual(euler526(), TODO: MISSING ANSWER, 'message: <code>euler526()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler526() {",
" // Good luck!",
" return true;",
"}",
"",
"euler526();"
],
"description": [
"Let f(n) be the largest prime factor of n.",
"Let g(n) = f(n) + f(n+1) + f(n+2) + f(n+3) + f(n+4) + f(n+5) + f(n+6) + f(n+7) + f(n+8), the sum of the largest prime factor of each of nine consecutive numbers starting with n.",
"Let h(n) be the maximum value of g(k) for 2 ≤ k ≤ n.",
"You are given:",
"f(100) = 5",
"f(101) = 101",
"g(100) = 409",
"h(100) = 417",
"h(109) = 4896292593Find h(1016)."
]
},
{
"id": "5900fed158d9425c70af4f61",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 527: Randomized Binary Search",
"tests": [
"assert.strictEqual(euler527(), TODO: MISSING ANSWER, 'message: <code>euler527()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler527() {",
" // Good luck!",
" return true;",
"}",
"",
"euler527();"
],
"description": [
"A secret integer t is selected at random within the range 1 ≤ t ≤ n. ",
"",
"The goal is to guess the value of t by making repeated guesses, via integer g. After a guess is made, there are three possible outcomes, in which it will be revealed that either g < t, g = t, or g > t. Then the process can repeat as necessary.",
"",
"Normally, the number of guesses required on average can be minimized with a binary search: Given a lower bound L and upper bound H (initialized to L = 1 and H = n), let g = ⌊(L+H)/2⌋ where ⌊⋅⌋ is the integer floor function. If g = t, the process ends. Otherwise, if g < t, set L = g+1, but if g > t instead, set H = g1. After setting the new bounds, the search process repeats, and ultimately ends once t is found. Even if t can be deduced without searching, assume that a search will be required anyway to confirm the value.",
"",
"Your friend Bob believes that the standard binary search is not that much better than his randomized variant: Instead of setting g = ⌊(L+H)/2⌋, simply let g be a random integer between L and H, inclusive. The rest of the algorithm is the same as the standard binary search. This new search routine will be referred to as a random binary search.",
"",
"Given that 1 ≤ t ≤ n for random t, let B(n) be the expected number of guesses needed to find t using the standard binary search, and let R(n) be the expected number of guesses needed to find t using the random binary search. For example, B(6) = 2.33333333 and R(6) = 2.71666667 when rounded to 8 decimal places.",
"",
"Find R(1010) B(1010) rounded to 8 decimal places."
]
},
{
"id": "5900fed258d9425c70af4f62",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 528: Constrained Sums",
"tests": [
"assert.strictEqual(euler528(), TODO: MISSING ANSWER, 'message: <code>euler528()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler528() {",
" // Good luck!",
" return true;",
"}",
"",
"euler528();"
],
"description": [
"Let S(n,k,b) represent the number of valid solutions to x1 + x2 + ... + xk ≤ n, where 0 ≤ xm ≤ bm for all 1 ≤ m ≤ k.",
"",
"For example, S(14,3,2) = 135, S(200,5,3) = 12949440, and S(1000,10,5) mod 1 000 000 007 = 624839075.",
"",
"Find (∑10 ≤ k ≤ 15 S(10k,k,k)) mod 1 000 000 007."
]
},
{
"id": "5900fed358d9425c70af4f63",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 529: 10-substrings",
"tests": [
"assert.strictEqual(euler529(), TODO: MISSING ANSWER, 'message: <code>euler529()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler529() {",
" // Good luck!",
" return true;",
"}",
"",
"euler529();"
],
"description": [
"A 10-substring of a number is a substring of its digits that sum to 10. For example, the 10-substrings of the number 3523014 are:",
"3523014",
"3523014",
"3523014",
"3523014A number is called 10-substring-friendly if every one of its digits belongs to a 10-substring. For example, 3523014 is 10-substring-friendly, but 28546 is not.",
"Let T(n) be the number of 10-substring-friendly numbers from 1 to 10n (inclusive).",
"For example T(2) = 9 and T(5) = 3492.",
"Find T(1018) mod 1 000 000 007."
]
},
{
"id": "5900fed458d9425c70af4f64",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 530: GCD of Divisors",
"tests": [
"assert.strictEqual(euler530(), TODO: MISSING ANSWER, 'message: <code>euler530()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler530() {",
" // Good luck!",
" return true;",
"}",
"",
"euler530();"
],
"description": [
"Every divisor d of a number n has a complementary divisor n/d.",
"",
"Let f(n) be the sum of the greatest common divisor of d and n/d over all positive divisors d of n, that is",
"$f(n)=\\displaystyle\\sum\\limits_{d|n}\\, \\text{gcd}(d,\\frac n d)$.",
"",
"Let F be the summatory function of f, that is",
"$F(k)=\\displaystyle\\sum\\limits_{n=1}^k \\, f(n)$.",
"",
"You are given that F(10)=32 and F(1000)=12776.",
"",
"Find F(1015)."
]
},
{
"id": "5900fed558d9425c70af4f65",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 531: Chinese leftovers",
"tests": [
"assert.strictEqual(euler531(), TODO: MISSING ANSWER, 'message: <code>euler531()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler531() {",
" // Good luck!",
" return true;",
"}",
"",
"euler531();"
],
"description": [
"Let g(a,n,b,m) be the smallest non-negative solution x to the system:x = a mod nx = b mod m",
"if such a solution exists, otherwise 0.",
"",
"",
"E.g. g(2,4,4,6)=10, but g(3,4,4,6)=0.",
"",
"",
"Let φ(n) be Euler's totient function.",
"",
"",
"Let f(n,m)=g(φ(n),n,φ(m),m)",
"",
"",
"Find ∑f(n,m) for 1000000 ≤ n < m < 1005000"
]
},
{
"id": "5900fed658d9425c70af4f66",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 532: Nanobots on Geodesics",
"tests": [
"assert.strictEqual(euler532(), TODO: MISSING ANSWER, 'message: <code>euler532()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler532() {",
" // Good luck!",
" return true;",
"}",
"",
"euler532();"
],
"description": [
"Bob is a manufacturer of nanobots and wants to impress his customers by giving them a ball colored by his new nanobots as a present.",
"",
"His nanobots can be programmed to select and locate exactly one other bot precisely and, after activation, move towards this bot along the shortest possible path and draw a colored line onto the surface while moving. Placed on a plane, the bots will start to move towards their selected bots in a straight line. In contrast, being placed on a ball, they will start to move along a geodesic as the shortest possible path. However, in both cases, whenever their target moves they will adjust their direction instantaneously to the new shortest possible path. All bots will move at the same speed after their simultaneous activation until each bot reaches its goal.",
"",
"Now Bob places n bots on the ball (with radius 1) equidistantly on a small circle with radius 0.999 and programs each of them to move toward the next nanobot sitting counterclockwise on that small circle. After activation, the bots move in a sort of spiral until they finally meet at one point on the ball.",
"",
"Using three bots, Bob finds that every bot will draw a line of length 2.84, resulting in a total length of 8.52 for all three bots, each time rounded to two decimal places. The colored ball looks like this:",
"",
"",
"",
"In order to show off a little with his presents, Bob decides to use just enough bots to make sure that the line each bot draws is longer than 1000. What is the total length of all lines drawn with this number of bots, rounded to two decimal places?"
]
},
{
"id": "5900fed758d9425c70af4f67",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 533: Minimum values of the Carmichael function",
"tests": [
"assert.strictEqual(euler533(), TODO: MISSING ANSWER, 'message: <code>euler533()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler533() {",
" // Good luck!",
" return true;",
"}",
"",
"euler533();"
],
"description": [
"The Carmichael function λ(n) is defined as the smallest positive integer m such that am = 1 modulo n for all integers a coprime with n.",
"For example λ(8) = 2 and λ(240) = 4.",
"",
"Define L(n) as the smallest positive integer m such that λ(k)  n for all k  m.",
"For example, L(6) = 241 and L(100) = 20 174 525 281.",
"",
"Find L(20 000 000). Give the last 9 digits of your answer."
]
},
{
"id": "5900fed858d9425c70af4f68",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 534: Weak Queens",
"tests": [
"assert.strictEqual(euler534(), TODO: MISSING ANSWER, 'message: <code>euler534()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler534() {",
" // Good luck!",
" return true;",
"}",
"",
"euler534();"
],
"description": [
"The classical eight queens puzzle is the well known problem of placing eight chess queens on a 8×8 chessboard so that no two queens threaten each other. Allowing configurations to reappear in rotated or mirrored form, a total of 92 distinct configurations can be found for eight queens. The general case asks for the number of distinct ways of placing n queens on a n×n board, e.g. you can find 2 distinct configurations for n=4.",
"",
"Lets define a weak queen on a n×n board to be a piece which can move any number of squares if moved horizontally, but a maximum of n1w squares if moved vertically or diagonally, 0≤w<n being the \"weakness factor\". For example, a weak queen on a n×n board with a weakness factor of w=1 located in the bottom row will not be able to threaten any square in the top row as the weak queen would need to move n1 squares vertically or diagonally to get there, but may only move n2 squares in these directions. In contrast, the weak queen is not handicapped horizontally, thus threatening every square in its own row, independently from its current position in that row.",
"",
"Let Q(n,w) be the number of ways n weak queens with weakness factor w can be placed on a n×n board so that no two queens threaten each other. It can be shown, for example, that Q(4,0)=2, Q(4,2)=16 and Q(4,3)=256.",
"",
"Let $S(n)=\\displaystyle\\sum_{w=0}^{n-1} Q(n,w)$.",
"",
"You are given that S(4)=276 and S(5)=3347.",
"",
"Find S(14)."
]
},
{
"id": "5900fed958d9425c70af4f69",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 535: Fractal Sequence",
"tests": [
"assert.strictEqual(euler535(), TODO: MISSING ANSWER, 'message: <code>euler535()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler535() {",
" // Good luck!",
" return true;",
"}",
"",
"euler535();"
],
"description": [
"Consider the infinite integer sequence S starting with:S = 1, 1, 2, 1, 3, 2, 4, 1, 5, 3, 6, 2, 7, 8, 4, 9, 1, 10, 11, 5, ...",
"",
"Circle the first occurrence of each integer.S = ①, 1, ②, 1, ③, 2, ④, 1, ⑤, 3, ⑥, 2, ⑦, ⑧, 4, ⑨, 1, ⑩, ⑪, 5, ...",
"",
"The sequence is characterized by the following properties:",
"The circled numbers are consecutive integers starting with 1.",
"Immediately preceding each non-circled numbers ai, there are exactly ⌊√ai⌋ adjacent circled numbers, where ⌊⌋ is the floor function.",
"If we remove all circled numbers, the remaining numbers form a sequence identical to S, so S is a fractal sequence.Let T(n) be the sum of the first n elements of the sequence.",
"You are given T(1) = 1, T(20) = 86, T(103) = 364089 and T(109) = 498676527978348241.",
"",
"Find T(1018). Give the last 9 digits of your answer."
]
},
{
"id": "5900feda58d9425c70af4f6a",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 536: Modulo power identity",
"tests": [
"assert.strictEqual(euler536(), TODO: MISSING ANSWER, 'message: <code>euler536()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler536() {",
" // Good luck!",
" return true;",
"}",
"",
"euler536();"
],
"description": [
"Let S(n) be the sum of all positive integers m not exceeding n having the following property:a m+4 ≡ a (mod m) for all integers a.",
"",
"",
"The values of m ≤ 100 that satisfy this property are 1, 2, 3, 5 and 21, thus S(100) = 1+2+3+5+21 = 32.",
"You are given S(106) = 22868117.",
"",
"",
"Find S(1012)."
]
},
{
"id": "5900fedb58d9425c70af4f6b",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 537: Counting tuples",
"tests": [
"assert.strictEqual(euler537(), TODO: MISSING ANSWER, 'message: <code>euler537()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler537() {",
" // Good luck!",
" return true;",
"}",
"",
"euler537();"
],
"description": [
"Let π(x) be the prime counting function, i.e. the number of prime numbers less than or equal to x.",
"For example, π(1)=0, π(2)=1, π(100)=25.",
"",
"",
"Let T(n,k) be the number of k-tuples (x1,…,xk) which satisfy:",
"1. every xi is a positive integer;",
"2. $\\displaystyle \\sum_{i=1}^k \\pi(x_i)=n$",
"",
"",
"For example T(3,3)=19.",
"The 19 tuples are (1,1,5), (1,5,1), (5,1,1), (1,1,6), (1,6,1), (6,1,1), (1,2,3), (1,3,2), (2,1,3), (2,3,1), (3,1,2), (3,2,1), (1,2,4), (1,4,2), (2,1,4), (2,4,1), (4,1,2), (4,2,1), (2,2,2).",
"",
"",
"You are given T(10,10) = 869 985 and T(103,103) ≡ 578 270 566 (mod 1 004 535 809).",
"",
"Find T(20 000, 20 000) mod 1 004 535 809."
]
},
{
"id": "5900fedc58d9425c70af4f6c",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 538: Maximum quadrilaterals",
"tests": [
"assert.strictEqual(euler538(), TODO: MISSING ANSWER, 'message: <code>euler538()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler538() {",
" // Good luck!",
" return true;",
"}",
"",
"euler538();"
],
"description": [
"Consider a positive integer sequence S = (s1, s2, ..., sn).",
"",
"Let f(S) be the perimeter of the maximum-area quadrilateral whose side lengths are 4 elements (si, sj, sk, sl) of S (all i, j, k, l distinct). If there are many quadrilaterals with the same maximum area, then choose the one with the largest perimeter.",
"",
"For example, if S = (8, 9, 14, 9, 27), then we can take the elements (9, 14, 9, 27) and form an isosceles trapezium with parallel side lengths 14 and 27 and both leg lengths 9. The area of this quadrilateral is 127.611470879... It can be shown that this is the largest area for any quadrilateral that can be formed using side lengths from S. Therefore, f(S) = 9 + 14 + 9 + 27 = 59.",
"",
"Let un = 2B(3n) + 3B(2n) + B(n+1), where B(k) is the number of 1 bits of k in base 2.",
"For example, B(6) = 2, B(10) = 2 and B(15) = 4, and u5 = 24 + 32 + 2 = 27.",
"",
"Also, let Un be the sequence (u1, u2, ..., un).",
"For example, U10 = (8, 9, 14, 9, 27, 16, 36, 9, 27, 28).",
"",
"It can be shown that f(U5) = 59, f(U10) = 118, f(U150) = 3223.",
"It can also be shown that Σ f(Un) = 234761 for 4  n  150.",
"Find Σ f(Un) for 4  n  3 000 000."
]
},
{
"id": "5900fedd58d9425c70af4f6d",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 539: Odd elimination",
"tests": [
"assert.strictEqual(euler539(), TODO: MISSING ANSWER, 'message: <code>euler539()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler539() {",
" // Good luck!",
" return true;",
"}",
"",
"euler539();"
],
"description": [
"Start from an ordered list of all integers from 1 to n. Going from left to right, remove the first number and every other number afterward until the end of the list. Repeat the procedure from right to left, removing the right most number and every other number from the numbers left. Continue removing every other numbers, alternating left to right and right to left, until a single number remains.",
"",
"",
"Starting with n = 9, we have:1 2 3 4 5 6 7 8 9",
"2 4 6 82 6",
"6",
"",
"",
"Let P(n) be the last number left starting with a list of length n.",
"Let $\\displaystyle S(n) = \\sum_{k=1}^n P(k)$.",
"You are given P(1)=1, P(9) = 6, P(1000)=510, S(1000)=268271.",
"",
"",
"Find S(1018) mod 987654321."
]
},
{
"id": "5900fede58d9425c70af4f6e",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 540: Counting primitive Pythagorean triples",
"tests": [
"assert.strictEqual(euler540(), TODO: MISSING ANSWER, 'message: <code>euler540()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler540() {",
" // Good luck!",
" return true;",
"}",
"",
"euler540();"
],
"description": [
"A Pythagorean triple consists of three positive integers $a, b$ and $c$ satisfying $a^2+b^2=c^2$.",
"The triple is called primitive if $a, b$ and $c$ are relatively prime.",
"Let P($n$) be the number of primitive Pythagorean triples with $a < b < c <= n$.",
"For example P(20) = 3, since there are three triples: (3,4,5), (5,12,13) and (8,15,17).",
"",
"",
"You are given that P(106) = 159139.",
"Find P(3141592653589793)."
]
},
{
"id": "5900fedf58d9425c70af4f6f",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 541: Divisibility of Harmonic Number Denominators",
"tests": [
"assert.strictEqual(euler541(), TODO: MISSING ANSWER, 'message: <code>euler541()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler541() {",
" // Good luck!",
" return true;",
"}",
"",
"euler541();"
],
"description": [
"The nthharmonic number Hn is defined as the sum of the multiplicative inverses of the first n positive integers, and can be written as a reduced fraction an/bn.",
"$H_n = \\displaystyle \\sum_{k=1}^n \\frac 1 k = \\frac {a_n} {b_n}$, with $\\text {gcd}(a_n, b_n)=1$.",
"",
"Let M(p) be the largest value of n such that bn is not divisible by p.",
"",
"For example, M(3) = 68 because $H_{68} = \\frac {a_{68}} {b_{68}} = \\frac {14094018321907827923954201611} {2933773379069966367528193600}$, b68=2933773379069966367528193600 is not divisible by 3, but all larger harmonic numbers have denominators divisible by 3.",
"",
"You are given M(7) = 719102.",
"",
"Find M(137)."
]
},
{
"id": "5900fee058d9425c70af4f70",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 542: Geometric Progression with Maximum Sum",
"tests": [
"assert.strictEqual(euler542(), TODO: MISSING ANSWER, 'message: <code>euler542()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler542() {",
" // Good luck!",
" return true;",
"}",
"",
"euler542();"
],
"description": [
"Let S(k) be the sum of three or more distinct positive integers having the following properties:",
"No value exceeds k.",
"The values form a geometric progression.",
"The sum is maximal.S(4) = 4 + 2 + 1 = 7S(10) = 9 + 6 + 4 = 19S(12) = 12 + 6 + 3 = 21S(1000) = 1000 + 900 + 810 + 729 = 3439",
"",
"Let $T(n) = \\sum_{k=4}^n (-1)^k S(k)$.T(1000) = 2268",
"",
"Find T(1017)."
]
},
{
"id": "5900fee158d9425c70af4f71",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 543: Prime-Sum Numbers",
"tests": [
"assert.strictEqual(euler543(), TODO: MISSING ANSWER, 'message: <code>euler543()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler543() {",
" // Good luck!",
" return true;",
"}",
"",
"euler543();"
],
"description": [
"Define function P(n,k) = 1 if n can be written as the sum of k prime numbers (with repetitions allowed), and P(n,k) = 0 otherwise.",
"",
"For example, P(10,2) = 1 because 10 can be written as either 3 + 7 or 5 + 5, but P(11,2) = 0 because no two primes can sum to 11.",
"",
"Let S(n) be the sum of all P(i,k) over 1 ≤ i,k ≤ n.",
"",
"For example, S(10) = 20, S(100) = 2402, and S(1000) = 248838.",
"",
"Let F(k) be the kth Fibonacci number (with F(0) = 0 and F(1) = 1).",
"",
"Find the sum of all S(F(k)) over 3 ≤ k ≤ 44"
]
},
{
"id": "5900fee258d9425c70af4f72",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 544: Chromatic Conundrum",
"tests": [
"assert.strictEqual(euler544(), TODO: MISSING ANSWER, 'message: <code>euler544()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler544() {",
" // Good luck!",
" return true;",
"}",
"",
"euler544();"
],
"description": [
"Let F(r,c,n) be the number of ways to color a rectangular grid with r rows and c columns using at most n colors such that no two adjacent cells share the same color. Cells that are diagonal to each other are not considered adjacent.",
"",
"For example, F(2,2,3) = 18, F(2,2,20) = 130340, and F(3,4,6) = 102923670.",
"",
"Let S(r,c,n) = $\\sum_{k=1}^{n}$ F(r,c,k).",
"",
"For example, S(4,4,15) mod 109+7 = 325951319.",
"",
"Find S(9,10,1112131415) mod 109+7."
]
},
{
"id": "5900fee358d9425c70af4f73",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 545: Faulhaber's Formulas",
"tests": [
"assert.strictEqual(euler545(), TODO: MISSING ANSWER, 'message: <code>euler545()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler545() {",
" // Good luck!",
" return true;",
"}",
"",
"euler545();"
],
"description": [
"The sum of the kth powers of the first n positive integers can be expressed as a polynomial of degree k+1 with rational coefficients, the Faulhaber's Formulas:",
"$1^k + 2^k + ... + n^k = \\sum_{i=1}^n i^k = \\sum_{i=1}^{k+1} a_{i} n^i = a_{1} n + a_{2} n^2 + ... + a_{k} n^k + a_{k+1} n^{k + 1}$,",
"where ai's are rational coefficients that can be written as reduced fractions pi/qi (if ai = 0, we shall consider qi = 1).",
"",
"For example, $1^4 + 2^4 + ... + n^4 = -\\frac 1 {30} n + \\frac 1 3 n^3 + \\frac 1 2 n^4 + \\frac 1 5 n^5.$",
"",
"Define D(k) as the value of q1 for the sum of kth powers (i.e. the denominator of the reduced fraction a1).",
"Define F(m) as the mth value of k  1 for which D(k) = 20010.",
"You are given D(4) = 30 (since a1 = -1/30), D(308) = 20010, F(1) = 308, F(10) = 96404.",
"",
"Find F(105)."
]
},
{
"id": "5900fee458d9425c70af4f74",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 546: The Floor's Revenge",
"tests": [
"assert.strictEqual(euler546(), TODO: MISSING ANSWER, 'message: <code>euler546()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler546() {",
" // Good luck!",
" return true;",
"}",
"",
"euler546();"
],
"description": [
"Define fk(n) = $\\sum_{i=0}^{n}$ fk($\\lfloor\\frac{i}{k}\\rfloor$) where fk(0) = 1 and $\\lfloor x \\rfloor$ denotes the floor function.",
"",
"For example, f5(10) = 18, f7(100) = 1003, and f2(103) = 264830889564.",
"",
"Find $(\\sum_{k=2}^{10}$ fk(1014)$)$ mod (109+7)."
]
},
{
"id": "5900fee558d9425c70af4f75",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 547: Distance of random points within hollow square laminae",
"tests": [
"assert.strictEqual(euler547(), TODO: MISSING ANSWER, 'message: <code>euler547()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler547() {",
" // Good luck!",
" return true;",
"}",
"",
"euler547();"
],
"description": [
"Assuming that two points are chosen randomly (with uniform distribution) within a rectangle, it is possible to determine the expected value of the distance between these two points.",
"",
"For example, the expected distance between two random points in a unit square is about 0.521405, while the expected distance between two random points in a rectangle with side lengths 2 and 3 is about 1.317067.",
"",
"Now we define a hollow square lamina of size n to be an integer sized square with side length n ≥ 3 consisting of n2 unit squares from which a rectangle consisting of x × y unit squares (1 ≤ x,y ≤ n - 2) within the original square has been removed.",
"",
"For n = 3 there exists only one hollow square lamina:",
"",
"",
"",
"For n = 4 you can find 9 distinct hollow square laminae, allowing shapes to reappear in rotated or mirrored form:",
"",
"",
"",
"Let S(n) be the sum of the expected distance between two points chosen randomly within each of the possible hollow square laminae of size n. The two points have to lie within the area left after removing the inner rectangle, i.e. the gray-colored areas in the illustrations above.",
"",
"For example, S(3) = 1.6514 and S(4) = 19.6564, rounded to four digits after the decimal point.",
"",
"Find S(40) rounded to four digits after the decimal point."
]
},
{
"id": "5900fee658d9425c70af4f76",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 548: Gozinta Chains",
"tests": [
"assert.strictEqual(euler548(), TODO: MISSING ANSWER, 'message: <code>euler548()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler548() {",
" // Good luck!",
" return true;",
"}",
"",
"euler548();"
],
"description": [
"A gozinta chain for n is a sequence {1,a,b,...,n} where each element properly divides the next.",
"There are eight gozinta chains for 12:",
"{1,12} ,{1,2,12}, {1,2,4,12}, {1,2,6,12}, {1,3,12}, {1,3,6,12}, {1,4,12} and {1,6,12}. ",
"Let g(n) be the number of gozinta chains for n, so g(12)=8.",
"g(48)=48 and g(120)=132.",
"",
"",
"Find the sum of the numbers n not exceeding 1016 for which g(n)=n."
]
},
{
"id": "5900fee758d9425c70af4f77",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 549: Divisibility of factorials",
"tests": [
"assert.strictEqual(euler549(), TODO: MISSING ANSWER, 'message: <code>euler549()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler549() {",
" // Good luck!",
" return true;",
"}",
"",
"euler549();"
],
"description": [
"The smallest number m such that 10 divides m! is m=5.",
"The smallest number m such that 25 divides m! is m=10.",
"",
"Let s(n) be the smallest number m such that n divides m!.",
"So s(10)=5 and s(25)=10.",
"Let S(n) be ∑s(i) for 2 ≤ i ≤ n.",
"S(100)=2012.",
"",
"",
"Find S(108)."
]
},
{
"id": "5900fee858d9425c70af4f78",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 550: Divisor game",
"tests": [
"assert.strictEqual(euler550(), TODO: MISSING ANSWER, 'message: <code>euler550()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler550() {",
" // Good luck!",
" return true;",
"}",
"",
"euler550();"
],
"description": [
"Two players are playing a game. There are k piles of stones.",
"When it is his turn a player has to choose a pile and replace it by two piles of stones under the following two conditions:",
"",
"",
" Both new piles must have a number of stones more than one and less than the number of stones of the original pile.",
" The number of stones of each of the new piles must be a divisor of the number of stones of the original pile.",
"The first player unable to make a valid move loses.",
"",
"Let f(n,k) be the number of winning positions for the first player, assuming perfect play, when the game is played with k piles each having between 2 and n stones (inclusively).f(10,5)=40085.",
"",
"",
"Find f(107,1012).Give your answer modulo 987654321."
]
},
{
"id": "5900fee958d9425c70af4f79",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 551: Sum of digits sequence",
"tests": [
"assert.strictEqual(euler551(), TODO: MISSING ANSWER, 'message: <code>euler551()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler551() {",
" // Good luck!",
" return true;",
"}",
"",
"euler551();"
],
"description": [
"Let a0, a1, a2, ... be an integer sequence defined by:",
"a0 = 1;",
"for n ≥ 1, an is the sum of the digits of all preceding terms.",
"The sequence starts with 1, 1, 2, 4, 8, 16, 23, 28, 38, 49, ...",
"You are given a106 = 31054319.",
"Find a1015."
]
},
{
"id": "5900feea58d9425c70af4f7a",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 552: Chinese leftovers II",
"tests": [
"assert.strictEqual(euler552(), TODO: MISSING ANSWER, 'message: <code>euler552()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler552() {",
" // Good luck!",
" return true;",
"}",
"",
"euler552();"
],
"description": [
"Let An be the smallest positive integer satisfying An mod pi = i for all 1 ≤ i ≤ n, where pi is the",
"i-th prime.",
"For example A2 = 5, since this is the smallest positive solution of the system of equations ",
" A2 mod 2 = 1 ",
" A2 mod 3 = 2",
"The system of equations for A3 adds another constraint. That is, A3 is the smallest positive solution of",
" A3 mod 2 = 1 ",
" A3 mod 3 = 2",
" A3 mod 5 = 3",
"and hence A3 = 23. Similarly, one gets A4 = 53 and A5 = 1523.",
"",
"",
"Let S(n) be the sum of all primes up to n that divide at least one element in the sequence A.",
"For example, S(50) = 69 = 5 + 23 + 41, since 5 divides A2, 23 divides A3 and 41 divides A10 = 5765999453. No other prime number up to 50 divides an element in A.",
"",
"",
"Find S(300000)."
]
},
{
"id": "5900feeb58d9425c70af4f7b",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 553: Power sets of power sets",
"tests": [
"assert.strictEqual(euler553(), TODO: MISSING ANSWER, 'message: <code>euler553()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler553() {",
" // Good luck!",
" return true;",
"}",
"",
"euler553();"
],
"description": [
"Let P(n) be the set of the first n positive integers {1, 2, ..., 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  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  X corresponds to a vertex and labeled with Y;",
"Two vertices Y1 and Y2 are connected if Y1  Y2  ∅.",
"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) mod 1 000 000 007 = 728209718.",
"",
"Find C(104,10) mod 1 000 000 007."
]
},
{
"id": "5900feec58d9425c70af4f7c",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 554: Centaurs on a chess board",
"tests": [
"assert.strictEqual(euler554(), TODO: MISSING ANSWER, 'message: <code>euler554()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler554() {",
" // Good luck!",
" return true;",
"}",
"",
"euler554();"
],
"description": [
"On a chess board, a centaur moves like a king or a knight. The diagram below shows the valid moves of a centaur (represented by an inverted king) on an 8x8 board.",
"",
"",
"",
"It can be shown that at most n2 non-attacking centaurs can be placed on a board of size 2n×2n.",
"Let C(n) be the number of ways to place n2 centaurs on a 2n×2n board so that no centaur attacks another directly.",
"For example C(1) = 4, C(2) = 25, C(10) = 1477721.",
"",
"Let Fi be the ith Fibonacci number defined as F1 = F2 = 1 and Fi = Fi-1 + Fi-2 for i > 2.",
"",
"Find $\\displaystyle \\left( \\sum_{i=2}^{90} C(F_i) \\right) \\text{mod } (10^8+7)$."
]
},
{
"id": "5900feed58d9425c70af4f7d",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 555: McCarthy 91 function",
"tests": [
"assert.strictEqual(euler555(), TODO: MISSING ANSWER, 'message: <code>euler555()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler555() {",
" // Good luck!",
" return true;",
"}",
"",
"euler555();"
],
"description": [
"The McCarthy 91 function is defined as follows:",
"$$",
"M_{91}(n) = ",
" \\begin{cases}",
" n - 10 & \\text{if } n > 100 \\\\",
" M_{91}(M_{91}(n+11)) & \\text{if } 0 \\leq n \\leq 100",
" \\end{cases}",
"$$",
"",
"",
"We can generalize this definition by abstracting away the constants into new variables:",
"",
"$$",
"M_{m,k,s}(n) = ",
" \\begin{cases}",
" n - s & \\text{if } n > m \\\\",
" M_{m,k,s}(M_{m,k,s}(n+k)) & \\text{if } 0 \\leq n \\leq m",
" \\end{cases}",
"$$",
"",
"",
"This way, we have $M_{91} = M_{100,11,10}$.",
"",
"",
"Let $F_{m,k,s}$ be the set of fixed points of $M_{m,k,s}$. That is, ",
"",
"$$F_{m,k,s}= \\left\\{ n \\in \\mathbb{N} \\, | \\, M_{m,k,s}(n) = n \\right\\}$$",
"",
"",
"For example, the only fixed point of $M_{91}$ is $n = 91$. In other words, $F_{100,11,10}= \\{91\\}$.",
"",
"",
"Now, define $SF(m,k,s)$ as the sum of the elements in $F_{m,k,s}$ and let $S(p,m) = \\displaystyle \\sum_{1 \\leq s < k \\leq p}{SF(m,k,s)}$.",
"",
"",
"For example, $S(10, 10) = 225$ and $S(1000, 1000)=208724467$.",
"",
"",
"Find $S(10^6, 10^6)$."
]
},
{
"id": "5900feee58d9425c70af4f7e",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 556: Squarefree Gaussian Integers",
"tests": [
"assert.strictEqual(euler556(), TODO: MISSING ANSWER, 'message: <code>euler556()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler556() {",
" // Good luck!",
" return true;",
"}",
"",
"euler556();"
],
"description": [
"A Gaussian integer is a number z = a + bi where a, b are integers and i2 = -1.",
"Gaussian integers are a subset of the complex numbers, and the integers are the subset of Gaussian integers for which b = 0.",
"",
"A Gaussian integer unit is one for which a2 + b2 = 1, i.e. one of 1, i, -1, -i.",
"Let's define a proper Gaussian integer as one for which a > 0 and b  0.",
"",
"A Gaussian integer z1 = a1 + b1i is said to be divisible by z2 = a2 + b2i if z3 = a3 + b3i = z1/z2 is a Gaussian integer.",
"$\\frac {z_1} {z_2} = \\frac {a_1 + b_1 i} {a_2 + b_2 i} = \\frac {(a_1 + b_1 i)(a_2 - b_2 i)} {(a_2 + b_2 i)(a_2 - b_2 i)} = \\frac {a_1 a_2 + b_1 b_2} {a_2^2 + b_2^2} + \\frac {a_2 b_1 - a_1 b_2} {a_2^2 + b_2^2}i = a_3 + b_3 i$",
"So, z1 is divisible by z2 if $\\frac {a_1 a_2 + b_1 b_2} {a_2^2 + b_2^2}$ and $\\frac {a_2 b_1 - a_1 b_2} {a_2^2 + b_2^2}$ are integers.",
"For example, 2 is divisible by 1 + i because 2/(1 + i) = 1 - i is a Gaussian integer.",
"",
"A Gaussian prime is a Gaussian integer that is divisible only by a unit, itself or itself times a unit.",
"For example, 1 + 2i is a Gaussian prime, because it is only divisible by 1, i, -1, -i, 1 + 2i, i(1 + 2i) = i - 2, -(1 + 2i) = -1 - 2i and -i(1 + 2i) = 2 - i.",
"2 is not a Gaussian prime as it is divisible by 1 + i.",
"",
"A Gaussian integer can be uniquely factored as the product of a unit and proper Gaussian primes.",
"For example 2 = -i(1 + i)2 and 1 + 3i = (1 + i)(2 + i).",
"A Gaussian integer is said to be squarefree if its prime factorization does not contain repeated proper Gaussian primes.",
"So 2 is not squarefree over the Gaussian integers, but 1 + 3i is.",
"Units and Gaussian primes are squarefree by definition.",
"",
"Let f(n) be the count of proper squarefree Gaussian integers with a2 + b2  n.",
"For example f(10) = 7 because 1, 1 + i, 1 + 2i, 1 + 3i = (1 + i)(2 + i), 2 + i, 3 and 3 + i = -i(1 + i)(1 + 2i) are squarefree, while 2 = -i(1 + i)2 and 2 + 2i = -i(1 + i)3 are not.",
"You are given f(102) = 54, f(104) = 5218 and f(108) = 52126906.",
"",
"Find f(1014)."
]
},
{
"id": "5900feef58d9425c70af4f7f",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 557: Cutting triangles",
"tests": [
"assert.strictEqual(euler557(), TODO: MISSING ANSWER, 'message: <code>euler557()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler557() {",
" // Good luck!",
" return true;",
"}",
"",
"euler557();"
],
"description": [
"A triangle is cut into four pieces by two straight lines, each starting at one vertex and ending on the opposite edge. This results in forming three smaller triangular pieces, and one quadrilateral. If the original triangle has an integral area, it is often possible to choose cuts such that all of the four pieces also have integral area. For example, the diagram below shows a triangle of area 55 that has been cut in this way.",
"",
"",
"",
"Representing the areas as a, b, c and d, in the example above, the individual areas are a = 22, b = 8, c = 11 and d = 14. It is also possible to cut a triangle of area 55 such that a = 20, b = 2, c = 24, d = 9.",
"",
"Define a triangle cutting quadruple (a, b, c, d) as a valid integral division of a triangle, where a is the area of the triangle between the two cut vertices, d is the area of the quadrilateral and b and c are the areas of the two other triangles, with the restriction that b ≤ c. The two solutions described above are (22,8,11,14) and (20,2,24,9). These are the only two possible quadruples that have a total area of 55.",
"",
"",
"Define S(n) as the sum of the area of the uncut triangles represented by all valid quadruples with a+b+c+d ≤ n. For example, S(20) = 259. ",
"",
"",
"Find S(10000)."
]
},
{
"id": "5900fef058d9425c70af4f80",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 558: Irrational base",
"tests": [
"assert.strictEqual(euler558(), TODO: MISSING ANSWER, 'message: <code>euler558()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler558() {",
" // Good luck!",
" return true;",
"}",
"",
"euler558();"
],
"description": [
"Let r be the real root of the equation x3 = x2 + 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}$ bk rk",
"under the conditions that:bk is 0 or 1 for all k;bk + bk+1 + bk+2  1 for all k;w(n) = $\\displaystyle \\sum_{k=-\\infty}^{\\infty}$ bk is finite.",
"",
"Let S(m) = $\\displaystyle \\sum_{j=1}^{m}$ w(j2).",
"You are given S(10) = 61 and S(1000) = 19403.",
"",
"Find S(5 000 000)."
]
},
{
"id": "5900fef158d9425c70af4f81",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 559: Permuted Matrices",
"tests": [
"assert.strictEqual(euler559(), TODO: MISSING ANSWER, 'message: <code>euler559()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler559() {",
" // Good luck!",
" return true;",
"}",
"",
"euler559();"
],
"description": [
"An ascent of a column j in a matrix occurs if the value of column j is smaller than the value of column j+1 in all rows.",
"",
"Let P(k, r, n) be the number of r x n matrices with the following properties:",
"",
"The rows are permutations of {1, 2, 3, ... , n}.",
" Numbering the first column as 1, a column ascent occurs at column j<n if and only if j is not a multiple of k.",
"",
"For example, P(1, 2, 3) = 19, P(2, 4, 6) = 65508751 and P(7, 5, 30) mod 1000000123 = 161858102.",
"",
"Let Q(n) =$\\, \\displaystyle \\sum_{k=1}^n\\,$ P(k, n, n).",
"For example, Q(5) = 21879393751 and Q(50) mod 1000000123 = 819573537.",
"",
"Find Q(50000) mod 1000000123."
]
},
{
"id": "5900fef258d9425c70af4f82",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 560: Coprime Nim",
"tests": [
"assert.strictEqual(euler560(), TODO: MISSING ANSWER, 'message: <code>euler560()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler560() {",
" // Good luck!",
" return true;",
"}",
"",
"euler560();"
],
"description": [
"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(103, 103) mod 1 000 000 007 = 954021836.",
"",
"Find L(107, 107) mod 1 000 000 007"
]
},
{
"id": "5900fef358d9425c70af4f83",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 561: Divisor Pairs",
"tests": [
"assert.strictEqual(euler561(), TODO: MISSING ANSWER, 'message: <code>euler561()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler561() {",
" // Good luck!",
" return true;",
"}",
"",
"euler561();"
],
"description": [
"Let $S(n)$ be the number of pairs $(a,b)$ of distinct divisors of $n$ such that $a$ divides $b$.",
"For $n=6$ we get the following pairs: $(1,2), (1,3), (1,6),( 2,6)$ and $(3,6)$. So $S(6)=5$.",
"Let $p_m\\#$ be the product of the first $m$ prime numbers, so $p_2\\# = 2*3 = 6$.",
"Let $E(m, n)$ be the highest integer $k$ such that $2^k$ divides $S((p_m\\#)^n)$.",
"$E(2,1) = 0$ since $2^0$ is the highest power of 2 that divides S(6)=5.",
"Let $Q(n)=\\sum_{i=1}^{n} E(904961, i)$",
"$Q(8)=2714886$.",
"",
"",
"Evaluate $Q(10^{12})$."
]
},
{
"id": "5900fef458d9425c70af4f84",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 562: Maximal perimeter",
"tests": [
"assert.strictEqual(euler562(), TODO: MISSING ANSWER, 'message: <code>euler562()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler562() {",
" // Good luck!",
" return true;",
"}",
"",
"euler562();"
],
"description": [
"Construct triangle ABC such that:",
"Vertices A, B and C are lattice points inside or on the circle of radius r centered at the origin;",
"the triangle contains no other lattice point inside or on its edges;",
"the perimeter is maximum.Let R be the circumradius of triangle ABC and T(r) = R/r.",
"For r = 5, one possible triangle has vertices (-4,-3), (4,2) and (1,0) with perimeter $\\sqrt{13}+\\sqrt{34}+\\sqrt{89}$ and circumradius R = $\\sqrt {\\frac {19669} 2 }$, so T(5) =$\\sqrt {\\frac {19669} {50} }$.",
"You are given T(10) ~ 97.26729 and T(100) ~ 9157.64707.",
"",
"Find T(107). Give your answer rounded to the nearest integer."
]
},
{
"id": "5900fef558d9425c70af4f85",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 563: Robot Welders",
"tests": [
"assert.strictEqual(euler563(), TODO: MISSING ANSWER, 'message: <code>euler563()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler563() {",
" // Good luck!",
" return true;",
"}",
"",
"euler563();"
],
"description": [
"A company specialises in producing large rectangular metal sheets, starting from unit square metal plates. The welding is performed by a range of robots of increasing size. Unfortunately, the programming options of these robots are rather limited. Each one can only process up to 25 identical rectangles of metal, which they can weld along either edge to produce a larger rectangle. The only programmable variables are the number of rectangles to be processed (up to and including 25), and whether to weld the long or short edge.",
"",
"For example, the first robot could be programmed to weld together 11 raw unit square plates to make a 11×1 strip. The next could take 10 of these 11×1 strips, and weld them either to make a longer 110×1 strip, or a 11×10 rectangle. Many, but not all, possible dimensions of metal sheets can be constructed in this way.",
"",
"One regular customer has a particularly unusual order. He always demands that the finished product should have an exact area, and that the long side must not be more than 10% larger than the short side. If these requirements can be met in more than one way, in terms of the exact dimensions of the two sides, then he demands that all variants are produced. For example, if he were to ask for metal sheet of area 889200, then there are three final dimensions that can be produced: 900×988, 912×975 and 936×950. The target area of 889200 is the smallest area which can be manufactured in three different variants, within the limitations of the robot welders.",
"",
"Let M(n) be the minimal area that can be manufactured in exactly n variants with the longer edge not greater than 10% bigger than the shorter edge. Hence M(3) = 889200.",
"",
"Find $ \\sum_{n=2}^{100} M(n)$."
]
},
{
"id": "5900fef658d9425c70af4f86",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 564: Maximal polygons",
"tests": [
"assert.strictEqual(euler564(), TODO: MISSING ANSWER, 'message: <code>euler564()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler564() {",
" // Good luck!",
" return true;",
"}",
"",
"euler564();"
],
"description": [
"A line segment of length $2n-3$ is randomly split into $n$ segments of integer length ($n \\ge 3$). In the sequence given by this split, the segments are then used as consecutive sides of a convex $n$-polygon, formed in such a way that its area is maximal. All of the $\\binom{2n-4} {n-1}$ possibilities for splitting up the initial line segment occur with the same probability. ",
"",
"Let $E(n)$ be the expected value of the area that is obtained by this procedure.",
"For example, for $n=3$ the only possible split of the line segment of length $3$ results in three line segments with length $1$, that form an equilateral triangle with an area of $\\frac 1 4 \\sqrt{3}$. Therefore $E(3)=0.433013$, rounded to $6$ decimal places.",
"For $n=4$ you can find $4$ different possible splits, each of which is composed of three line segments with length $1$ and one line segment with length $2$. All of these splits lead to the same maximal quadrilateral with an area of $\\frac 3 4 \\sqrt{3}$, thus $E(4)=1.299038$, rounded to $6$ decimal places.",
"",
"Let $S(k)=\\displaystyle \\sum_{n=3}^k E(n)$.",
"For example, $S(3)=0.433013$, $S(4)=1.732051$, $S(5)=4.604767$ and $S(10)=66.955511$, rounded to $6$ decimal places each.",
"",
"Find $S(50)$, rounded to $6$ decimal places."
]
},
{
"id": "5900fef758d9425c70af4f87",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 565: Divisibility of sum of divisors",
"tests": [
"assert.strictEqual(euler565(), TODO: MISSING ANSWER, 'message: <code>euler565()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler565() {",
" // Good luck!",
" return true;",
"}",
"",
"euler565();"
],
"description": [
"Let $\\sigma(n)$ be the sum of the divisors of $n$.",
"E.g. the divisors of 4 are 1, 2 and 4, so $\\sigma(4)=7$.",
"",
"",
"The numbers $n$ not exceeding 20 such that 7 divides $\\sigma(n)$ are: 4,12,13 and 20, the sum of these numbers being 49.",
"",
"",
"Let $S(n , d)$ be the sum of the numbers $i$ not exceeding $n$ such that $d$ divides $\\sigma(i)$.",
"So $S(20 , 7)=49$.",
"",
"",
"",
"You are given: $S(10^6,2017)=150850429$ and $S(10^9 , 2017)=249652238344557$.",
"",
"",
"Find $S(10^{11} , 2017)$"
]
},
{
"id": "5900fef858d9425c70af4f88",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 566: Cake Icing Puzzle",
"tests": [
"assert.strictEqual(euler566(), TODO: MISSING ANSWER, 'message: <code>euler566()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler566() {",
" // Good luck!",
" return true;",
"}",
"",
"euler566();"
],
"description": [
"Adam plays the following game with his birthday cake.",
"",
"He cuts a piece forming a circular sector of 60 degrees and flips the piece upside down, with the icing on the bottom.",
"He then rotates the cake by 60 degrees counterclockwise, cuts an adjacent 60 degree piece and flips it upside down.",
"He keeps repeating this, until after a total of twelve steps, all the icing is back on top.",
"",
"Amazingly, this works for any piece size, even if the cutting angle is an irrational number: all the icing will be back on top after a finite number of steps.",
"",
"Now, Adam tries something different: he alternates cutting pieces of size $x=\\frac{360}{9}$ degrees, $y=\\frac{360}{10}$ degrees and $z=\\frac{360 }{\\sqrt{11}}$ degrees. The first piece he cuts has size x and he flips it. The second has size y and he flips it. The third has size z and he flips it. He repeats this with pieces of size x, y and z in that order until all the icing is back on top, and discovers he needs 60 flips altogether.",
"",
"",
"",
"Let F(a, b, c) be the minimum number of piece flips needed to get all the icing back on top for pieces of size $x=\\frac{360}{a}$ degrees, $y=\\frac{360}{b}$ degrees and $z=\\frac{360}{\\sqrt{c}}$ degrees.",
"Let $G(n) = \\sum_{9 \\le a < b < c \\le n} F(a,b,c)$, for integers a, b and c.",
"",
"You are given that F(9, 10, 11) = 60, F(10, 14, 16) = 506, F(15, 16, 17) = 785232.",
"You are also given G(11) = 60, G(14) = 58020 and G(17) = 1269260.",
"",
"Find G(53)."
]
},
{
"id": "5900fef958d9425c70af4f89",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 567: Reciprocal games I",
"tests": [
"assert.strictEqual(euler567(), TODO: MISSING ANSWER, 'message: <code>euler567()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler567() {",
" // Good luck!",
" return true;",
"}",
"",
"euler567();"
],
"description": [
"Tom has built a random generator that is connected to a row of $n$ light bulbs. Whenever the random generator is activated each of the $n$ lights is turned on with the probability of $\\frac 1 2$, independently of its former state or the state of the other light bulbs.",
"",
"While discussing with his friend Jerry how to use his generator, they invent two different games, they call the reciprocal games:",
"Both games consist of $n$ turns. Each turn is started by choosing a number $k$ randomly between (and including) $1$ and $n$, with equal probability of $\\frac 1 n$ for each number, while the possible win for that turn is the reciprocal of $k$, that is $\\frac 1 k$.",
"",
"In game A, Tom activates his random generator once in each turn. If the number of lights turned on is the same as the previously chosen number $k$, Jerry wins and gets $\\frac 1 k$, otherwise he will receive nothing for that turn. Jerry's expected win after playing the total game A consisting of $n$ turns is called $J_A(n)$. For example $J_A(6)=0.39505208$, rounded to 8 decimal places.",
"",
"For each turn in game B, after $k$ has been randomly selected, Tom keeps reactivating his random generator until exactly $k$ lights are turned on. After that Jerry takes over and reactivates the random generator until he, too, has generated a pattern with exactly $k$ lights turned on. If this pattern is identical to Tom's last pattern, Jerry wins and gets $\\frac 1 k$, otherwise he will receive nothing. Jerry's expected win after the total game B consisting of $n$ turns is called $J_B(n)$. For example $J_B(6)=0.43333333$, rounded to 8 decimal places.",
"",
"Let $\\displaystyle S(m)=\\sum_{n=1}^m (J_A(n)+J_B(n))$. For example $S(6)=7.58932292$, rounded to 8 decimal places.",
"",
"Find S(123456789), rounded to 8 decimal places."
]
},
{
"id": "5900fefa58d9425c70af4f8a",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 568: Reciprocal games II",
"tests": [
"assert.strictEqual(euler568(), TODO: MISSING ANSWER, 'message: <code>euler568()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler568() {",
" // Good luck!",
" return true;",
"}",
"",
"euler568();"
],
"description": [
"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.)"
]
},
{
"id": "5900fefb58d9425c70af4f8b",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 569: Prime Mountain Range",
"tests": [
"assert.strictEqual(euler569(), TODO: MISSING ANSWER, 'message: <code>euler569()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler569() {",
" // Good luck!",
" return true;",
"}",
"",
"euler569();"
],
"description": [
"A mountain range consists of a line of mountains with slopes of exactly 45°, and heights governed by the prime numbers, pn. The up-slope of the kth mountain is of height p2k1, and the downslope is p2k. The first few foot-hills of this range are illustrated below.",
"",
"",
"",
"",
"Tenzing sets out to climb each one in turn, starting from the lowest. At the top of each peak, he looks back and counts how many of the previous peaks he can see. In the example above, the eye-line from the third mountain is drawn in red, showing that he can only see the peak of the second mountain from this viewpoint. Similarly, from the 9th mountain, he can see three peaks, those of the 5th, 7th and 8th mountain.",
"",
"Let P(k) be the number of peaks that are visible looking back from the kth mountain. Hence P(3)=1 and P(9)=3.",
"Also $\\displaystyle \\sum_{k=1}^{100} P(k) = 227$.",
"",
"Find $\\displaystyle \\sum_{k=1}^{2500000} P(k)$."
]
},
{
"id": "5900fefc58d9425c70af4f8c",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 570: Snowflakes",
"tests": [
"assert.strictEqual(euler570(), TODO: MISSING ANSWER, 'message: <code>euler570()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler570() {",
" // Good luck!",
" return true;",
"}",
"",
"euler570();"
],
"description": [
"A snowflake of order n is formed by overlaying an equilateral triangle (rotated by 180 degrees) onto each equilateral triangle of the same size in a snowflake of order n-1. A snowflake of order 1 is a single equilateral triangle.",
"",
"",
"",
"",
"",
"",
"Some areas of the snowflake are overlaid repeatedly. In the above picture, blue represents the areas that are one layer thick, red two layers thick, yellow three layers thick, and so on. ",
"",
"For an order n snowflake, let A(n) be the number of triangles that are one layer thick, and let B(n) be the number of triangles that are three layers thick. Define G(n) = gcd(A(n), B(n)).",
"",
"E.g. A(3) = 30, B(3) = 6, G(3)=6",
"A(11) = 3027630, B(11) = 19862070, G(11) = 30",
"",
"Further, G(500) = 186 and $\\sum_{n=3}^{500}G(n)=5124$",
"",
"Find $\\displaystyle \\sum_{n=3}^{10^7}G(n)$."
]
},
{
"id": "5900fefd58d9425c70af4f8d",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 571: Super Pandigital Numbers",
"tests": [
"assert.strictEqual(euler571(), TODO: MISSING ANSWER, 'message: <code>euler571()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler571() {",
" // Good luck!",
" return true;",
"}",
"",
"euler571();"
],
"description": [
"A positive number is pandigital in base b if it contains all digits from 0 to b - 1 at least once when written in base b.",
"",
"A n-super-pandigital number is a number that is simultaneously pandigital in all bases from 2 to n inclusively.",
"For example 978 = 11110100102 = 11000203 = 331024 = 124035 is the smallest 5-super-pandigital number.",
"Similarly, 1093265784 is the smallest 10-super-pandigital number.",
"The sum of the 10 smallest 10-super-pandigital numbers is 20319792309.",
"",
"What is the sum of the 10 smallest 12-super-pandigital numbers?"
]
},
{
"id": "5900fefe58d9425c70af4f8e",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 572: Idempotent matrices",
"tests": [
"assert.strictEqual(euler572(), TODO: MISSING ANSWER, 'message: <code>euler572()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler572() {",
" // Good luck!",
" return true;",
"}",
"",
"euler572();"
],
"description": [
"A matrix $M$ is called idempotent if $M^2 = M$.",
"Let $M$ be a three by three matrix : ",
"$M=\\begin{pmatrix} ",
" a & b & c\\\\ ",
" d & e & f\\\\",
" g &h &i\\\\",
"\\end{pmatrix}$.",
"Let C(n) be the number of idempotent three by three matrices $M$ with integer elements such that",
"$ -n \\le a,b,c,d,e,f,g,h,i \\le n$.",
"",
"C(1)=164 and C(2)=848.",
"",
"",
"Find C(200)."
]
},
{
"id": "5900feff58d9425c70af4f8f",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 573: Unfair race",
"tests": [
"assert.strictEqual(euler573(), TODO: MISSING ANSWER, 'message: <code>euler573()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler573() {",
" // Good luck!",
" return true;",
"}",
"",
"euler573();"
],
"description": [
"$n$ runners in very different training states want to compete in a race. Each one of them is given a different starting number $k$ $(1\\leq k \\leq n)$ according to his (constant) individual racing speed being $v_k=\\frac{k}{n}$.",
"In order to give the slower runners a chance to win the race, $n$ different starting positions are chosen randomly (with uniform distribution) and independently from each other within the racing track of length $1$. After this, the starting position nearest to the goal is assigned to runner $1$, the next nearest starting position to runner $2$ and so on, until finally the starting position furthest away from the goal is assigned to runner $n$. The winner of the race is the runner who reaches the goal first.",
"",
"Interestingly, the expected running time for the winner is $\\frac{1}{2}$, independently of the number of runners. Moreover, while it can be shown that all runners will have the same expected running time of $\\frac{n}{n+1}$, the race is still unfair, since the winning chances may differ significantly for different starting numbers:",
"",
"Let $P_{n,k}$ be the probability for runner $k$ to win a race with $n$ runners and $E_n = \\sum_{k=1}^n k P_{n,k}$ be the expected starting number of the winner in that race. It can be shown that, for example,",
"$P_{3,1}=\\frac{4}{9}$, $P_{3,2}=\\frac{2}{9}$, $P_{3,3}=\\frac{1}{3}$ and $E_3=\\frac{17}{9}$ for a race with $3$ runners. ",
"You are given that $E_4=2.21875$, $E_5=2.5104$ and $E_{10}=3.66021568$.",
"",
"Find $E_{1000000}$ rounded to 4 digits after the decimal point."
]
},
{
"id": "5900ff0058d9425c70af4f90",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 574: Verifying Primes",
"tests": [
"assert.strictEqual(euler574(), TODO: MISSING ANSWER, 'message: <code>euler574()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler574() {",
" // Good luck!",
" return true;",
"}",
"",
"euler574();"
],
"description": [
"Let $q$ be a prime and $A \\ge B >0$ be two integers with the following properties:",
" $A$ and $B$ have no prime factor in common, that is $\\text{gcd}(A,B)=1$.",
" The product $AB$ is divisible by every prime less than q.",
"",
"It can be shown that, given these conditions, any sum $A+B<q^2$ and any difference $1<A-B<q^2$ has to be a prime number. Thus you can verify that a number $p$ is prime by showing that either $p=A+B<q^2$ or $p=A-B<q^2$ for some $A,B,q$ fulfilling the conditions listed above.",
"",
"Let $V(p)$ be the smallest possible value of $A$ in any sum $p=A+B$ and any difference $p=A-B$, that verifies $p$ being prime. Examples:",
"$V(2)=1$, since $2=1+1< 2^2$. ",
"$V(37)=22$, since $37=22+15=2 \\cdot 11+3 \\cdot 5< 7^2$ is the associated sum with the smallest possible $A$.",
"$V(151)=165$ since $151=165-14=3 \\cdot 5 \\cdot 11 - 2 \\cdot 7<13^2$ is the associated difference with the smallest possible $A$. ",
"",
"Let $S(n)$ be the sum of $V(p)$ for all primes $p<n$. For example, $S(10)=10$ and $S(200)=7177$.",
"",
"Find $S(3800)$."
]
},
{
"id": "5900ff0158d9425c70af4f91",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 575: Wandering Robots",
"tests": [
"assert.strictEqual(euler575(), TODO: MISSING ANSWER, 'message: <code>euler575()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler575() {",
" // Good luck!",
" return true;",
"}",
"",
"euler575();"
],
"description": [
"It was quite an ordinary day when a mysterious alien vessel appeared as if from nowhere. After waiting several hours and receiving no response it is decided to send a team to investigate, of which you are included. Upon entering the vessel you are met by a friendly holographic figure, Katharina, who explains the purpose of the vessel, Eulertopia.",
"",
"She claims that Eulertopia is almost older than time itself. Its mission was to take advantage of a combination of incredible computational power and vast periods of time to discover the answer to life, the universe, and everything. Hence the resident cleaning robot, Leonhard, along with his housekeeping responsibilities, was built with a powerful computational matrix to ponder the meaning of life as he wanders through a massive 1000 by 1000 square grid of rooms. She goes on to explain that the rooms are numbered sequentially from left to right, row by row. So, for example, if Leonhard was wandering around a 5 by 5 grid then the rooms would be numbered in the following way.",
"",
"",
"",
"",
"Many millennia ago Leonhard reported to Katharina to have found the answer and he is willing to share it with any life form who proves to be worthy of such knowledge.",
"",
"Katharina further explains that the designers of Leonhard were given instructions to program him with equal probability of remaining in the same room or travelling to an adjacent room. However, it was not clear to them if this meant (i) an equal probability being split equally between remaining in the room and the number of available routes, or, (ii) an equal probability (50%) of remaining in the same room and then the other 50% was to be split equally between the number of available routes.",
"",
"",
"",
"",
"(i) Probability of remaining related to number of exits",
"(ii) Fixed 50% probability of remaining",
"",
"",
"The records indicate that they decided to flip a coin. Heads would mean that the probability of remaining was dynamically related to the number of exits whereas tails would mean that they program Leonhard with a fixed 50% probability of remaining in a particular room. Unfortunately there is no record of the outcome of the coin, so without further information we would need to assume that there is equal probability of either of the choices being implemented.",
"",
"Katharina suggests it should not be too challenging to determine that the probability of finding him in a square numbered room in a 5 by 5 grid after unfathomable periods of time would be approximately 0.177976190476 [12 d.p.].",
"",
"In order to prove yourself worthy of visiting the great oracle you must calculate the probability of finding him in a square numbered room in the 1000 by 1000 lair in which he has been wandering.",
"(Give your answer rounded to 12 decimal places)"
]
},
{
"id": "5900ff0258d9425c70af4f92",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 576: Irrational jumps",
"tests": [
"assert.strictEqual(euler576(), TODO: MISSING ANSWER, 'message: <code>euler576()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler576() {",
" // Good luck!",
" return true;",
"}",
"",
"euler576();"
],
"description": [
"A bouncing point moves counterclockwise along a circle with circumference $1$ with jumps of constant length $l<1$, until it hits a gap of length $g<1$, that is placed in a distance $d$ counterclockwise from the starting point. The gap does not include the starting point, that is $g+d<1$.",
"",
"Let $S(l,g,d)$ be the sum of the length of all jumps, until the point falls into the gap. It can be shown that $S(l,g,d)$ is finite for any irrational jump size $l$, regardless of the values of $g$ and $d$.",
"Examples: ",
"$S(\\sqrt{\\frac 1 2}, 0.06, 0.7)=0.7071 \\dots$, $S(\\sqrt{\\frac 1 2}, 0.06, 0.3543)=1.4142 \\dots$ and $S(\\sqrt{\\frac 1 2}, 0.06, 0.2427)=16.2634 \\dots$.",
"",
"Let $M(n, g)$ be the maximum of $ \\sum S(\\sqrt{\\frac 1 p}, g, d)$ for all primes $p \\le n$ and any valid value of $d$.",
"Examples:",
"$M(3, 0.06) =29.5425 \\dots$, since $S(\\sqrt{\\frac 1 2}, 0.06, 0.2427)+S(\\sqrt{\\frac 1 3}, 0.06, 0.2427)=29.5425 \\dots$ is the maximal reachable sum for $g=0.06$. ",
"$M(10, 0.01)=266.9010 \\dots$ ",
"",
"Find $M(100, 0.00002)$, rounded to 4 decimal places."
]
},
{
"id": "5900ff0358d9425c70af4f93",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 577: Counting hexagons",
"tests": [
"assert.strictEqual(euler577(), TODO: MISSING ANSWER, 'message: <code>euler577()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler577() {",
" // Good luck!",
" return true;",
"}",
"",
"euler577();"
],
"description": [
"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)$."
]
},
{
"id": "5900ff0458d9425c70af4f94",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 578: Integers with decreasing prime powers",
"tests": [
"assert.strictEqual(euler578(), TODO: MISSING ANSWER, 'message: <code>euler578()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler578() {",
" // Good luck!",
" return true;",
"}",
"",
"euler578();"
],
"description": [
"Any positive integer can be written as a product of prime powers: p1a1 × p2a2 × ... × pkak,",
"where pi are distinct prime integers, ai > 0 and pi < pj if i < j.",
"",
"A decreasing prime power positive integer is one for which ai  aj if i < j.",
"For example, 1, 2, 15=3×5, 360=23×32×5 and 1000=23×53 are decreasing prime power integers.",
"",
"Let C(n) be the count of decreasing prime power positive integers not exceeding n.",
"C(100) = 94 since all positive integers not exceeding 100 have decreasing prime powers except 18, 50, 54, 75, 90 and 98.",
"You are given C(106) = 922052.",
"",
"Find C(1013)."
]
},
{
"id": "5900ff0558d9425c70af4f95",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 579: Lattice points in lattice cubes",
"tests": [
"assert.strictEqual(euler579(), TODO: MISSING ANSWER, 'message: <code>euler579()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler579() {",
" // Good luck!",
" return true;",
"}",
"",
"euler579();"
],
"description": [
"A lattice cube is a cube in which all vertices have integer coordinates. Let C(n) be the number of different lattice cubes in which the coordinates of all vertices range between (and including) 0 and n. Two cubes are hereby considered different if any of their vertices have different coordinates.",
"For example, C(1)=1, C(2)=9, C(4)=100, C(5)=229, C(10)=4469 and C(50)=8154671.",
"",
"Different cubes may contain different numbers of lattice points.",
"",
"For example, the cube with the vertices",
"(0, 0, 0), (3, 0, 0), (0, 3, 0), (0, 0, 3), (0, 3, 3), (3, 0, 3), (3, 3, 0), (3, 3, 3) contains 64 lattice points (56 lattice points on the surface including the 8 vertices and 8 points within the cube). ",
"In contrast, the cube with the vertices",
"(0, 2, 2), (1, 4, 4), (2, 0, 3), (2, 3, 0), (3, 2, 5), (3, 5, 2), (4, 1, 1), (5, 3, 3) contains only 40 lattice points (20 points on the surface and 20 points within the cube), although both cubes have the same side length 3.",
"",
"",
"Let S(n) be the sum of the lattice points contained in the different lattice cubes in which the coordinates of all vertices range between (and including) 0 and n.",
"",
"For example, S(1)=8, S(2)=91, S(4)=1878, S(5)=5832, S(10)=387003 and S(50)=29948928129.",
"",
"Find S(5000) mod 109."
]
},
{
"id": "5900ff0658d9425c70af4f96",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 580: Squarefree Hilbert numbers",
"tests": [
"assert.strictEqual(euler580(), TODO: MISSING ANSWER, 'message: <code>euler580()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler580() {",
" // Good luck!",
" return true;",
"}",
"",
"euler580();"
],
"description": [
"A Hilbert number is any positive integer of the form $4k+1$ for integer $k\\geq 0$. We shall define a squarefree Hilbert number as a Hilbert number which is not divisible by the square of any Hilbert number other than one. For example, $117$ is a squarefree Hilbert number, equaling $9\\times13$. However $6237$ is a Hilbert number that is not squarefree in this sense, as it is divisible by $9^2$. The number $3969$ is also not squarefree, as it is divisible by both $9^2$ and $21^2$. ",
"",
"",
"There are $2327192$ squarefree Hilbert numbers below $10^7$. ",
"How many squarefree Hilbert numbers are there below $10^{16}$?"
]
},
{
"id": "5900ff0758d9425c70af4f97",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 581: 47-smooth triangular numbers",
"tests": [
"assert.strictEqual(euler581(), TODO: MISSING ANSWER, 'message: <code>euler581()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler581() {",
" // Good luck!",
" return true;",
"}",
"",
"euler581();"
],
"description": [
"A number is p-smooth if it has no prime factors larger than p.",
"Let T be the sequence of triangular numbers, ie T(n)=n(n+1)/2.",
"Find the sum of all indices n such that T(n) is 47-smooth."
]
},
{
"id": "5900ff0858d9425c70af4f98",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 582: Nearly isosceles 120 degree triangles",
"tests": [
"assert.strictEqual(euler582(), TODO: MISSING ANSWER, 'message: <code>euler582()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler582() {",
" // Good luck!",
" return true;",
"}",
"",
"euler582();"
],
"description": [
"Let a, b and c be the sides of an integer sided triangle with one angle of 120 degrees, a≤b≤c and b-a≤100.",
"Let T(n) be the number of such triangles with c≤n.",
"T(1000)=235 and T(108)=1245.",
"Find T(10100)."
]
},
{
"id": "5900ff0958d9425c70af4f99",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 583: Heron Envelopes",
"tests": [
"assert.strictEqual(euler583(), TODO: MISSING ANSWER, 'message: <code>euler583()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler583() {",
" // Good luck!",
" return true;",
"}",
"",
"euler583();"
],
"description": [
"A standard envelope shape is a convex figure consisting of an isosceles triangle (the flap) placed on top of a rectangle. An example of an envelope with integral sides is shown below. Note that to form a sensible envelope, the perpendicular height of the flap (BCD) must be smaller than the height of the rectangle (ABDE). ",
"",
"",
"",
"",
"",
"",
"In the envelope illustrated, not only are all the sides integral, but also all the diagonals (AC, AD, BD, BE and CE) are integral too. Let us call an envelope with these properties a Heron envelope.",
"",
"",
"",
"Let S(p) be the sum of the perimeters of all the Heron envelopes with a perimeter less than or equal to p. ",
"",
"",
"You are given that S(104) = 884680. Find S(107)."
]
},
{
"id": "5900ff0a58d9425c70af4f9a",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 584: Birthday Problem Revisited",
"tests": [
"assert.strictEqual(euler584(), TODO: MISSING ANSWER, 'message: <code>euler584()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler584() {",
" // Good luck!",
" return true;",
"}",
"",
"euler584();"
],
"description": [
"A long long time ago in a galaxy far far away, the Wimwians, inhabitants of planet WimWi, discovered an unmanned drone that had landed on their planet. On examining the drone, they uncovered a device that sought the answer for the so called \"Birthday Problem\". The description of the problem was as follows:",
"",
"If people on your planet were to enter a very large room one by one, what will be the expected number of people in the room when you first find 3 people with Birthdays within 1 day from each other.",
"",
"The description further instructed them to enter the answer into the device and send the drone into space again. Startled by this turn of events, the Wimwians consulted their best mathematicians. Each year on Wimwi has 10 days and the mathematicians assumed equally likely birthdays and ignored leap years (leap years in Wimwi have 11 days), and found 5.78688636 to be the required answer. As such, the Wimwians entered this answer and sent the drone back into space.",
"",
"",
"After traveling light years away, the drone then landed on planet Joka. The same events ensued except this time, the numbers in the device had changed due to some unknown technical issues. The description read:",
"",
"If people on your planet were to enter a very large room one by one, what will be the expected number of people in the room when you first find 3 people with Birthdays within 7 days from each other.",
"",
"With a 100-day year on the planet, the Jokars (inhabitants of Joka) found the answer to be 8.48967364 (rounded to 8 decimal places because the device allowed only 8 places after the decimal point) assuming equally likely birthdays. They too entered the answer into the device and launched the drone into space again.",
"",
"",
"This time the drone landed on planet Earth. As before the numbers in the problem description had changed. It read:",
"",
"If people on your planet were to enter a very large room one by one, what will be the expected number of people in the room when you first find 4 people with Birthdays within 7 days from each other.",
"",
"What would be the answer (rounded to eight places after the decimal point) the people of Earth have to enter into the device for a year with 365 days? Ignore leap years. Also assume that all birthdays are equally likely and independent of each other."
]
},
{
"id": "5900ff0b58d9425c70af4f9b",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 585: Nested square roots",
"tests": [
"assert.strictEqual(euler585(), TODO: MISSING ANSWER, 'message: <code>euler585()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler585() {",
" // Good luck!",
" return true;",
"}",
"",
"euler585();"
],
"description": [
"Consider the term $\\small \\sqrt{x+\\sqrt{y}+\\sqrt{z}}$ that is representing a nested square root. $x$, $y$ and $z$ are positive integers and $y$ and $z$ are not allowed to be perfect squares, so the number below the outer square root is irrational. Still it can be shown that for some combinations of $x$, $y$ and $z$ the given term can be simplified into a sum and/or difference of simple square roots of integers, actually denesting the square roots in the initial expression. ",
"",
"Here are some examples of this denesting:",
"$\\small \\sqrt{3+\\sqrt{2}+\\sqrt{2}}=\\sqrt{2}+\\sqrt{1}=\\sqrt{2}+1$",
"$\\small \\sqrt{8+\\sqrt{15}+\\sqrt{15}}=\\sqrt{5}+\\sqrt{3}$",
"$\\small \\sqrt{20+\\sqrt{96}+\\sqrt{12}}=\\sqrt{9}+\\sqrt{6}+\\sqrt{3}-\\sqrt{2}=3+\\sqrt{6}+\\sqrt{3}-\\sqrt{2}$",
"$\\small \\sqrt{28+\\sqrt{160}+\\sqrt{108}}=\\sqrt{15}+\\sqrt{6}+\\sqrt{5}-\\sqrt{2}$",
"As you can see the integers used in the denested expression may also be perfect squares resulting in further simplification.",
"",
"Let F($n$) be the number of different terms $\\small \\sqrt{x+\\sqrt{y}+\\sqrt{z}}$, that can be denested into the sum and/or difference of a finite number of square roots, given the additional condition that $0<x \\le n$. That is,",
"$\\small \\displaystyle \\sqrt{x+\\sqrt{y}+\\sqrt{z}}=\\sum_{i=1}^k s_i\\sqrt{a_i}$",
"with $k$, $x$, $y$, $z$ and all $a_i$ being positive integers, all $s_i =\\pm 1$ and $x\\le n$. Furthermore $y$ and $z$ are not allowed to be perfect squares.",
"",
"Nested roots with the same value are not considered different, for example $\\small \\sqrt{7+\\sqrt{3}+\\sqrt{27}}$, $\\small \\sqrt{7+\\sqrt{12}+\\sqrt{12}}$ and $\\small \\sqrt{7+\\sqrt{27}+\\sqrt{3}}$, that can all three be denested into $\\small 2+\\sqrt{3}$, would only be counted once.",
"",
"You are given that F(10)=17, F(15)=46, F(20)=86, F(30)=213 and F(100)=2918 and F(5000)=11134074.",
"Find F(5000000)."
]
},
{
"id": "5900ff0c58d9425c70af4f9c",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 586: Binary Quadratic Form",
"tests": [
"assert.strictEqual(euler586(), TODO: MISSING ANSWER, 'message: <code>euler586()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler586() {",
" // Good luck!",
" return true;",
"}",
"",
"euler586();"
],
"description": [
"The number 209 can be expressed as $a^2 + 3ab + b^2$ in two distinct ways:",
"",
"",
"$ \\qquad 209 = 8^2 + 3\\cdot 8\\cdot 5 + 5^2$ ",
"$ \\qquad 209 = 13^2 + 3\\cdot13\\cdot 1 + 1^2$",
"",
"",
"Let $f(n,r)$ be the number of integers $k$ not exceeding $n$ that can be expressed as $k=a^2 + 3ab + b^2$, with $a\\gt b>0$ integers, in exactly $r$ different ways.",
"",
"",
"You are given that $f(10^5, 4) = 237$ and $f(10^8, 6) = 59517$.",
"",
"",
"Find $f(10^{15}, 40)$."
]
},
{
"id": "5900ff0d58d9425c70af4f9d",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 587: Concave triangle",
"tests": [
"assert.strictEqual(euler587(), TODO: MISSING ANSWER, 'message: <code>euler587()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler587() {",
" // Good luck!",
" return true;",
"}",
"",
"euler587();"
],
"description": [
"A square is drawn around a circle as shown in the diagram below on the left.",
"We shall call the blue shaded region the L-section.",
"A line is drawn from the bottom left of the square to the top right as shown in the diagram on the right.",
"We shall call the orange shaded region a concave triangle.",
"",
"",
"",
"",
"It should be clear that the concave triangle occupies exactly half of the L-section.",
"",
"",
"",
"Two circles are placed next to each other horizontally, a rectangle is drawn around both circles, and a line is drawn from the bottom left to the top right as shown in the diagram below.",
"",
"",
"",
"",
"This time the concave triangle occupies approximately 36.46% of the L-section.",
"",
"",
"If n circles are placed next to each other horizontally, a rectangle is drawn around the n circles, and a line is drawn from the bottom left to the top right, then it can be shown that the least value of n for which the concave triangle occupies less than 10% of the L-section is n = 15.",
"",
"",
"What is the least value of n for which the concave triangle occupies less than 0.1% of the L-section?"
]
},
{
"id": "5900ff0e58d9425c70af4f9e",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 588: Quintinomial coefficients",
"tests": [
"assert.strictEqual(euler588(), TODO: MISSING ANSWER, 'message: <code>euler588()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler588() {",
" // Good luck!",
" return true;",
"}",
"",
"euler588();"
],
"description": [
"The coefficients in the expansion of $(x+1)^k$ are called binomial coefficients.",
"Analoguously the coefficients in the expansion of $(x^4+x^3+x^2+x+1)^k$ are called quintinomial coefficients. (quintus= Latin for fifth).",
"",
"",
"Consider the expansion of $(x^4+x^3+x^2+x+1)^3$:",
"$x^{12}+3x^{11}+6x^{10}+10x^9+15x^8+18x^7+19x^6+18x^5+15x^4+10x^3+6x^2+3x+1$",
"As we can see 7 out of the 13 quintinomial coefficients for $k=3$ are odd.",
"",
"",
"Let $Q(k)$ be the number of odd coefficients in the expansion of $(x^4+x^3+x^2+x+1)^k$.",
"So $Q(3)=7$.",
"",
"",
"You are given $Q(10)=17$ and $Q(100)=35$.",
"",
"Find $\\sum_{k=1}^{18}Q(10^k) $."
]
},
{
"id": "5900ff0f58d9425c70af4f9f",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 589: Poohsticks Marathon",
"tests": [
"assert.strictEqual(euler589(), TODO: MISSING ANSWER, 'message: <code>euler589()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler589() {",
" // Good luck!",
" return true;",
"}",
"",
"euler589();"
],
"description": [
"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."
]
},
{
"id": "5900ff1058d9425c70af4fa0",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 590: Sets with a given Least Common Multiple",
"tests": [
"assert.strictEqual(euler590(), TODO: MISSING ANSWER, 'message: <code>euler590()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler590() {",
" // Good luck!",
" return true;",
"}",
"",
"euler590();"
],
"description": [
"Let H(n) denote the number of sets of positive integers such that the least common multiple of the integers in the set equals n.",
"E.g.:",
"The integers in the following ten sets all have a least common multiple of 6:",
"{2,3}, {1,2,3}, {6}, {1,6}, {2,6} ,{1,2,6}, {3,6}, {1,3,6}, {2,3,6} and {1,2,3,6}.",
"Thus H(6)=10.",
"",
"",
"Let L(n) denote the least common multiple of the numbers 1 through n.",
"E.g. L(6) is the least common multiple of the numbers 1,2,3,4,5,6 and L(6) equals 60.",
"",
"",
"Let HL(n) denote H(L(n)).",
"You are given HL(4)=H(12)=44.",
"",
"",
"Find HL(50000). Give your answer modulo 109."
]
},
{
"id": "5900ff1158d9425c70af4fa1",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 591: Best Approximations by Quadratic Integers",
"tests": [
"assert.strictEqual(euler591(), TODO: MISSING ANSWER, 'message: <code>euler591()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler591() {",
" // Good luck!",
" return true;",
"}",
"",
"euler591();"
],
"description": [
"Given a non-square integer $d$, any real $x$ can be approximated arbitrarily close by quadratic integers $a+b\\sqrt{d}$, where $a,b$ are integers. For example, the following inequalities approximate $\\pi$ with precision $10^{-13}$:",
"$$4375636191520\\sqrt{2}-6188084046055 < \\pi < 721133315582\\sqrt{2}-1019836515172 $$ ",
"We call $BQA_d(x,n)$ the quadratic integer closest to $x$ with the absolute values of $a,b$ not exceeding $n$. We also define the integral part of a quadratic integer as $I_d(a+b\\sqrt{d}) = a$.",
"",
"You are given that:",
"$BQA_2(\\pi,10) = 6 - 2\\sqrt{2}$",
"$BQA_5(\\pi,100)=26\\sqrt{5}-55$",
"$BQA_7(\\pi,10^6)=560323 - 211781\\sqrt{7}$",
"$I_2(BQA_2(\\pi,10^{13}))=-6188084046055$Find the sum of $|I_d(BQA_d(\\pi,10^{13}))|$ for all non-square positive integers less than 100."
]
},
{
"id": "5900ff1258d9425c70af4fa2",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 592: Factorial trailing digits 2",
"tests": [
"assert.strictEqual(euler592(), TODO: MISSING ANSWER, 'message: <code>euler592()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler592() {",
" // Good luck!",
" return true;",
"}",
"",
"euler592();"
],
"description": [
"For any N, let f(N) be the last twelve hexadecimal digits before the trailing zeroes in N!.",
"",
"For example, the hexadecimal representation of 20! is 21C3677C82B40000,",
"so f(20) is the digit sequence 21C3677C82B4.",
"",
"Find f(20!). Give your answer as twelve hexadecimal digits, using uppercase for the digits A to F."
]
},
{
"id": "5900ff1358d9425c70af4fa3",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 593: Fleeting Medians",
"tests": [
"assert.strictEqual(euler593(), TODO: MISSING ANSWER, 'message: <code>euler593()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler593() {",
" // Good luck!",
" return true;",
"}",
"",
"euler593();"
],
"description": [
"We define two sequences $S = \\{S(1), S(2), ..., S(n)\\}$ and $S_2 = \\{S_2(1), S_2(2), ..., S_2(n)\\}$:",
"",
"$S(k) = (p_k)^k$ mod $10007$ where $p_k$ is the $k$th prime number.",
"",
"$S_2(k) = S(k) + S(\\lfloor\\frac{k}{10000}\\rfloor + 1)$ where $\\lfloor \\cdot \\rfloor$ denotes the floor function.",
"",
"Then let $M(i, j)$ be the median of elements $S_2(i)$ through $S_2(j)$, inclusive. For example, $M(1, 10) = 2021.5$ and $M(10^2, 10^3) = 4715.0$.",
"",
"Let $F(n, k) = \\sum_{i=1}^{n-k+1} M(i, i + k - 1)$. For example, $F(100, 10) = 463628.5$ and $F(10^5, 10^4) = 675348207.5$.",
"",
"Find $F(10^7, 10^5)$. If the sum is not an integer, use $.5$ to denote a half. Otherwise, use $.0$ instead."
]
},
{
"id": "5900ff1458d9425c70af4fa4",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 594: Rhombus Tilings",
"tests": [
"assert.strictEqual(euler594(), TODO: MISSING ANSWER, 'message: <code>euler594()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler594() {",
" // Good luck!",
" return true;",
"}",
"",
"euler594();"
],
"description": [
"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})$."
]
},
{
"id": "5900ff1558d9425c70af4fa5",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 595: Incremental Random Sort",
"tests": [
"assert.strictEqual(euler595(), TODO: MISSING ANSWER, 'message: <code>euler595()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler595() {",
" // Good luck!",
" return true;",
"}",
"",
"euler595();"
],
"description": [
"A deck of cards numbered from 1 to n is shuffled randomly such that each permutation is equally likely.",
"",
"",
"The cards are to be sorted into ascending order using the following technique:",
" Look at the initial sequence of cards. If it is already sorted, then there is no need for further action. Otherwise, if any subsequences of cards happen to be in the correct place relative to one another (ascending with no gaps), then those subsequences are fixed by attaching the cards together. For example, with 7 cards initially in the order 4123756, the cards labelled 1, 2 and 3 would be attached together, as would 5 and 6.",
" The cards are 'shuffled' by being thrown into the air, but note that any correctly sequenced cards remain attached, so their orders are maintained. The cards (or bundles of attached cards) are then picked up randomly. You should assume that this randomisation is unbiased, despite the fact that some cards are single, and others are grouped together. ",
" Repeat steps 1 and 2 until the cards are sorted. ",
"",
" Let S(n) be the expected number of shuffles needed to sort the cards. Since the order is checked before the first shuffle, S(1) = 0. You are given that S(2) = 1, and S(5) = 4213/871.",
"",
"",
"Find S(52), and give your answer rounded to 8 decimal places."
]
},
{
"id": "5900ff1658d9425c70af4fa6",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 596: Number of lattice points in a hyperball",
"tests": [
"assert.strictEqual(euler596(), TODO: MISSING ANSWER, 'message: <code>euler596()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler596() {",
" // Good luck!",
" return true;",
"}",
"",
"euler596();"
],
"description": [
"Let T(r) be the number of integer quadruplets x, y, z, t such that x2 + y2 + z2 + t2 ≤ r2. In other words, T(r) is the number of lattice points in the four-dimensional hyperball of radius r.",
"",
"You are given that T(2) = 89, T(5) = 3121, T(100) = 493490641 and T(104) = 49348022079085897.",
"",
"Find T(108) mod 1000000007."
]
},
{
"id": "5900ff1758d9425c70af4fa7",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 597: Torpids",
"tests": [
"assert.strictEqual(euler597(), TODO: MISSING ANSWER, 'message: <code>euler597()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler597() {",
" // Good luck!",
" return true;",
"}",
"",
"euler597();"
],
"description": [
"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."
]
},
{
"id": "5900ff1858d9425c70af4fa8",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 598: Split Divisibilities",
"tests": [
"assert.strictEqual(euler598(), TODO: MISSING ANSWER, 'message: <code>euler598()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler598() {",
" // Good luck!",
" return true;",
"}",
"",
"euler598();"
],
"description": [
"Consider the number 48.",
"There are five pairs of integers $a$ and $b$ ($a \\leq b$) such that $a \\times b=48$: (1,48), (2,24), (3,16), (4,12) and (6,8).",
"It can be seen that both 6 and 8 have 4 divisors.",
"So of those five pairs one consists of two integers with the same number of divisors.",
"",
"In general:",
"Let $C(n)$ be the number of pairs of positive integers $a \\times b=n$, ($a \\leq b$) such that $a$ and $b$ have the same number of divisors; so $C(48)=1$.",
"",
"",
"You are given $C(10!)=3$: (1680, 2160), (1800, 2016) and (1890,1920). ",
"Find $C(100!)$"
]
},
{
"id": "5900ff1958d9425c70af4fa9",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 599: Distinct Colourings of a Rubik's Cube",
"tests": [
"assert.strictEqual(euler599(), TODO: MISSING ANSWER, 'message: <code>euler599()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler599() {",
" // Good luck!",
" return true;",
"}",
"",
"euler599();"
],
"description": [
"The well-known Rubik's Cube puzzle has many fascinating mathematical properties. The 2×2×2 variant has 8 cubelets with a total of 24 visible faces, each with a coloured sticker. Successively turning faces will rearrange the cubelets, although not all arrangements of cubelets are reachable without dismantling the puzzle.",
"",
"",
"Suppose that we wish to apply new stickers to a 2×2×2 Rubik's cube in a non-standard colouring. Specifically, we have $n$ different colours available (with an unlimited supply of stickers of each colour), and we place one sticker on each of the 24 faces in any arrangement that we please. We are not required to use all the colours, and if desired the same colour may appear in more than one face of a single cubelet.",
"",
"",
"We say that two such colourings $c_1,c_2$ are essentially distinct if a cube coloured according to $c_1$ cannot be made to match a cube coloured according to $c_2$ by performing mechanically possible Rubik's Cube moves.",
"",
"",
"For example, with two colours available, there are 183 essentially distinct colourings.",
"",
"",
"How many essentially distinct colourings are there with 10 different colours available?"
]
},
{
"id": "5900ff1a58d9425c70af4faa",
"challengeType": 5,
"type": "bonfire",
"title": "Problem 600: Integer sided equiangular hexagons",
"tests": [
"assert.strictEqual(euler600(), TODO: MISSING ANSWER, 'message: <code>euler600()</code> should return TODO: MISSING ANSWER.');"
],
"solutions": [],
"translations": {},
"challengeSeed": [
"function euler600() {",
" // Good luck!",
" return true;",
"}",
"",
"euler600();"
],
"description": [
"Let H(n) be the number of distinct integer sided equiangular convex hexagons with perimeter not exceeding n.",
"Hexagons are distinct if and only if they are not congruent.",
"",
"You are given H(6) = 1, H(12) = 10, H(100) = 31248.",
"Find H(55106).",
"",
"",
"Equiangular hexagons with perimeter not exceeding 12"
]
}
]