# Solution to Project 22 on Project Euler

The problem: — 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. For example, when the […]

# Solution to Problem 21 on Project Euler

The problem: 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 and b are called amicable numbers. For example, […]

# Solution to Problem 20 on Project Euler

The problem: n! means n × (n − 1) × … × 3 × 2 × 1 For example, 10! = 10 × 9 × … × 3 × 2 × 1 = 3628800, and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + […]

# Solution to Problem 19 on Project Euler

The problem: 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-one, Saving February alone, Which has twenty-eight, rain or shine. And on leap years, twenty-nine. A leap year occurs […]

# Solution to Problem 18 on ProjectEuler.net

The problem: —– 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 3 That is, 3 + 7 + 4 + 9 = 23. Find the maximum total […]

# Solution to Problem 17 on ProjectEuler.net

The problem: ——- 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) inclusive were written out in words, how many […]

# Solution to Problem 16 on ProjectEuler.net

Here’s the problem: —– 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? —– My Solution Here’s the solution implementing the large number as an array of digits: #include <stdio.h> #define MAX […]

# Solution to Problem 15 on ProjectEuler.net

The problem: ——- Starting in the top left corner of a 22 grid, there are 6 routes (without backtracking) to the bottom right corner. How many routes are there through a 2020 grid? ——- My Solution #include <stdio.h> int main(){   int i,j,x,y;   long long int mat;   i=0;   for (j=0;j<21;j++)     mat[i][j]=1;   j=0;   for (i=0;i<21;i++)     mat[i][j]=1;   for […]

# Solution to Problem 14 on ProjectEuler.net

Here’s the problem: ———— 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 sequence: 13 40 20 10 5 16 8 4 2 1 It can be seen […]