Project Euler
From charlesreid1
Grid 0: Problems 1-99
- Problem 1- Multiples of 3 and 5 - printing out all multiples of 3 and 5.
- Problem 2 - Even Fibonacci - summing the Fibonacci numbers that are even and less than 4 million
- Problem 3 - Largest Prime Factor - Largest prime factor of a given 12-digit number
- Problem 4 - Largest Palindrome Product - Largest palindrome product (extracting substrings and sorting)
- Problem 5 - LCM - Least common multiple of all the integers from 1 to 20
- Problem 6 - SoS - Sum of squares and squares of sums
- Problem 7 - Ten Thousand Primes - Find the 10,001st prime.
- Problem 8 - Adjacent Digits - Largest product formed by 13 adjacent digits.
- Problem 9 - Pythagorean Triplet Sum - Finding a Pythagorean triplet with a specified sum.
- Problem 10 Sum of Primes - Sum of all primes below 2 million.
- Problem 11 - Greatest Product in Grid - Finding the greatest product of 4 numbers on a grid.
- Problem 12 - Highly Factorable Triangular Numbers - Finding highly factorable triangular numbers
- Problem 13 - Sum of Big Numbers - Work out the first 10 digits of a sum of 100 50-digit numbers
- Problem 14 - Longest Collatz Sequence - Finding the longest Collatz sequence for starting integers under 1 million
- Problem 15 - Lattice Paths - Finding the number of variations on a route through a lattice.
- Problem 16 - Summing the Digits - summing up the digits of a large power of 2, 2**1000
- Problem 17 - Number Spelling - spelling out all the numbers from one to a thousand
- Problem 18 - Shortest Path through a Triangle - find the path through a triangle of numbers that leads to the smallest sum
- Problem 19 - Counting Sundays
- Problem 20 - Factorial Digit Sum - Sum of the digits in the number 100!
- Problem 21 - Amicable Numbers - Sum of all amicable numbers under 10000
- Problem 22 - Names Scores - Sort 5000+ names alphabetically and compute name scores
- Problem 23 - Non-Abundant Sums - Sum of all positive integers not expressible as the sum of two abundant numbers
- Problem 24 - Lexicographic Permutations - Find the millionth lexicographic permutation of the digits 0-9
- Problem 25 - 1000-digit Fibonacci Number - Index of the first term in the Fibonacci sequence to contain 1000 digits
- Problem 26 - Reciprocal Cycles - Find d<1000 for which 1/d contains the longest recurring cycle
- Problem 27 - Quadratic Primes - Find the quadratic formula n²+an+b producing the most consecutive primes
- Problem 28 - Number Spiral Diagonals
- Problem 29 - Distinct Terms Generated by Powers
- Problem 30 - Sum of Fifth Power of Digits
- Problem 31 - Polya - Change for a Dollar
- Problem 32 - Pandigital Products (A X B = C covering all 9 digits)
- Problem 33 - Digit Cancelling Fractions - Find the product of the four non-trivial curious fractions where cancelling a common digit gives the correct simplified value.
- Problem 34 - Digit Factorials - Find the sum of all numbers equal to the sum of the factorial of their digits.
- Problem 35 - Circular Primes - Count how many circular primes are there below one million.
- Problem 36 - Double-base Palindromes - Find the sum of all numbers below one million that are palindromic in both base 10 and base 2.
- Problem 37 - Truncatable Primes - Find the sum of the only eleven primes that are truncatable from left to right and right to left.
- Problem 38 - Pandigital Multiples - Find the largest 1-to-9 pandigital number that can be formed as the concatenated product of an integer with (1,2,...,n).
- Problem 39 - Integer Right Triangles - Find the perimeter p ≤ 1000 for which the number of integer-sided right triangles is maximised.
- Problem 40 - Champernowne's Constant - Find the product of digits at specific positions in the fractional part of Champernowne's constant.
- Problem 41 - Pandigital Prime - Find the largest n-digit pandigital prime that exists.
- Problem 42 - Coded Triangle Numbers - Count how many words in a given list are triangle words (where word value equals a triangle number).
- Problem 43 - Sub-string Divisibility - Find the sum of all pandigital numbers with an unusual substring divisibility property.
- Problem 44 - Pentagon Numbers - Find the pair of pentagonal numbers whose sum and difference are pentagonal, minimising their difference.
- Problem 45 - Triangular, Pentagonal, and Hexagonal - Find the next triangle number that is also pentagonal and hexagonal after 40755.
- Problem 46 - Goldbach's Other Conjecture - Find the smallest odd composite that cannot be written as the sum of a prime and twice a square.
- Problem 47 - Distinct Primes Factors - Find the first four consecutive integers to have four distinct prime factors each.
- Problem 48 - Self Powers - Find the last ten digits of the sum 1^1 + 2^2 + ... + 1000^1000.
- Problem 49 - Prime Permutations - Find the 12-digit number formed by concatenating three 4-digit primes that are permutations and form an arithmetic sequence.
- Problem 50 - Consecutive Prime Sum - Find the prime below one million that can be written as the sum of the most consecutive primes.
- Problem 51- Prime Replacement - Finding the number of primes that can be formed by replacing particular digits of a number
- Problem 52- Permuted Multiples - Find a number whose multiples 2x, 3x, 4x, 5x ad 6x are permutations of one another.
- Problem 53 - Number of Combinations Over 1M - Find how many different n choose r values are greater than 1 million for n between 1 and 100.
- Problem 54 - Comparing poker hands to determine a winner
- Problem 55
- Problem 56
- Problem 57
- Problem 58 - Counting how many composite numbers have exactly 8 factors
- Problem 59 - Decrypting 3-letter secret key (Vigenere cipher)
- Problem 60 - Prime pair sets - finding five primes such that any prime pair can be concatenated to form a new prime
- Problem 61 - Six cyclic 4-digit numbers, each of which are polygonal numbers (triangle, square, pentagonal, hexagonal, heptagonal, octagonal)
- Problem 62 - Cyclic permutations of cubes - find cubes that permute to other cubes.
- Problem 63 - Powerful digit counts - finding n-digit numbers that are n-th powers
- Problem 64 - Continued Fractions - Odd period square roots - finding the continued fraction representation of an odd number, and determining if it has an odd period. First 1,000 numbers, so these sequences get LONG.
- Problem 65 - Convergents of e - computing the 100th convergent (rational representation of continued fraction) for e and the square root of 2.
- Problem 66 - Diophantine equation - a nice problem involving quadratic Diphantine equations called Pell equations. These equations can be solved using the technique of continued fraction representations. It is much easier to solve this problem, then 64 and 65, rather than the other way around.
- Problem 67 - Maximum path sum - a retake on Project Euler/18 with a larger triangle for which a brute force solution technique is impossible.
- Problem 68
- Problem 69
- Problem 70
Grid 1: Problems 100-199
- Problem 100 - Combinations of Red and Blue Discs - find arrangements of blue and red discs that lead to a probability of exactly 50% that a blue disc is removed, two times in a row.
- Problem 101 - Bad Optimal Polynomials - Lagrangian polynomial interpolation for a sequence of numbers, interpolation of an optimal N-1 polynomial given N points of data.
- Problem 102 - Triangles Containing Origin - given 3 endpoints, determine if a triangle contains the origin.
- Problem 103 - Special Subset Sums: Optimum - finding the optimum special sum set with n=7.
- Problem 104 - Pandigital Fibonacci Ends - finding Fibonacci numbers with pandigital beginnings and endings.
- Problem 105 - Special Subset Sums: Testing - testing sets for the special sum property.
- Problem 106 - Special Subset Sums: Meta-testing - counting subset pairs that need to be tested.
- Problem 107 - Minimal Network - finding the minimal network connecting all vertices (minimum spanning tree).
- Problem 108 - Diophantine Reciprocals I - solving 1/x + 1/y = 1/n for distinct solutions.
- Problem 109 - Darts - counting the number of distinct ways to check out in darts with a score less than 100.
- Problem 110 - Diophantine Reciprocals II - finding the smallest n with over 4 million solutions to 1/x + 1/y = 1/n.
- Problem 111 - Primes with Runs - finding primes with maximum runs of repeated digits.
- Problem 112 - Bouncy Numbers - counting numbers whose digits are neither increasing nor decreasing.
- Problem 113 - Non-bouncy Numbers - counting numbers below a googol that are not bouncy.
- Problem 114 - Counting Block Combinations I - counting ways to fill a row with red and grey blocks.
- Problem 115 - Counting Block Combinations II - finding the minimum row length for over 1 million fill combinations.
- Problem 116 - Red, Green or Blue Tiles - counting ways to replace tiles with colored blocks.
- Problem 117 - Red, Green, and Blue Tiles - counting ways to place colored tiles of various lengths.
- Problem 118 - Pandigital Prime Sets - partitioning the digits 1-9 into sets of prime numbers.
- Problem 119 - Digit Power Sum - finding numbers equal to the sum of their digits raised to some power.
- Problem 120 - Square Remainders - sum of maximum remainders when (a−1)^n + (a+1)^n is divided by a^2.
- Problem 121 - Disc Game Prize Fund - finding max prize fund for a disc game with changing probabilities.
- Problem 122 - Efficient Exponentiation - computing n^15 using minimal multiplications (addition chains).
- Problem 123 - Prime Square Remainders - finding the prime where the maximum remainder exceeds 10^10.
- Problem 124 - Ordered Radicals - finding the k-th element when numbers are sorted by their radical (product of prime factors).
- Problem 125 - Palindromic Sums - sums of consecutive squares that are palindromic numbers.
- Problem 126 - Cuboid Layers - counting the number of cubes needed to cover visible faces of cuboids in successive layers.
- Problem 127 - abc-hits - counting triples where rad(abc) < c and a and b are coprime.
- Problem 128 - Hexagonal Tile Differences - finding tiles in a hexagonal spiral where all neighbors have prime differences.
- Problem 129 - Repunit Divisibility - finding the least n such that a repunit R(n) is divisible by a given number.
- Problem 130 - Composites with Prime Repunit Property - composite numbers where n divides the repunit R(n−1).
- Problem 131 - Prime Cube Partnership - primes p for which n^3 + n^2·p is a perfect cube.
- Problem 132 - Large Repunit Factors - sum of the first forty prime factors of R(10^9).
- Problem 133 - Repunit Nonfactors - primes that will never divide any repunit R(10^n).
- Problem 134 - Prime Pair Connection - connecting consecutive primes p1, p2 to form a number divisible by p2.
- Problem 135 - Same Differences - solving x^2 − y^2 − z^2 = n where x, y, z form an arithmetic progression.
- Problem 136 - Singleton Difference - finding n with exactly one solution to x^2 − y^2 − z^2 = n.
- Problem 137 - Fibonacci Golden Nuggets - Fibonacci numbers appearing as solutions to a Pell-type Diophantine equation.
- Problem 138 - Special Isosceles Triangles - isosceles triangles with integer height and half-base differing by 1.
- Problem 139 - Pythagorean Tiles - Pythagorean triangles that allow tiling of a square of side equal to the hypotenuse.
- Problem 140 - Modified Fibonacci Golden Nuggets - golden nuggets from a modified Fibonacci sequence.
- Problem 141 - Square Progressive Numbers - perfect squares that are also progressive (geometric progression of digits).
- Problem 142 - Perfect Square Collection - finding x+y+z where x>y>z>0, all pairwise sums/differences are squares.
- Problem 143 - Torricelli Triangles - triangles whose Torricelli point has integer distances to the vertices.
- Problem 144 - Laser Beam Reflections - reflecting a laser beam inside an elliptical mirror until it exits.
- Problem 145 - Reversible Numbers - counting numbers n below 1 billion where n + reverse(n) has all odd digits.
- Problem 146 - Investigating a Prime Pattern - finding n where n^2+1, n^2+3, n^2+7, n^2+9, n^2+13, n^2+27 are consecutive primes.
- Problem 147 - Rectangles in Cross-hatched Grids - counting all rectangles in a cross-hatched rectangular grid.
- Problem 148 - Exploring Pascal's Triangle - counting entries in the first billion rows of Pascal's triangle not divisible by 7.
- Problem 149 - Maximum-sum Subsequence - finding the maximum sum of adjacent subsequences in a generated 2000×2000 array.
- Problem 150 - Sub-triangle Sums - finding the minimum-sum sub-triangle in a triangular array of 1000 rows.
- Problem 151
- Problem 152
- Problem 153
- Problem 154
- Problem 155
- Problem 156
- Problem 157
- Problem 158 - Strings of various lengths, with exactly one character lexicographically out of sorts
- Problem 159
- Problem 170
- Problem 171
- Problem 172 - Few Repeated Digits - how many 18 digit numbers have no digit occurring more than 3 times in n?
- Problem 173
- Problem 174
- Problem 175
- Problem 176
- Problem 177
- Problem 178
- Problem 179
- Problem 190
- Problem 191
- Problem 192
- Problem 193
- Problem 194
- Problem 195
- Problem 196
- Problem 197
- Problem 198
- Problem 199
- Problem 254 - Maximum Source of Sums of Digits of Sums of Digits of Sums of Factorial Digit Sums
- Problem 255 - Rounded Square Roots - computing rounded-square-roots using an iterative integer method (Heron's method adapted to integer arithmetic).
- Problem 256 - Tatami-Free Rooms - counting even-sized rectangular rooms that cannot be covered by 1×2 tatami mats without a forbidden cross pattern.
- Problem 257 - Angular Bisectors - integer-sided triangles whose angular bisector segments are also integers.
- Problem 258 - A Lagged Fibonacci Sequence - finding values from a lagged Fibonacci generator defined by a cubic formula.
- Problem 259 - Reachable Numbers - numbers expressible as arithmetic expressions using digits 1 through 9 in order, each exactly once.
- Problem 260 - Stone Game - a three-pile Nim-like game; counting winning configurations for the first player.
- Problem 261 - Pivotal Square Sums - finding square-pivot integers where a sum of consecutive squares equals a perfect square.
- Problem 262 - Mountain Range - finding the shortest continuous path between two points across a mountainous terrain.
- Problem 263 - An Engineers' Dream Come True - finding numbers with special properties relating consecutive primes and practical numbers.
- Problem 264 - Triangle Centres - integer-coordinate triangles whose centroid and orthocenter are also on integer coordinates.
- Problem 265 - Binary Circles - placing 2^N binary digits in a circle such that all N-digit clockwise subsequences are distinct.
- Problem 266 - Pseudo Square Root - finding the product of pseudo square roots (largest divisor ≤ √n) of primes below 190.
- Problem 267 - Billionaire - maximizing the chance of reaching £1 billion through optimal betting on 1000 fair coin tosses.
- Problem 268 - Counting Numbers with at Least Four Distinct Prime Factors Less than 100.
- Problem 269 - Polynomials with at Least One Integer Root - polynomials whose coefficients are the digits of n in base 10.
- Problem 270 - Cutting Squares - counting ways to cut an N×N square into pieces with integer side lengths.
- Problem 271 - Modular Cubes, Part 1 - summing x (1 < x < n) for which x³ ≡ 1 (mod n), for a specific n.
- Problem 272 - Modular Cubes, Part 2 - extending the modular cubes problem to a larger modulus.
- Problem 273 - Sum of Squares - summing values of a in a² + b² = N for squarefree N with all prime factors of the form 4k+1.
- Problem 274 - Divisibility Multipliers - finding positive multipliers m < p that preserve divisibility by p for primes p coprime to 10.
- Problem 275 - Balanced Sculptures - counting polyomino-based sculptures of order n whose combined centre of mass has x-coordinate zero.
- Problem 276 - Primitive Triangles - integer-sided triangles with integer area where the greatest common divisor of sides is 1.
- Problem 277 - A Modified Collatz Sequence - a Collatz-like sequence with three possible steps: divide by 3, or apply floor-based rules.
- Problem 278 - Linear Combinations of Semiprimes - counting numbers expressible as linear combinations of pairs of semiprimes.
- Problem 279 - Triangles with Integral Sides and an Integral Angle - triangles where at least one angle measured in degrees is an integer.
- Problem 280 - Ant and Seeds - an ant walking on a 5×5 grid carrying seeds; finding the expected number of steps to complete the task.
- Problem 281 - Pizza Toppings - counting distinct ways to place m toppings on m·n pizza slices, considering rotational symmetry.
- Problem 282 - The Ackermann Function - computing sums of values of the Ackermann function modulo large numbers.
- Problem 283 - Integer-sided Triangles for Which the Area/Perimeter Ratio is Integral.
- Problem 284 - Steady Squares - numbers in base 14 whose square ends with the number itself.
- Problem 285 - Pythagorean Odds - expected value in a game involving random points and the probability of a Pythagorean distance.
- Problem 286 - Scoring Probabilities - basketball shooting probability as a function of distance; finding the constant q that yields a 50% scoring chance.
- Problem 287 - Quadtree Encoding - bit-length of the quadtree encoding of a 2^N × 2^N disk-shaped black-and-white image.
- Problem 288 - An Enormous Factorial - computing N(p,q) modulo large powers of p for a specifically defined sequence.
- Problem 289 - Eulerian Cycles - counting non-crossing Eulerian cycles on a grid formed by arranging circles.
- Problem 290 - Digital Signature - sum of digits of all numbers expressible as a particular form up to 10^18.
- Problem 291 - Panaitopol Primes - primes expressible as (x⁴ − y⁴) / (x³ + y³) for positive integers x and y.
- Problem 292 - Pythagorean Polygons - convex polygons with integer perimeter formed from at least three edge-disjoint right triangles.
- Problem 293 - Pseudo-Fortunate Numbers - for admissible numbers N, the smallest integer m > 1 such that N + m is prime.
- Problem 294 - Sum of Digits — Experience #23 - summing digits of multiples of 23.
- Problem 295 - Lenticular Holes - convex areas enclosed by two circles whose centers and intersection points are on lattice points.
- Problem 296 - Angular Bisector and Tangent - integer-sided triangles where the angular bisector is tangent to an inscribed circle.
- Problem 297 - Zeckendorf Representation - sum of the number of terms in Zeckendorf representations of all numbers below 10^17.
- Problem 298 - Selective Amnesia - a memory game with random numbers; expected absolute difference in scores after 50 turns.
- Problem 299 - Three Similar Triangles - integer-sided triangles containing three similar right triangles.
Grid 3: Problems 300-399
Grid 3: Problems 300-399
- Problem 301 - Nim - Counting losing positions in three-heap normal-play Nim for n ≤ 2^30.
- Problem 302 - Strong Achilles Numbers - Count how many strong Achilles numbers are below 10^18.
- Problem 303 - Multiples with Small Digits - Sum of least positive multiples using only digits ≤ 2.
- Problem 304 - Primonacci - Sum of Fibonacci numbers at prime indices starting after 10^14.
- Problem 305 - Reflexive Position - Starting positions of the n-th occurrence of n in the concatenated infinite integer string.
- Problem 306 - Paper-strip Game - Combinatorial game: pick two contiguous white squares and paint them black.
- Problem 307 - Chip Defects - Probability of at least one chip having 3+ defects when distributing defects randomly.
- Problem 308 - An Amazing Prime-generating Automaton - Find the 10^15th prime generated by Conway's Fractran program.
- Problem 309 - Integer Ladders - Count integer solutions to the classic crossing ladders problem.
- Problem 310 - Nim Square - Nim variant where players may only remove a square number of stones.
- Problem 311 - Biclinic Integral Quadrilaterals - Count biclinic integral quadrilaterals with bounded sum of squared sides.
- Problem 312 - Cyclic Paths on Sierpiński Graphs - Counting Hamiltonian cycles on Sierpiński graphs.
- Problem 313 - Sliding Game - Minimum moves to slide a counter across an m×n grid.
- Problem 314 - The Mouse on the Moon - Maximizing enclosed-area/wall-length ratio on a grid of posts.
- Problem 315 - Digital Root Clocks - 7-segment display power consumption for digital root clocks.
- Problem 316 - Numbers in Decimal Expansions - Expected position of a number in a random infinite decimal sequence.
- Problem 317 - Firecracker - Volume of the region through which firecracker fragments travel.
- Problem 318 - 2011 Nines - Count consecutive nines in fractional parts of powers of sqrt(p)+sqrt(q).
- Problem 319 - Bounded Sequences - Count sequences of length n satisfying x_i^j < (x_j+1)^i.
- Problem 320 - Factorials Divisible by a Huge Integer - Smallest n such that n! is divisible by (i!)^1234567890.
- Problem 321 - Swapping Counters - Minimum moves to swap n red and n blue counters on a row.
- Problem 322 - Binomial Coefficients Divisible by 10 - Count binomial coefficients divisible by 10 in a given range.
- Problem 323 - Bitwise-OR Operations on Random Integers - Expected number of random 32-bit integers to fill all bits via bitwise-OR.
- Problem 324 - Building a Tower - Number of ways to fill a 3×3×n tower with 2×1×1 blocks.
- Problem 325 - Stone Game II - Two-pile game where removal must be a multiple of the smaller pile.
- Problem 326 - Modulo Summations - Sequence defined by recursive modular sums, count zero-sum subarrays.
- Problem 327 - Rooms of Doom - Minimum security cards to traverse rooms with limited carrying capacity.
- Problem 328 - Lowest-cost Search - Optimal strategy to find a hidden number where each guess costs the value guessed.
- Problem 329 - Prime Frog - Probability of a frog's croaking sequence when jumping on prime and non-prime squares.
- Problem 330 - Euler's Number - Infinite sequence defined via Euler's number e, find A(10^9)+B(10^9).
- Problem 331 - Cross Flips - Minimal turns to flip all disks to white on an N×N board with cross-flipping moves.
- Problem 332 - Spherical Triangles - Area of the smallest spherical triangle with integer-coordinate vertices.
- Problem 333 - Special Partitions - Count partitions of integers into terms of the form 2^i × 3^j.
- Problem 334 - Spilling the Beans - Game where removing two beans from a bowl puts one bean in each adjacent bowl.
- Problem 337
- Problem 345
- Problem 346
- Problem 355
- Problem 356
- Problem 364
- Problem 367
- Problem 373
- Problem 378
- Problem 382
- Problem 389
- Problem 391
Grid 4: Problems 400-499
Grid 5: Problems 500-599
- Problem 500 - Smallest Number with 2n Factors - Finding the smallest number with 2^n divisors
- Problem 501 - Eight Divisors - Finding numbers with exactly 8 divisors, less than 1 trillion
- Problem 502 - Castles - finding the maximum number of castles that can be formed on extremely large grids
Grid 9: Problems 900-999