{"id":16653177,"url":"https://github.com/anuraganalog/project_euler","last_synced_at":"2025-04-09T18:08:32.427Z","repository":{"id":46302725,"uuid":"210749964","full_name":"AnuragAnalog/project_euler","owner":"AnuragAnalog","description":"This repo contains solutions to Project Euler problems.","archived":false,"fork":false,"pushed_at":"2021-11-01T04:26:44.000Z","size":197,"stargazers_count":4,"open_issues_count":1,"forks_count":10,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-23T20:04:18.899Z","etag":null,"topics":["bruteforce","digits","divisiblity","fibonacci","hacktoberfest","hacktoberfest2020","natural-numbers","numbers","permutations","prime-numbers","projecteuler","projecteuler-python","projecteuler-solutions","py","python3","solutions"],"latest_commit_sha":null,"homepage":"https://projecteuler.net/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AnuragAnalog.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-25T03:44:37.000Z","updated_at":"2021-11-01T04:26:47.000Z","dependencies_parsed_at":"2022-09-16T11:33:06.323Z","dependency_job_id":null,"html_url":"https://github.com/AnuragAnalog/project_euler","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnuragAnalog%2Fproject_euler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnuragAnalog%2Fproject_euler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnuragAnalog%2Fproject_euler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnuragAnalog%2Fproject_euler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AnuragAnalog","download_url":"https://codeload.github.com/AnuragAnalog/project_euler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248084307,"owners_count":21045124,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bruteforce","digits","divisiblity","fibonacci","hacktoberfest","hacktoberfest2020","natural-numbers","numbers","permutations","prime-numbers","projecteuler","projecteuler-python","projecteuler-solutions","py","python3","solutions"],"created_at":"2024-10-12T09:43:26.539Z","updated_at":"2025-04-09T18:08:32.395Z","avatar_url":"https://github.com/AnuragAnalog.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Project Euler\n\nThis repo contains solutions to the questions present in https://projecteuler.net/\n\nTime taken is measured in seconds\n\n**Problem1: Multiples of 3 and 5**\n\n*Statement:*    If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.\n\nFind the sum of all the multiples of 3 or 5 below 1000.\n\nTime-taken: 0.0024619102478027344\n\n**Problem2: Even Fibonacci numbers**\n\n*Statement:*    Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:\n\n1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...\n\nBy considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.\n\nTime-taken: 9.775161743164062e-06\n\n**Problem3 : Largest prime factor**\n\n*Statement:* The prime factors of 13195 are 5, 7, 13 and 29.\n\nWhat is the largest prime factor of the number 600851475143 or any given number?\n\n**Problem4: Largest palindrome product**\n\n*Statement:*    A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.\n\nFind the largest palindrome made from the product of two 3-digit numbers.\n\nTime-taken: 0.3633131980895996\n\n**Problem5: Smallest multiple**\n\n*Statement:*    2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.\n\nWhat is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?\n\n**Problem6: Sum square difference**\n\n*Statement:*    The sum of the squares of the first ten natural numbers is,\n1^2 + 2^2 + ... + 10^2 = 385\n\nThe square of the sum of the first ten natural numbers is,\n(1 + 2 + ... + 10)^2 = 55^2 = 3025\n\nHence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 − 385 = 2640.\n\nFind the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.\n\nTime-taken: 3.910064697265625e-05\n\n**Problem7: 10001st prime**\n\n*Statement:*    By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.\n\nWhat is the 10 001st prime number?\n\nTime-taken: 0.24418091773986816\n\n**Problem8: Largest product in a series**\n\n*Statement:*    The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × 8 × 9 = 5832.\n\n    73167176531330624919225119674426574742355349194934\n    96983520312774506326239578318016984801869478851843\n    85861560789112949495459501737958331952853208805511\n    12540698747158523863050715693290963295227443043557\n    66896648950445244523161731856403098711121722383113\n    62229893423380308135336276614282806444486645238749\n    30358907296290491560440772390713810515859307960866\n    70172427121883998797908792274921901699720888093776\n    65727333001053367881220235421809751254540594752243\n    52584907711670556013604839586446706324415722155397\n    53697817977846174064955149290862569321978468622482\n    83972241375657056057490261407972968652414535100474\n    82166370484403199890008895243450658541227588666881\n    16427171479924442928230863465674813919123162824586\n    17866458359124566529476545682848912883142607690042\n    24219022671055626321111109370544217506941658960408\n    07198403850962455444362981230987879927244284909188\n    84580156166097919133875499200524063689912560717606\n    05886116467109405077541002256983155200055935729725\n    71636269561882670428252483600823257530420752963450\n\nFind the thirteen adjacent digits in the 1000-digit number that have the greatest product. What is the value of this product?\n\nNOTE: This 1000-digit number is already loaded in the program.\n\nTime-taken: 0.03603315353393555\n\n**Problem9: Special Pythagorean triplet**\n\n*Statement:*    A Pythagorean triplet is a set of three natural numbers, a \u003c b \u003c c, for which,\na^2 + b^2 = c^2\n\nFor example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2.\n\nThere exists exactly one Pythagorean triplet for which a + b + c = 1000.\nFind the product abc.\n\nTime-taken: 0.10924601554870605\n\n**Problem10: Summation of primes**\n\n*Statement:*    The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.\n\nFind the sum of all the primes below two million.\n\nTime-taken: 13.609575748443604\n\n**Problem11: Largest product in a grid**\n\n*Statement:*    In the 20×20 grid below, four numbers along a diagonal line have been marked in red.\n\n    08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08\n    49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00\n    81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65\n    52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91\n    22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 66 33 13 80\n    24 47 32 60 99 03 45 02 44 75 33 53 78 36 84 20 35 17 12 50\n    32 98 81 28 64 23 67 10 26 38 40 67 59 54 70 66 18 38 64 70\n    67 26 20 68 02 62 12 20 95 63 94 39 63 08 40 91 66 49 94 21\n    24 55 58 05 66 73 99 26 97 17 78 78 96 83 14 88 34 89 63 72\n    21 36 23 09 75 00 76 44 20 45 35 14 00 61 33 97 34 31 33 95\n    78 17 53 28 22 75 31 67 15 94 03 80 04 62 16 14 09 53 56 92\n    16 39 05 42 96 35 31 47 55 58 88 24 00 17 54 24 36 29 85 57\n    86 56 00 48 35 71 89 07 05 44 44 37 44 60 21 58 51 54 17 58\n    19 80 81 68 05 94 47 69 28 73 92 13 86 52 17 77 04 89 55 40\n    04 52 08 83 97 35 99 16 07 97 57 32 16 26 26 79 33 27 98 66\n    88 36 68 87 57 62 20 72 03 46 33 67 46 55 12 32 63 93 53 69\n    04 42 16 73 38 25 39 11 24 94 72 18 08 46 29 32 40 62 76 36\n    20 69 36 41 72 30 23 88 34 62 99 69 82 67 59 85 74 04 36 16\n    20 73 35 29 78 31 90 01 74 31 49 71 48 86 81 16 23 57 05 54\n    01 70 54 71 83 51 54 69 16 92 33 48 61 43 52 01 89 19 67 48\n\nThe product of these numbers is 26 × 63 × 78 × 14 = 1788696.\n\nWhat is the greatest product of four adjacent numbers in the same direction (up, down, left, right, or diagonally) in the 20×20 grid?\n\nNOTE: This 20 x 20 grid is already loaded in the program.\n\nTime-taken: 0.0005795955657958984\n\n**Problem12: Highly divisible triangular number**\n\n*Statement:*  The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be:\n                            1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...\n                            \nLet us list the factors of the first seven triangle numbers:\n                \n                            1: 1\n                            3: 1,3\n                            6: 1,2,3,6\n                            10: 1,2,5,10\n                            15: 1,3,5,15\n                            21: 1,3,7,21\n                            28: 1,2,4,7,14,28\n                             \nWe can see that 28 is the first triangle number to have over five divisors.\n\nWhat is the value of the first triangle number to have over five hundred divisors?\n\nTime-taken: 0.07583904266357422 \n\n**Problem13: Large sum**\n\n*Statement:*    Work out the first ten digits of the sum of the     following one-hundred 50-digit numbers.\n\n    37107287533902102798797998220837590246510135740250\n    46376937677490009712648124896970078050417018260538\n    74324986199524741059474233309513058123726617309629\n    91942213363574161572522430563301811072406154908250\n    23067588207539346171171980310421047513778063246676\n    89261670696623633820136378418383684178734361726757\n    28112879812849979408065481931592621691275889832738\n    44274228917432520321923589422876796487670272189318\n    47451445736001306439091167216856844588711603153276\n    70386486105843025439939619828917593665686757934951\n    62176457141856560629502157223196586755079324193331\n    64906352462741904929101432445813822663347944758178\n    92575867718337217661963751590579239728245598838407\n    58203565325359399008402633568948830189458628227828\n    80181199384826282014278194139940567587151170094390\n    35398664372827112653829987240784473053190104293586\n    86515506006295864861532075273371959191420517255829\n    71693888707715466499115593487603532921714970056938\n    54370070576826684624621495650076471787294438377604\n    53282654108756828443191190634694037855217779295145\n    36123272525000296071075082563815656710885258350721\n    45876576172410976447339110607218265236877223636045\n    17423706905851860660448207621209813287860733969412\n    81142660418086830619328460811191061556940512689692\n    51934325451728388641918047049293215058642563049483\n    62467221648435076201727918039944693004732956340691\n    15732444386908125794514089057706229429197107928209\n    55037687525678773091862540744969844508330393682126\n    18336384825330154686196124348767681297534375946515\n    80386287592878490201521685554828717201219257766954\n    78182833757993103614740356856449095527097864797581\n    16726320100436897842553539920931837441497806860984\n    48403098129077791799088218795327364475675590848030\n    87086987551392711854517078544161852424320693150332\n    59959406895756536782107074926966537676326235447210\n    69793950679652694742597709739166693763042633987085\n    41052684708299085211399427365734116182760315001271\n    65378607361501080857009149939512557028198746004375\n    35829035317434717326932123578154982629742552737307\n    94953759765105305946966067683156574377167401875275\n    88902802571733229619176668713819931811048770190271\n    25267680276078003013678680992525463401061632866526\n    36270218540497705585629946580636237993140746255962\n    24074486908231174977792365466257246923322810917141\n    91430288197103288597806669760892938638285025333403\n    34413065578016127815921815005561868836468420090470\n    23053081172816430487623791969842487255036638784583\n    11487696932154902810424020138335124462181441773470\n    63783299490636259666498587618221225225512486764533\n    67720186971698544312419572409913959008952310058822\n    95548255300263520781532296796249481641953868218774\n    76085327132285723110424803456124867697064507995236\n    37774242535411291684276865538926205024910326572967\n    23701913275725675285653248258265463092207058596522\n    29798860272258331913126375147341994889534765745501\n    18495701454879288984856827726077713721403798879715\n    38298203783031473527721580348144513491373226651381\n    34829543829199918180278916522431027392251122869539\n    40957953066405232632538044100059654939159879593635\n    29746152185502371307642255121183693803580388584903\n    41698116222072977186158236678424689157993532961922\n    62467957194401269043877107275048102390895523597457\n    23189706772547915061505504953922979530901129967519\n    86188088225875314529584099251203829009407770775672\n    11306739708304724483816533873502340845647058077308\n    82959174767140363198008187129011875491310547126581\n    97623331044818386269515456334926366572897563400500\n    42846280183517070527831839425882145521227251250327\n    55121603546981200581762165212827652751691296897789\n    32238195734329339946437501907836945765883352399886\n    75506164965184775180738168837861091527357929701337\n    62177842752192623401942399639168044983993173312731\n    32924185707147349566916674687634660915035914677504\n    99518671430235219628894890102423325116913619626622\n    73267460800591547471830798392868535206946944540724\n    76841822524674417161514036427982273348055556214818\n    97142617910342598647204516893989422179826088076852\n    87783646182799346313767754307809363333018982642090\n    10848802521674670883215120185883543223812876952786\n    71329612474782464538636993009049310363619763878039\n    62184073572399794223406235393808339651327408011116\n    66627891981488087797941876876144230030984490851411\n    60661826293682836764744779239180335110989069790714\n    85786944089552990653640447425576083659976645795096\n    66024396409905389607120198219976047599490197230297\n    64913982680032973156037120041377903785566085089252\n    16730939319872750275468906903707539413042652315011\n    94809377245048795150954100921645863754710598436791\n    78639167021187492431995700641917969777599028300699\n    15368713711936614952811305876380278410754449733078\n    40789923115535562561142322423255033685442488917353\n    44889911501440648020369068063960672322193204149535\n    41503128880339536053299340368006977710650566631954\n    81234880673210146739058568557934581403627822703280\n    82616570773948327592232845941706525094512325230608\n    22918802058777319719839450180888072429661980811197\n    77158542502016545090413245809786882778948721859617\n    72107838435069186155435662884062257473692284509516\n    20849603980134001723930671666823555245252804609722\n    53503534226472524250874054075591789781264330331690\n\nNOTE: This 50 100-digit numbers are loaded in a file called euler13.txt\n\nTime-taken: 0.0005054473876953125\n\n**Problem14: Longest Collatz sequence**\n\n*Statement:*    The following iterative sequence is defined for the set of positive integers:\n\n    n → n/2 (n is even)\n    n → 3n + 1 (n is odd)\n\nUsing the rule above and starting with 13, we generate the following sequence:\n    13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1\n\nIt can be seen that this sequence (starting at 13 and finishing at 1) contains 10 terms. Although it has not been proved yet (Collatz Problem), it is thought that all starting numbers finish at 1.\n\nWhich starting number, under one million, produces the longest chain?\n\nNOTE: Once the chain starts the terms are allowed to go above one million.\n\nTime-taken: 17.320169925689697\n\n**Problem16: Power digit sum**\n\n*Statement:*     2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.\n\nWhat is the sum of the digits of the number 2^1000?\n\nTime-taken: 8.535385131835938e-05\n\n**Problem18: Maximum path sum I**\n\nBy 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.\n\n                                                                                3\n                                                                               7 4\n                                                                              2 4 6\n                                                                             8 5 9 3\n\nThat is, 3 + 7 + 4 + 9 = 23.\n\nFind the maximum total from top to bottom of the triangle below: \n\n                                                              75\n                                                            95 64\n                                                           17 47 82\n                                                         18 35 87 10\n                                                        20 04 82 47 65\n                                                      19 01 23 75 03 34\n                                                     88 02 77 73 07 63 67\n                                                   99 65 04 28 06 16 70 92\n                                                  41 41 26 56 83 40 80 70 33\n                                                41 48 72 33 47 32 37 16 94 29\n                                               53 71 44 65 25 43 91 52 97 51 14\n                                             70 11 33 28 77 73 17 78 39 68 17 57\n                                            91 71 52 38 17 14 91 43 58 50 27 29 48\n                                          63 66 04 68 89 53 67 30 73 16 69 87 40 31\n                                                                                            \nNOTE: As there are only 16384 routes, it is possible to solve this problem by trying every route. However, Problem 67, is the same challenge with a triangle containing one-hundred rows; it cannot be solved by brute force, and requires a clever method! ;o)\n\nTime-taken: 0.0\n\n**Problem20: Factorial digit sum**\n\n*Statement:*    n! means n × (n − 1) × ... × 3 × 2 × 1\n\nFor example, 10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800,\nand the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27.\n\nFind the sum of the digits in the number 100!\n\nTime-taken: 0.000102996826171875\n\n**Problem21: Amicable numbers**\n\n*Statement:*    Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n).\nIf d(a) = b and d(b) = a, where a ≠ b, then a and b are an amicable pair and each of a and b are called amicable numbers.\n\nFor example, the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110; therefore d(220) = 284. The proper divisors of 284 are 1, 2, 4, 71 and 142; so d(284) = 220.\n\nEvaluate the sum of all the amicable numbers under 10000.\n\nTime-taken: 2.8323967456817627\n\n**Problem22: Names scores**\n\n*Statement:*    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 value for each name, multiply this value by its alphabetical position in the list to obtain a name score.\n\nFor example, when the list is sorted into alphabetical order, COLIN, which is worth 3 + 15 + 12 + 9 + 14 = 53, is the 938th name in the list. So, COLIN would obtain a score of 938 × 53 = 49714.\n\nWhat is the total of all the name scores in the file?\n\nNOTE: names.txt has a name euler22.txt in the directory.\n\nTime-taken: 0.08470535278320312\n\n**Problem24: Lexicographic permutations**\n\n*Statement:*    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 alphabetically, we call it lexicographic order. The lexicographic permutations of 0, 1 and 2 are:\n\n012   021   102   120   201   210\n\nWhat is the millionth lexicographic permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9?\n\nTime-taken: 0.6139309406280518\n\n**Problem25: 1000-digit Fibonacci number**\n\n*Statement:*    The Fibonacci sequence is defined by the recurrence relation:\n    Fn = Fn−1 + Fn−2, where F1 = 1 and F2 = 1.\n\nHence the first 12 terms will be:\n    F1 = 1\n    F2 = 1\n    F3 = 2\n    F4 = 3\n    F5 = 5\n    F6 = 8\n    F7 = 13\n    F8 = 21\n    F9 = 34\n    F10 = 55\n    F11 = 89\n    F12 = 144\nThe 12th term, F12, is the first term to contain three digits.\n\nWhat is the index of the first term in the Fibonacci sequence to contain 1000 digits?\n\nTime-taken: 0.03079533576965332\n\n**Problem26: Reciprocal cycles**\n\nA unit fraction contains 1 in the numerator. The decimal representation of the unit fractions with denominators 2 to 10 are given:\n\n1/2\t= \t0.5\n1/3\t= \t0.(3)\n1/4\t= \t0.25\n1/5\t= \t0.2\n1/6\t= \t0.1(6)\n1/7\t= \t0.(142857)\n1/8\t= \t0.125\n1/9\t= \t0.(1)\n1/10\t= \t0.1\nWhere 0.1(6) means 0.166666..., and has a 1-digit recurring cycle. It can be seen that 1/7 has a 6-digit recurring cycle.\n\nFind the value of d \u003c 1000 for which 1/d contains the longest recurring cycle in its decimal fraction part.\n\nTime-taken: 0.8422951698303223\n\n**Problem28: Number spiral diagonals**\n\n*Statement:*    Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows:\n\n                21 22 23 24 25\n                20  7  8  9 10\n                19  6  1  2 11\n                18  5  4  3 12\n                17 16 15 14 13\n\nIt can be verified that the sum of the numbers on the diagonals is 101.\n\nWhat is the sum of the numbers on the diagonals in a 1001 by 1001 spiral formed in the same way?\n\n\n**Problem29: Distinct powers**\n\n*Statement:*    Consider all integer combinations of a^b for 2 ≤ a ≤ 5 and 2 ≤ b ≤ 5:\n\n    2^2=4, 2^3=8, 2^4=16, 25^=32\n    3^2=9, 3^3=27, 3^4=81, 3^5=243\n    4^2=16, 4^3=64, 4^4=256, 4^5=1024\n    5^2=25, 5^3=125, 5^4=625, 5^5=3125\n\nIf they are then placed in numerical order, with any repeats removed, we get the following sequence of 15 distinct terms:\n\n4, 8, 9, 16, 25, 27, 32, 64, 81, 125, 243, 256, 625, 1024, 3125\n\nHow many distinct terms are in the sequence generated by a^b for 2 ≤ a ≤ 100 and 2 ≤ b ≤ 100?\n\nTime-taken: 0.006799221038818359\n\n**Problem30: Digit fifth powers**\n\n*Statement:*    Surprisingly there are only three numbers that can be written as the sum of fourth powers of their digits:\n\n    1634 = 1^4 + 6^4 + 3^4 + 4^4\n    8208 = 8^4 + 2^4 + 0^4 + 8^4\n    9474 = 9^4 + 4^4 + 7^4 + 4^4\n\nAs 1 = 1^4 is not a sum it is not included.\n\nThe sum of these numbers is 1634 + 8208 + 9474 = 19316.\n\nFind the sum of all the numbers that can be written as the sum of fifth powers of their digits.\n\nTime-taken: 1.0007250308990479\n\n**Problem34: Digit factorials**\n\n*Statement:*    145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145.\n\nFind the sum of all numbers which are equal to the sum of the factorial of their digits.\n\nNote: as 1! = 1 and 2! = 2 are not sums they are not included.\n\nTime-taken: 5.019497871398926\n\n**Problem35: Circular primes**\n\n*Statement:*    The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime.\n\nThere are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97.\n\nHow many circular primes are there below one million?\n\nTime-taken: 7.0219902992248535\n\n**Problem36: Double-base palindromes**\n\n*Statement:*    The decimal number, 585 = 10010010012 (binary), is palindromic in both bases.\n\nFind the sum of all numbers, less than one million, which are palindromic in base 10 and base 2.\n\n(Please note that the palindromic number, in either base, may not include leading zeros.)\n\nTime-taken: 0.21373534202575684\n\n**Problem40: Champernowne's constant**\n\n*Statement:*    An irrational decimal fraction is created by concatenating the positive integers:\n\n    0.123456789101112131415161718192021...\n\nIt can be seen that the 12th digit of the fractional part is 1.\n\nIf dn represents the nth digit of the fractional part, find the value of the following expression.\n\n    d1 × d10 × d100 × d1000 × d10000 × d100000 × d1000000\n\nTime-taken: 0.06264543533325195\n\n**Problem42: Coded triangle numbers**\n\n*Statement:*    The nth term of the sequence of triangle numbers is given by, tn = ½n(n+1); so the first ten triangle numbers are:\n\n    1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...\n\nBy converting each letter in a word to a number corresponding to its alphabetical position and adding these values we form a word value. For example, the word value for SKY is 19 + 11 + 25 = 55 = t10. If the word value is a triangle number then we shall call the word a triangle word.\n\nUsing words.txt (right click and 'Save Link/Target As...'), a 16K text file containing nearly two-thousand common English words, how many are triangle words?\n\nNOTE: This program requries euler42.txt which contains the words\n\nTime-taken: 0.005549192428588867\n\n**Problem43: Sub-string divisibility**\n\n*Statement:*    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.\n\nLet d1 be the 1st digit, d2 be the 2nd digit, and so on. In this way, we note the following:\n\n    * d2d3d4 = 406 is divisible by 2\n    * d3d4d5 = 063 is divisible by 3\n    * d4d5d6 = 635 is divisible by 5\n    * d5d6d7 = 357 is divisible by 7\n    * d6d7d8 = 572 is divisible by 11\n    * d7d8d9 = 728 is divisible by 13\n    * d8d9d10 = 289 is divisible by 17\n\nFind the sum of all 0 to 9 pandigital numbers with this property.\n\nTime-taken: 12.060410261154175\n\n**Problem48: Self powers**\n\n*Statement:*    The series, 1^1 + 2^2 + 3^3 + ... + 10^10 = 10405071317.\n\nFind the last ten digits of the series, 1^1 + 2^2 + 3^3 + ... + 1000^1000.\n\nTime-taken: 0.01032567024230957\n\n**Problem50: Consecutive prime sum**\n\nThe prime 41, can be written as the sum of six consecutive primes:\n\n                                                        41 = 2 + 3 + 5 + 7 + 11 + 13\n                                                        \nThis is the longest sum of consecutive primes that adds to a prime below one-hundred.\n\nThe longest sum of consecutive primes below one-thousand that adds to a prime, contains 21 terms, and is equal to 953.\n\nWhich prime, below one-million, can be written as the sum of the most consecutive primes?\n\nTime-taken: 0.8478395938873291\n\n**Problem52: Permuted multiples**\n\n*Statement:*    It can be seen that the number, 125874, and its double, 251748, contain exactly the same digits, but in a different order.\n\nFind the smallest positive integer, x, such that 2x, 3x, 4x, 5x, and 6x, contain the same digits.\n\nTime-taken: 0.24191737174987793\n\n**Problem53: Combinatoric selections**\n\n*Statement:*\nThere are exactly ten ways of selecting three from five, 12345:\n\n    123, 124, 125, 134, 135, 145, 234, 235, 245, and 345\n\nIn combinatorics, we use the notation, 5C3=10.\n\nIn general, nCr=n!/(r!(n−r)!), where r≤n, n!=n×(n−1)×...×3×2×1, and 0!=1.\nIt is not until n = 23, that a value exceeds one-million: 23C10=1144066.\n\nHow many, not necessarily distinct, values of nCr for 1≤n≤100, are greater than one-million?\n\nTime-taken: 0.004127979278564453\n\n**Problem55: Lychrel numbers**\n\n*Statement:*   If we take 47, reverse and add, 47 + 74 = 121, which is palindromic.\n\nNot all numbers produce palindromes so quickly. For example,\n\n    349 + 943 = 1292,\n    1292 + 2921 = 4213\n    4213 + 3124 = 7337\n\nThat is, 349 took three iterations to arrive at a palindrome.\n\nAlthough no one has proved it yet, it is thought that some numbers, like 196, never produce a palindrome. A number that never forms a palindrome through the reverse and add process is called a Lychrel number. Due to the theoretical nature of these numbers, and for the purpose of this problem, we shall assume that a number is Lychrel until proven otherwise. In addition you are given that for every number below ten-thousand, it will either (i) become a palindrome in less than fifty iterations, or, (ii) no one, with all the computing power that exists, has managed so far to map it to a palindrome. In fact, 10677 is the first number to be shown to require over fifty iterations before producing a palindrome: 4668731596684224866951378664 (53 iterations, 28-digits).\n\nSurprisingly, there are palindromic numbers that are themselves Lychrel numbers; the first example is 4994.\n\nHow many Lychrel numbers are there below ten-thousand?\n\nNOTE: Wording was modified slightly on 24 April 2007 to emphasise the theoretical nature of Lychrel numbers.\n\nTime-taken: 0.050534963607788086\n\n**Problem56: Powerful digit sum**\n\n*Statement:*    A googol (10^100) is a massive number: one followed by one-hundred zeros; 100^100 is almost unimaginably large: one followed by two-hundred zeros. Despite their size, the sum of the digits in each number is only 1.\n\nConsidering natural numbers of the form, a^b, where a, b \u003c 100, what is the maximum digital sum?\n\nTime-taken: 0.10944294929504395\n\n**Problem 67: Maximum path sum II**\n\nBy 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.\n\n                                                        3\n                                                       7 4\n                                                      2 4 6\n                                                     8 5 9 3\n\nThat is, 3 + 7 + 4 + 9 = 23.\n\nFind the maximum total from top to bottom in triangle.txt (right click and 'Save Link/Target As...'), a 15K text file containing a triangle with one-hundred rows.\n\nNOTE: This is a much more difficult version of Problem 18. It is not possible to try every route to solve this problem, as there are 299 altogether! If you could check one trillion (1012) routes every second it would take over twenty billion years to check them all. There is an efficient algorithm to solve it. ;o)\n\nTime-taken: 0.007977962493896484\n\n**Problem97: Large non-Mersenne prime**\n\n*Statement:*    The first known prime found to exceed one million digits was discovered in 1999, and is a Mersenne prime of the form (2^6972593)−1; it contains exactly 2,098,960 digits. Subsequently other Mersenne primes, of the form (2^p)−1, have been found which contain more digits.\n\nHowever, in 2004 there was found a massive non-Mersenne prime which contains 2,357,207 digits: 28433×(2^7830457)+1.\n\nFind the last ten digits of this prime number.\n\nTime-taken: 0.006957530975341797\n\n**Problem100: Arranged probability**\n\n*Statement:*    If a box contains twenty-one coloured discs, composed of fifteen blue discs and six red discs, and two discs were taken at random, it can be seen that the probability of taking two blue discs, P(BB) = (15/21)×(14/20) = 1/2.\n\nThe next such arrangement, for which there is exactly 50% chance of taking two blue discs at random, is a box containing eighty-five blue discs and thirty-five red discs.\n\nBy finding the first arrangement to contain over 1012 = 1,000,000,000,000 discs in total, determine the number of blue discs that the box would contain.\n\nTime-taken: 0,0006 ms\n\n**Problem112: Bouncy numbers**\n\n*Statement:*    Working from left-to-right if no digit is exceeded by the digit to its left it is called an increasing number; for example, 134468.\n\nSimilarly if no digit is exceeded by the digit to its right it is called a decreasing number; for example, 66420.\n\nWe shall call a positive integer that is neither increasing nor decreasing a \"bouncy\" number; for example, 155349.\n\nClearly there cannot be any bouncy numbers below one-hundred, but just over half of the numbers below one-thousand (525) are bouncy. In fact, the least number for which the proportion of bouncy numbers first reaches 50% is 538.\n\nSurprisingly, bouncy numbers become more and more common and by the time we reach 21780 the proportion of bouncy numbers is equal to 90%.\n\nFind the least number for which the proportion of bouncy numbers is exactly 99%.\n\nTime-taken: 2.75s\n\n**Problem113: Non-bouncy numbers**\n\n*Statement:*  Working from left-to-right if no digit is exceeded by the digit to its left it is called an increasing number; for example, 134468.\n\nSimilarly if no digit is exceeded by the digit to its right it is called a decreasing number; for example, 66420.\n\nWe shall call a positive integer that is neither increasing nor decreasing a \"bouncy\" number; for example, 155349.\n\nAs n increases, the proportion of bouncy numbers below n increases such that there are only 12951 numbers below one-million that are not bouncy and only 277032 non-bouncy numbers below 1010.\n\nHow many numbers below a googol (10^100) are not bouncy?\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanuraganalog%2Fproject_euler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanuraganalog%2Fproject_euler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanuraganalog%2Fproject_euler/lists"}