# Project Euler 53

Problem53を解きました． Combinatoric selections There are exactly ten ways of selecting three from five, 12345:123, 124, 125, 134, 135, 145, 234, 235, 245, and 345In combinatorics, we use the notation, 5C3 = 10.In general,nCr = n! / r!(n−r…

# Project Euler 52

Problem52を解きました． Permuted multiples It can be seen that the number, 125874, and its double, 251748, contain exactly the same digits, but in a different order.Find the smallest positive integer, x, such that 2x, 3x, 4x, 5x, and 6x, c…

# Project Euler 51

Problem51を解きました． Prime digit replacements By replacing the 1st digit of the 2-digit number *3, it turns out that six of the nine possible values: 13, 23, 43, 53, 73, and 83, are all prime.By replacing the 3rd and 4th digits of 56**3…

# Project Euler 50

Problem50を解きました． Consecutive prime sum The prime 41, can be written as the sum of six consecutive primes:41 = 2 + 3 + 5 + 7 + 11 + 13 This is the longest sum of consecutive primes that adds to a prime below one-hundred.The longest s…

# Project Euler 49

Problem49を解きました． Prime permutations The arithmetic sequence, 1487, 4817, 8147, in which each of the terms increases by 3330, is unusual in two ways: (i) each of the three terms are prime, and, (ii) each of the 4-digit numbers are pe…

# Project Euler 48

Problem48を解きました． Self powers The series, 1^1 + 2^2 + 3^3 + ... + 10^10 = 10405071317.Find the last ten digits of the series, 1^1 + 2^2 + 3^3 + ... + 1000^1000. https://projecteuler.net/problem=48 問題は「1^1 + 2^2 + 3^3 + ... + 1000…

# Project Euler 47

Problem47を解きました． Distinct primes factors The first two consecutive numbers to have two distinct prime factors are:14 = 2 × 7 15 = 3 × 5The first three consecutive numbers to have three distinct prime factors are:644 = 2² × 7 × 23 64…

# Project Euler 46

Problem46を解きました． Goldbach's other conjecture It was proposed by Christian Goldbach that every odd composite number can be written as the sum of a prime and twice a square.9 = 7 + 2×12 15 = 7 + 2×22 21 = 3 + 2×32 25 = 7 + 2×32 27 = 1…

# Project Euler 45

Problem45を解きました． Triangular, pentagonal, and hexagonal Triangle, pentagonal, and hexagonal numbers are generated by the following formulae:Triangle Tn=n(n+1)/2 1, 3, 6, 10, 15, ... Pentagonal Pn=n(3n−1)/2 1, 5, 12, 22, 35, ... Hexag…

# Project Euler 44

Problem44を解きました． Pentagon numbers Pentagonal numbers are generated by the formula, Pn=n(3n−1)/2. The first ten pentagonal numbers are:1, 5, 12, 22, 35, 51, 70, 92, 117, 145, ...It can be seen that P4 + P7 = 22 + 70 = 92 = P8. Howeve…

# Project Euler 43

Problem43を解きました． Sub-string divisibility The number, 1406357289, is a 0 to 9 pandigital number because it is made up of each of the digits 0 to 9 in some order, but it also has a rather interesting sub-string divisibility property.L…

# Project Euler 42

Problem42を解きました． Coded triangle numbers The nth term of the sequence of triangle numbers is given by, tn = ½n(n+1); so the first ten triangle numbers are:1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...By converting each letter in a word to…

# Project Euler 41

Problem41を解きました． Pandigital prime We shall say that an n-digit number is pandigital if it makes use of all the digits 1 to n exactly once. For example, 2143 is a 4-digit pandigital and is also prime.What is the largest n-digit pandi…

# Project Euler 40

Problem40を解きました． Champernowne's constant An irrational decimal fraction is created by concatenating the positive integers:0.123456789101112131415161718192021...It can be seen that the 12th digit of the fractional part is 1.If dn rep…

# Project Euler 39

Problem39を解き直しました． Integer right triangles If p is the perimeter of a right angle triangle with integral length sides, {a,b,c}, there are exactly three solutions for p = 120.{20,48,52}, {24,45,51}, {30,40,50}For which value of p ≤…

# Project Euler 38

Problem38を解きました． Pandigital multiples Take the number 192 and multiply it by each of 1, 2, and 3:192 × 1 = 192 192 × 2 = 384 192 × 3 = 576 By concatenating each product we get the 1 to 9 pandigital, 192384576. We will call 192384576…

# Project Euler 37

Problem37を解きました． Truncatable primes The number 3797 has an interesting property. Being prime itself, it is possible to continuously remove digits from left to right, and remain prime at each stage: 3797, 797, 97, and 7. Similarly we…

# Project Euler 36

Problem36を解きました． Double-base palindromes The decimal number, 585 = 10010010012 (binary), is palindromic in both bases.Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2.(Please note that …

# Project Euler 35

Problem35を解き直しました． Circular primes The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime.There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, …

# Project Euler 34

Problem34を解きました． Digit factorials 145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145.Find the sum of all numbers which are equal to the sum of the factorial of their digits.Note: as 1! = 1 and 2! = 2 are not sums they are…

# Project Euler 33

Problem33を解き直しました． Digit cancelling fractions The fraction 49/98 is a curious fraction, as an inexperienced mathematician in attempting to simplify it may incorrectly believe that 49/98 = 4/8, which is correct, is obtained by canc…

# Project Euler 32

Problem32を解きました． Pandigital products We shall say that an n-digit number is pandigital if it makes use of all the digits 1 to n exactly once; for example, the 5-digit number, 15234, is 1 through 5 pandigital.The product 7254 is unus…

# Project Euler 31

Problem31を解きました． Coin sums In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation:1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p). It is possible to make £2 in the following…

# Project Euler 30

Problem30を解き直しました． Digit fifth powers Surprisingly there are only three numbers that can be written as the sum of fourth powers of their digits:1634 = 1^4 + 6^4 + 3^4 + 4^4 8208 = 8^4 + 2^4 + 0^4 + 8^4 9474 = 9^4 + 4^4 + 7^4 + 4^4…

# Project Euler 29

Problem29を解きました． Distinct powers Consider all integer combinations of ab for 2 ≤ a ≤ 5 and 2 ≤ b ≤ 5:2^2=4, 2^3=8, 2^4=16, 2^5=32 3^2=9, 3^3=27, 3^4=81, 3^5=243 4^2=16, 4^3=64, 4^4=256, 4^5=1024 5^2=25, 5^3=125, 5^4=625, 5^5=3125 If…

# Project Euler 28

Problem28を解きました． Number spiral diagonals Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows:２１ ２２ ２３ ２４ ２５ ２０ ７ ８ ９ １０ １９ ６ １ ２ １１ １８ ５ ４ ３ …

# Project Euler 27

Problem27を解きました． Reciprocal cycles Euler discovered the remarkable quadratic formula: n^2+n+41 It turns out that the formula will produce 40 primes for the consecutive integer values 0≤n≤39. However, when n=40,40^2+40+41=40(40+1)+41…

# Project Euler 26

Problem26を解きました． Reciprocal cycles A unit fraction contains 1 in the numerator. The decimal representation of the unit fractions with denominators 2 to 10 are given:1/2 = 0.5 1/3 = 0.(3) 1/4 = 0.25 1/5 = 0.2 1/6 = 0.1(6) 1/7 = 0.(14…

# Project Euler 25

Problem25を解き直しました． 1000-digit Fibonacci number The Fibonacci sequence is defined by the recurrence relation:Fn = Fn−1 + Fn−2, where F1 = 1 and F2 = 1. Hence the first 12 terms will be:F1 = 1 F2 = 1 F3 = 2 F4 = 3 F5 = 5 F6 = 8 F7 =…

# Project Euler 24

Problem24を解き直しました． Lexicographic permutations A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or alph…

# Project Euler 23

Problem23を解きました． Non-abundant sums A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means…

# Project Euler 22

Problem22を解きました． Names scores Using names.txt (right click and 'Save Link/Target As...'), a 46K text file containing over five-thousand first names, begin by sorting it into alphabetical order. Then working out the alphabetical valu…

# Project Euler 21

Problem21を解き直しました． Amicable numbers Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n). If d(a) = b and d(b) = a, where a ≠ b, then a and b are an amicable pair and each of a an…

# Project Euler 20

Problem20を解き直しました． Factorial digit sum n! means n × (n − 1) × ... × 3 × 2 × 1For example, 10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800, and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27.Find the sum of the …

# Project Euler 19

Problem19を解きました． Counting Sundays You are given the following information, but you may prefer to do some research for yourself. 1 Jan 1900 was a Monday. Thirty days has September, April, June and November. All the rest have thirty-o…

# Project Euler 18

Problem18を解きました． Maximum path sum I By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23.3 7 4 2 4 6 8 5 9 3That is, 3 + 7 + 4 + 9 = 23.Find the max…

# Project Euler 17

Problem17を解きました． Number letter counts If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.If all the numbers from 1 to 1000 (one thousand) inclusiv…

# Project Euler 16

Problem16を解き直しました． Power digit sum 2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.What is the sum of the digits of the number 2^1000? https://projecteuler.net/problem=16 問題は「2^1000の各桁の総和を求めよ」． 解…

# Project Euler 15

Problem15を解きました． Lattice paths Starting in the top left corner of a 2×2 grid, and only being able to move to the right and down, there are exactly 6 routes to the bottom right corner.How many such routes are there through a 20×20 gr…

# Project Euler 14

Problem14を解き直しました． Longest Collatz sequence The following iterative sequence is defined for the set of positive integers:n → n/2 (n is even) n → 3n + 1 (n is odd)Using the rule above and starting with 13, we generate the following…