Compare commits
No commits in common. "71e426257eb23df3dc4bc8c806ad451a9bf5be82" and "f09f056c87ef9cdfcbab60836a473fb0eb3d5e02" have entirely different histories.
71e426257e
...
f09f056c87
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,2 @@
|
|||||||
Python/__pycache__
|
Python/__pycache__
|
||||||
ProblemsOverviews/*
|
ProblemsOverviews/*
|
||||||
Haskell/.stack-work
|
|
||||||
|
2
C/p001.c
2
C/p001.c
@ -2,8 +2,6 @@
|
|||||||
*
|
*
|
||||||
* Find the sum of all the multiples of 3 or 5 below 1000.*/
|
* Find the sum of all the multiples of 3 or 5 below 1000.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p002.c
2
C/p002.c
@ -4,8 +4,6 @@
|
|||||||
*
|
*
|
||||||
* By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.*/
|
* By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p003.c
2
C/p003.c
@ -2,8 +2,6 @@
|
|||||||
*
|
*
|
||||||
* What is the largest prime factor of the number 600851475143?*/
|
* What is the largest prime factor of the number 600851475143?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p004.c
2
C/p004.c
@ -2,8 +2,6 @@
|
|||||||
*
|
*
|
||||||
* Find the largest palindrome made from the product of two 3-digit numbers.*/
|
* Find the largest palindrome made from the product of two 3-digit numbers.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p005.c
2
C/p005.c
@ -2,8 +2,6 @@
|
|||||||
*
|
*
|
||||||
* What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?*/
|
* What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p006.c
2
C/p006.c
@ -10,8 +10,6 @@
|
|||||||
*
|
*
|
||||||
* Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.*/
|
* Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p007.c
2
C/p007.c
@ -2,8 +2,6 @@
|
|||||||
*
|
*
|
||||||
* What is the 10 001st prime number?*/
|
* What is the 10 001st prime number?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p008.c
2
C/p008.c
@ -23,8 +23,6 @@
|
|||||||
*
|
*
|
||||||
* Find the thirteen adjacent digits in the 1000-digit number that have the greatest product. What is the value of this product?*/
|
* Find the thirteen adjacent digits in the 1000-digit number that have the greatest product. What is the value of this product?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
4
C/p009.c
4
C/p009.c
@ -8,8 +8,6 @@
|
|||||||
*
|
*
|
||||||
* Find the product abc.*/
|
* Find the product abc.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@ -59,7 +57,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
} while(tmpa + tmpb + tmpc < 1000);
|
}while(tmpa + tmpb + tmpc < 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
C/p010.c
2
C/p010.c
@ -2,8 +2,6 @@
|
|||||||
*
|
*
|
||||||
* Find the sum of all the primes below two million.*/
|
* Find the sum of all the primes below two million.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
5
C/p011.c
5
C/p011.c
@ -25,8 +25,6 @@
|
|||||||
*
|
*
|
||||||
* What is the greatest product of four adjacent numbers in the same direction (up, down, left, right, or diagonally) in the 20×20 grid?*/
|
* What is the greatest product of four adjacent numbers in the same direction (up, down, left, right, or diagonally) in the 20×20 grid?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@ -52,8 +50,7 @@ int main(int argc, char **argv)
|
|||||||
{4, 42, 16, 73, 38, 25, 39, 11, 24, 94, 72, 18, 8, 46, 29, 32, 40, 62, 76, 36},
|
{4, 42, 16, 73, 38, 25, 39, 11, 24, 94, 72, 18, 8, 46, 29, 32, 40, 62, 76, 36},
|
||||||
{20, 69, 36, 41, 72, 30, 23, 88, 34, 62, 99, 69, 82, 67, 59, 85, 74, 4, 36, 16},
|
{20, 69, 36, 41, 72, 30, 23, 88, 34, 62, 99, 69, 82, 67, 59, 85, 74, 4, 36, 16},
|
||||||
{20, 73, 35, 29, 78, 31, 90, 1, 74, 31, 49, 71, 48, 86, 81, 16, 23, 57, 5, 54},
|
{20, 73, 35, 29, 78, 31, 90, 1, 74, 31, 49, 71, 48, 86, 81, 16, 23, 57, 5, 54},
|
||||||
{1, 70, 54, 71, 83, 51, 54, 69, 16, 92, 33, 48, 61, 43, 52, 1, 89, 19, 67, 48}
|
{1, 70, 54, 71, 83, 51, 54, 69, 16, 92, 33, 48, 61, 43, 52, 1, 89, 19, 67, 48}};
|
||||||
};
|
|
||||||
int i, j, k, w, max = 0, prod;
|
int i, j, k, w, max = 0, prod;
|
||||||
double elapsed;
|
double elapsed;
|
||||||
struct timespec start, end;
|
struct timespec start, end;
|
||||||
|
2
C/p012.c
2
C/p012.c
@ -17,8 +17,6 @@
|
|||||||
*
|
*
|
||||||
* What is the value of the first triangle number to have over five hundred divisors?*/
|
* What is the value of the first triangle number to have over five hundred divisors?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
5
C/p013.c
5
C/p013.c
@ -101,8 +101,6 @@
|
|||||||
* 20849603980134001723930671666823555245252804609722
|
* 20849603980134001723930671666823555245252804609722
|
||||||
* 53503534226472524250874054075591789781264330331690*/
|
* 53503534226472524250874054075591789781264330331690*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@ -159,8 +157,7 @@ int main(int argc, char **argv)
|
|||||||
"41503128880339536053299340368006977710650566631954", "81234880673210146739058568557934581403627822703280",
|
"41503128880339536053299340368006977710650566631954", "81234880673210146739058568557934581403627822703280",
|
||||||
"82616570773948327592232845941706525094512325230608", "22918802058777319719839450180888072429661980811197",
|
"82616570773948327592232845941706525094512325230608", "22918802058777319719839450180888072429661980811197",
|
||||||
"77158542502016545090413245809786882778948721859617", "72107838435069186155435662884062257473692284509516",
|
"77158542502016545090413245809786882778948721859617", "72107838435069186155435662884062257473692284509516",
|
||||||
"20849603980134001723930671666823555245252804609722", "53503534226472524250874054075591789781264330331690"
|
"20849603980134001723930671666823555245252804609722", "53503534226472524250874054075591789781264330331690"};
|
||||||
};
|
|
||||||
char result[100];
|
char result[100];
|
||||||
int i;
|
int i;
|
||||||
double elapsed;
|
double elapsed;
|
||||||
|
2
C/p014.c
2
C/p014.c
@ -14,8 +14,6 @@
|
|||||||
*
|
*
|
||||||
* NOTE: Once the chain starts the terms are allowed to go above one million.*/
|
* NOTE: Once the chain starts the terms are allowed to go above one million.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p015.c
2
C/p015.c
@ -1,8 +1,6 @@
|
|||||||
/* 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
|
/* 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 grid?*/
|
* How many such routes are there through a 20×20 grid?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p016.c
2
C/p016.c
@ -2,8 +2,6 @@
|
|||||||
*
|
*
|
||||||
* What is the sum of the digits of the number 2^1000?*/
|
* What is the sum of the digits of the number 2^1000?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p017.c
2
C/p017.c
@ -5,8 +5,6 @@
|
|||||||
* NOTE: Do not count spaces or hyphens. For example, 342 (three hundred and forty-two) contains 23 letters and 115 (one hundred and fifteen)
|
* NOTE: Do not count spaces or hyphens. For example, 342 (three hundred and forty-two) contains 23 letters and 115 (one hundred and fifteen)
|
||||||
* contains 20 letters. The use of "and" when writing out numbers is in compliance with British usage.*/
|
* contains 20 letters. The use of "and" when writing out numbers is in compliance with British usage.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p018.c
2
C/p018.c
@ -28,8 +28,6 @@
|
|||||||
* NOTE: As there are only 16384 routes, it is possible to solve this problem by trying every route. However, Problem 67, is the same challenge
|
* NOTE: 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)*/
|
* with a triangle containing one-hundred rows; it cannot be solved by brute force, and requires a clever method! ;o)*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p019.c
2
C/p019.c
@ -11,8 +11,6 @@
|
|||||||
*
|
*
|
||||||
* How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)?*/
|
* How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p020.c
2
C/p020.c
@ -5,8 +5,6 @@
|
|||||||
*
|
*
|
||||||
* Find the sum of the digits in the number 100!*/
|
* Find the sum of the digits in the number 100!*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p021.c
2
C/p021.c
@ -6,8 +6,6 @@
|
|||||||
*
|
*
|
||||||
* Evaluate the sum of all the amicable numbers under 10000.*/
|
* Evaluate the sum of all the amicable numbers under 10000.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
2
C/p022.c
2
C/p022.c
@ -6,8 +6,6 @@
|
|||||||
*
|
*
|
||||||
* What is the total of all the name scores in the file?*/
|
* What is the total of all the name scores in the file?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
2
C/p023.c
2
C/p023.c
@ -10,8 +10,6 @@
|
|||||||
*
|
*
|
||||||
* Find the sum of all the positive integers which cannot be written as the sum of two abundant numbers.*/
|
* Find the sum of all the positive integers which cannot be written as the sum of two abundant numbers.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
2
C/p024.c
2
C/p024.c
@ -5,8 +5,6 @@
|
|||||||
*
|
*
|
||||||
* What is the millionth lexicographic permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9?*/
|
* What is the millionth lexicographic permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p025.c
2
C/p025.c
@ -19,8 +19,6 @@
|
|||||||
*
|
*
|
||||||
* What is the index of the first term in the Fibonacci sequence to contain 1000 digits?*/
|
* What is the index of the first term in the Fibonacci sequence to contain 1000 digits?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
2
C/p026.c
2
C/p026.c
@ -14,8 +14,6 @@
|
|||||||
*
|
*
|
||||||
* Find the value of d < 1000 for which 1/d contains the longest recurring cycle in its decimal fraction part.*/
|
* Find the value of d < 1000 for which 1/d contains the longest recurring cycle in its decimal fraction part.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
2
C/p027.c
2
C/p027.c
@ -17,8 +17,6 @@
|
|||||||
*
|
*
|
||||||
* Find the product of the coefficients, a and b, for the quadratic expression that produces the maximum number of primes for consecutive values of n, starting with n=0.*/
|
* Find the product of the coefficients, a and b, for the quadratic expression that produces the maximum number of primes for consecutive values of n, starting with n=0.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
2
C/p028.c
2
C/p028.c
@ -10,8 +10,6 @@
|
|||||||
*
|
*
|
||||||
* What is the sum of the numbers on the diagonals in a 1001 by 1001 spiral formed in the same way?*/
|
* What is the sum of the numbers on the diagonals in a 1001 by 1001 spiral formed in the same way?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p029.c
2
C/p029.c
@ -11,8 +11,6 @@
|
|||||||
*
|
*
|
||||||
* How many distinct terms are in the sequence generated by ab for 2 ≤ a ≤ 100 and 2 ≤ b ≤ 100?*/
|
* How many distinct terms are in the sequence generated by ab for 2 ≤ a ≤ 100 and 2 ≤ b ≤ 100?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p030.c
2
C/p030.c
@ -10,8 +10,6 @@
|
|||||||
*
|
*
|
||||||
* Find the sum of all the numbers that can be written as the sum of fifth powers of their digits.*/
|
* Find the sum of all the numbers that can be written as the sum of fifth powers of their digits.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
2
C/p031.c
2
C/p031.c
@ -8,8 +8,6 @@
|
|||||||
*
|
*
|
||||||
* How many different ways can £2 be made using any number of coins?*/
|
* How many different ways can £2 be made using any number of coins?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p032.c
2
C/p032.c
@ -7,8 +7,6 @@
|
|||||||
*
|
*
|
||||||
* HINT: Some products can be obtained in more than one way so be sure to only include it once in your sum.*/
|
* HINT: Some products can be obtained in more than one way so be sure to only include it once in your sum.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
2
C/p033.c
2
C/p033.c
@ -8,8 +8,6 @@
|
|||||||
*
|
*
|
||||||
* If the product of these four fractions is given in its lowest common terms, find the value of the denominator.*/
|
* If the product of these four fractions is given in its lowest common terms, find the value of the denominator.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p034.c
2
C/p034.c
@ -4,8 +4,6 @@
|
|||||||
*
|
*
|
||||||
* Note: as 1! = 1 and 2! = 2 are not sums they are not included.*/
|
* Note: as 1! = 1 and 2! = 2 are not sums they are not included.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p035.c
2
C/p035.c
@ -4,8 +4,6 @@
|
|||||||
*
|
*
|
||||||
* How many circular primes are there below one million?*/
|
* How many circular primes are there below one million?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
2
C/p036.c
2
C/p036.c
@ -4,8 +4,6 @@
|
|||||||
*
|
*
|
||||||
* (Please note that the palindromic number, in either base, may not include leading zeros.)*/
|
* (Please note that the palindromic number, in either base, may not include leading zeros.)*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p037.c
2
C/p037.c
@ -5,8 +5,6 @@
|
|||||||
*
|
*
|
||||||
* NOTE: 2, 3, 5, and 7 are not considered to be truncatable primes.*/
|
* NOTE: 2, 3, 5, and 7 are not considered to be truncatable primes.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
4
C/p038.c
4
C/p038.c
@ -11,8 +11,6 @@
|
|||||||
*
|
*
|
||||||
* What is the largest 1 to 9 pandigital 9-digit number that can be formed as the concatenated product of an integer with (1,2, ... , n) where n > 1?*/
|
* What is the largest 1 to 9 pandigital 9-digit number that can be formed as the concatenated product of an integer with (1,2, ... , n) where n > 1?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@ -67,7 +65,7 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
n *= 100000;
|
n *= 100000;
|
||||||
}
|
}
|
||||||
} while(n <= 987654321);
|
}while(n <= 987654321);
|
||||||
}
|
}
|
||||||
|
|
||||||
clock_gettime(CLOCK_MONOTONIC, &end);
|
clock_gettime(CLOCK_MONOTONIC, &end);
|
||||||
|
2
C/p039.c
2
C/p039.c
@ -4,8 +4,6 @@
|
|||||||
*
|
*
|
||||||
* For which value of p ≤ 1000, is the number of solutions maximised?*/
|
* For which value of p ≤ 1000, is the number of solutions maximised?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p040.c
2
C/p040.c
@ -8,8 +8,6 @@
|
|||||||
*
|
*
|
||||||
* d_1 × d_10 × d_100 × d_1000 × d_10000 × d_100000 × d_1000000*/
|
* d_1 × d_10 × d_100 × d_1000 × d_10000 × d_100000 × d_1000000*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p041.c
2
C/p041.c
@ -3,8 +3,6 @@
|
|||||||
*
|
*
|
||||||
* What is the largest n-digit pandigital prime that exists?*/
|
* What is the largest n-digit pandigital prime that exists?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
2
C/p042.c
2
C/p042.c
@ -8,8 +8,6 @@
|
|||||||
* Using words.txt (right click and 'Save Link/Target As...'), a 16K text file containing nearly two-thousand common English words,
|
* Using 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?*/
|
* how many are triangle words?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
2
C/p043.c
2
C/p043.c
@ -13,8 +13,6 @@
|
|||||||
*
|
*
|
||||||
* Find the sum of all 0 to 9 pandigital numbers with this property.*/
|
* Find the sum of all 0 to 9 pandigital numbers with this property.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p044.c
2
C/p044.c
@ -7,8 +7,6 @@
|
|||||||
* Find the pair of pentagonal numbers, Pj and Pk, for which their sum and difference are pentagonal and D = |Pk − Pj| is minimised;
|
* Find the pair of pentagonal numbers, Pj and Pk, for which their sum and difference are pentagonal and D = |Pk − Pj| is minimised;
|
||||||
* what is the value of D?*/
|
* what is the value of D?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
2
C/p045.c
2
C/p045.c
@ -8,8 +8,6 @@
|
|||||||
*
|
*
|
||||||
* Find the next triangle number that is also pentagonal and hexagonal.*/
|
* Find the next triangle number that is also pentagonal and hexagonal.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
4
C/p046.c
4
C/p046.c
@ -11,8 +11,6 @@
|
|||||||
*
|
*
|
||||||
* What is the smallest odd composite that cannot be written as the sum of a prime and twice a square?*/
|
* What is the smallest odd composite that cannot be written as the sum of a prime and twice a square?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
@ -90,7 +88,7 @@ int goldbach(int n)
|
|||||||
}
|
}
|
||||||
|
|
||||||
j++;
|
j++;
|
||||||
} while(tmp < n);
|
}while(tmp < n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
C/p047.c
2
C/p047.c
@ -11,8 +11,6 @@
|
|||||||
*
|
*
|
||||||
* Find the first four consecutive integers to have four distinct prime factors each. What is the first of these numbers?*/
|
* Find the first four consecutive integers to have four distinct prime factors each. What is the first of these numbers?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
2
C/p048.c
2
C/p048.c
@ -8,8 +8,6 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <gmp.h>
|
#include <gmp.h>
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
2
C/p049.c
2
C/p049.c
@ -6,8 +6,6 @@
|
|||||||
*
|
*
|
||||||
* What 12-digit number do you form by concatenating the three terms in this sequence?*/
|
* What 12-digit number do you form by concatenating the three terms in this sequence?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
2
C/p050.c
2
C/p050.c
@ -8,8 +8,6 @@
|
|||||||
*
|
*
|
||||||
* Which prime, below one-million, can be written as the sum of the most consecutive primes?*/
|
* Which prime, below one-million, can be written as the sum of the most consecutive primes?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
2
C/p051.c
2
C/p051.c
@ -7,8 +7,6 @@
|
|||||||
* Find the smallest prime which, by replacing part of the number (not necessarily adjacent digits) with the same digit, is part of an eight prime
|
* Find the smallest prime which, by replacing part of the number (not necessarily adjacent digits) with the same digit, is part of an eight prime
|
||||||
* value family.*/
|
* value family.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
2
C/p052.c
2
C/p052.c
@ -2,8 +2,6 @@
|
|||||||
*
|
*
|
||||||
* Find the smallest positive integer, x, such that 2x, 3x, 4x, 5x, and 6x, contain the same digits.*/
|
* Find the smallest positive integer, x, such that 2x, 3x, 4x, 5x, and 6x, contain the same digits.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p053.c
2
C/p053.c
@ -10,8 +10,6 @@
|
|||||||
*
|
*
|
||||||
* How many, not necessarily distinct, values of (n r) for 1≤n≤100, are greater than one-million?*/
|
* How many, not necessarily distinct, values of (n r) for 1≤n≤100, are greater than one-million?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
6
C/p054.c
6
C/p054.c
@ -44,8 +44,6 @@
|
|||||||
*
|
*
|
||||||
* How many hands does Player 1 win?*/
|
* How many hands does Player 1 win?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -53,14 +51,14 @@
|
|||||||
#include "projecteuler.h"
|
#include "projecteuler.h"
|
||||||
|
|
||||||
/* Define the values of the cards.*/
|
/* Define the values of the cards.*/
|
||||||
typedef enum {two, three, four, five, six, seven, eight, nine, ten, jack, queen, king, ace} values;
|
typedef enum{two, three, four, five, six, seven, eight, nine, ten, jack, queen, king, ace} values;
|
||||||
|
|
||||||
/* Define a structure for a card, with value and suit.*/
|
/* Define a structure for a card, with value and suit.*/
|
||||||
typedef struct card
|
typedef struct card
|
||||||
{
|
{
|
||||||
values value;
|
values value;
|
||||||
char suit;
|
char suit;
|
||||||
} Card;
|
}Card;
|
||||||
|
|
||||||
int eval(char *hands);
|
int eval(char *hands);
|
||||||
|
|
||||||
|
2
C/p055.c
2
C/p055.c
@ -21,8 +21,6 @@
|
|||||||
*
|
*
|
||||||
* NOTE: Wording was modified slightly on 24 April 2007 to emphasise the theoretical nature of Lychrel numbers.*/
|
* NOTE: Wording was modified slightly on 24 April 2007 to emphasise the theoretical nature of Lychrel numbers.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p056.c
2
C/p056.c
@ -3,8 +3,6 @@
|
|||||||
*
|
*
|
||||||
* Considering natural numbers of the form, a^b, where a, b < 100, what is the maximum digital sum?*/
|
* Considering natural numbers of the form, a^b, where a, b < 100, what is the maximum digital sum?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p057.c
2
C/p057.c
@ -14,8 +14,6 @@
|
|||||||
*
|
*
|
||||||
* In the first one-thousand expansions, how many fractions contain a numerator with more digits than the denominator?*/
|
* In the first one-thousand expansions, how many fractions contain a numerator with more digits than the denominator?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
4
C/p058.c
4
C/p058.c
@ -14,8 +14,6 @@
|
|||||||
* If one complete new layer is wrapped around the spiral above, a square spiral with side length 9 will be formed. If this process is continued,
|
* If one complete new layer is wrapped around the spiral above, a square spiral with side length 9 will be formed. If this process is continued,
|
||||||
* what is the side length of the square spiral for which the ratio of primes along both diagonals first falls below 10%?*/
|
* what is the side length of the square spiral for which the ratio of primes along both diagonals first falls below 10%?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
@ -65,7 +63,7 @@ int main(int argc, char **argv)
|
|||||||
diag += 4;
|
diag += 4;
|
||||||
l += 2;
|
l += 2;
|
||||||
|
|
||||||
} while(ratio >= 0.1);
|
}while(ratio >= 0.1);
|
||||||
|
|
||||||
clock_gettime(CLOCK_MONOTONIC, &end);
|
clock_gettime(CLOCK_MONOTONIC, &end);
|
||||||
|
|
||||||
|
2
C/p059.c
2
C/p059.c
@ -16,8 +16,6 @@
|
|||||||
* encrypted ASCII codes, and the knowledge that the plain text must contain common English words, decrypt the message and find the sum of the
|
* encrypted ASCII codes, and the knowledge that the plain text must contain common English words, decrypt the message and find the sum of the
|
||||||
* ASCII values in the original text.*/
|
* ASCII values in the original text.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
2
C/p060.c
2
C/p060.c
@ -4,8 +4,6 @@
|
|||||||
*
|
*
|
||||||
* Find the lowest sum for a set of five primes for which any two primes concatenate to produce another prime.*/
|
* Find the lowest sum for a set of five primes for which any two primes concatenate to produce another prime.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
14
C/p061.c
14
C/p061.c
@ -17,8 +17,6 @@
|
|||||||
* Find the sum of the only ordered set of six cyclic 4-digit numbers for which each polygonal type: triangle, square, pentagonal,
|
* Find the sum of the only ordered set of six cyclic 4-digit numbers for which each polygonal type: triangle, square, pentagonal,
|
||||||
* hexagonal, heptagonal, and octagonal, is represented by a different number in the set.*/
|
* hexagonal, heptagonal, and octagonal, is represented by a different number in the set.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@ -45,7 +43,7 @@ int main(int argc, char **argv)
|
|||||||
polygonal[0][n] = 1;
|
polygonal[0][n] = 1;
|
||||||
i++;
|
i++;
|
||||||
n = i * (i + 1) / 2;
|
n = i * (i + 1) / 2;
|
||||||
} while(n < 10000);
|
}while(n < 10000);
|
||||||
|
|
||||||
i = 1;
|
i = 1;
|
||||||
n = 1;
|
n = 1;
|
||||||
@ -56,7 +54,7 @@ int main(int argc, char **argv)
|
|||||||
polygonal[1][n] = 1;
|
polygonal[1][n] = 1;
|
||||||
i++;
|
i++;
|
||||||
n = i * i;
|
n = i * i;
|
||||||
} while(n < 10000);
|
}while(n < 10000);
|
||||||
|
|
||||||
i = 1;
|
i = 1;
|
||||||
n = 1;
|
n = 1;
|
||||||
@ -67,7 +65,7 @@ int main(int argc, char **argv)
|
|||||||
polygonal[2][n] = 1;
|
polygonal[2][n] = 1;
|
||||||
i++;
|
i++;
|
||||||
n = i * (3 * i - 1) / 2;
|
n = i * (3 * i - 1) / 2;
|
||||||
} while(n < 10000);
|
}while(n < 10000);
|
||||||
|
|
||||||
i = 1;
|
i = 1;
|
||||||
n = 1;
|
n = 1;
|
||||||
@ -78,7 +76,7 @@ int main(int argc, char **argv)
|
|||||||
polygonal[3][n] = 1;
|
polygonal[3][n] = 1;
|
||||||
i++;
|
i++;
|
||||||
n = i * (2 * i - 1);
|
n = i * (2 * i - 1);
|
||||||
} while(n < 10000);
|
}while(n < 10000);
|
||||||
|
|
||||||
i = 1;
|
i = 1;
|
||||||
n = 1;
|
n = 1;
|
||||||
@ -89,7 +87,7 @@ int main(int argc, char **argv)
|
|||||||
polygonal[4][n] = 1;
|
polygonal[4][n] = 1;
|
||||||
i++;
|
i++;
|
||||||
n = i * (5 * i - 3) / 2;
|
n = i * (5 * i - 3) / 2;
|
||||||
} while(n < 10000);
|
}while(n < 10000);
|
||||||
|
|
||||||
i = 1;
|
i = 1;
|
||||||
n = 1;
|
n = 1;
|
||||||
@ -100,7 +98,7 @@ int main(int argc, char **argv)
|
|||||||
polygonal[5][n] = 1;
|
polygonal[5][n] = 1;
|
||||||
i++;
|
i++;
|
||||||
n = i * (3 * i - 2);
|
n = i * (3 * i - 2);
|
||||||
} while(n < 10000);
|
}while(n < 10000);
|
||||||
|
|
||||||
/* Find the requested set of numbers.*/
|
/* Find the requested set of numbers.*/
|
||||||
if(find_set(0, &sum) == 0)
|
if(find_set(0, &sum) == 0)
|
||||||
|
2
C/p062.c
2
C/p062.c
@ -3,8 +3,6 @@
|
|||||||
*
|
*
|
||||||
* Find the smallest cube for which exactly five permutations of its digits are cube.*/
|
* Find the smallest cube for which exactly five permutations of its digits are cube.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p063.c
2
C/p063.c
@ -2,8 +2,6 @@
|
|||||||
*
|
*
|
||||||
* How many n-digit positive integers exist which are also an nth power?*/
|
* How many n-digit positive integers exist which are also an nth power?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
2
C/p064.c
2
C/p064.c
@ -40,8 +40,6 @@
|
|||||||
*
|
*
|
||||||
* How many continued fractions for N≤10000 have an odd period?*/
|
* How many continued fractions for N≤10000 have an odd period?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
2
C/p065.c
2
C/p065.c
@ -27,8 +27,6 @@
|
|||||||
*
|
*
|
||||||
* Find the sum of digits in the numerator of the 100th convergent of the continued fraction for e.*/
|
* Find the sum of digits in the numerator of the 100th convergent of the continued fraction for e.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
3
C/p066.c
3
C/p066.c
@ -18,8 +18,6 @@
|
|||||||
*
|
*
|
||||||
* Find the value of D ≤ 1000 in minimal solutions of x for which the largest value of x is obtained.*/
|
* Find the value of D ≤ 1000 in minimal solutions of x for which the largest value of x is obtained.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
@ -91,3 +89,4 @@ int is_square(int n)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
C/p067.c
2
C/p067.c
@ -13,8 +13,6 @@
|
|||||||
* If you could check one trillion (1012) routes every second it would take over twenty billion years to check them all.
|
* 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)*/
|
* There is an efficient algorithm to solve it. ;o)*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p068.c
2
C/p068.c
@ -43,8 +43,6 @@
|
|||||||
* O
|
* O
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
2
C/p069.c
2
C/p069.c
@ -16,8 +16,6 @@
|
|||||||
*
|
*
|
||||||
* Find the value of n ≤ 1,000,000 for which n/φ(n) is a maximum.*/
|
* Find the value of n ≤ 1,000,000 for which n/φ(n) is a maximum.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
2
C/p070.c
2
C/p070.c
@ -7,8 +7,6 @@
|
|||||||
*
|
*
|
||||||
* Find the value of n, 1 < n < 10^7, for which φ(n) is a permutation of n and the ratio n/φ(n) produces a minimum.*/
|
* Find the value of n, 1 < n < 10^7, for which φ(n) is a permutation of n and the ratio n/φ(n) produces a minimum.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
2
C/p071.c
2
C/p071.c
@ -9,8 +9,6 @@
|
|||||||
* By listing the set of reduced proper fractions for d ≤ 1,000,000 in ascending order of size, find the numerator
|
* By listing the set of reduced proper fractions for d ≤ 1,000,000 in ascending order of size, find the numerator
|
||||||
* of the fraction immediately to the left of 3/7.*/
|
* of the fraction immediately to the left of 3/7.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p072.c
2
C/p072.c
@ -8,8 +8,6 @@
|
|||||||
*
|
*
|
||||||
* How many elements would be contained in the set of reduced proper fractions for d ≤ 1,000,000?*/
|
* How many elements would be contained in the set of reduced proper fractions for d ≤ 1,000,000?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
2
C/p073.c
2
C/p073.c
@ -8,8 +8,6 @@
|
|||||||
*
|
*
|
||||||
* How many fractions lie between 1/3 and 1/2 in the sorted set of reduced proper fractions for d ≤ 12,000?*/
|
* How many fractions lie between 1/3 and 1/2 in the sorted set of reduced proper fractions for d ≤ 12,000?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p074.c
2
C/p074.c
@ -20,8 +20,6 @@
|
|||||||
*
|
*
|
||||||
* How many chains, with a starting number below one million, contain exactly sixty non-repeating terms?*/
|
* How many chains, with a starting number below one million, contain exactly sixty non-repeating terms?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p075.c
2
C/p075.c
@ -15,8 +15,6 @@
|
|||||||
*
|
*
|
||||||
* Given that L is the length of the wire, for how many values of L ≤ 1,500,000 can exactly one integer sided right angle triangle be formed?*/
|
* Given that L is the length of the wire, for how many values of L ≤ 1,500,000 can exactly one integer sided right angle triangle be formed?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p076.c
2
C/p076.c
@ -9,8 +9,6 @@
|
|||||||
*
|
*
|
||||||
* How many different ways can one hundred be written as a sum of at least two positive integers?*/
|
* How many different ways can one hundred be written as a sum of at least two positive integers?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p077.c
2
C/p077.c
@ -8,8 +8,6 @@
|
|||||||
*
|
*
|
||||||
* What is the first value which can be written as the sum of primes in over five thousand different ways?*/
|
* What is the first value which can be written as the sum of primes in over five thousand different ways?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
2
C/p078.c
2
C/p078.c
@ -11,8 +11,6 @@
|
|||||||
*
|
*
|
||||||
* Find the least value of n for which p(n) is divisible by one million.*/
|
* Find the least value of n for which p(n) is divisible by one million.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p079.c
2
C/p079.c
@ -6,8 +6,6 @@
|
|||||||
* Given that the three characters are always asked for in order, analyse the file so as to determine the shortest possible
|
* Given that the three characters are always asked for in order, analyse the file so as to determine the shortest possible
|
||||||
* secret passcode of unknown length.*/
|
* secret passcode of unknown length.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p080.c
2
C/p080.c
@ -6,8 +6,6 @@
|
|||||||
* For the first one hundred natural numbers, find the total of the digital sums of the first one hundred decimal digits
|
* For the first one hundred natural numbers, find the total of the digital sums of the first one hundred decimal digits
|
||||||
* for all the irrational square roots*/
|
* for all the irrational square roots*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
2
C/p081.c
2
C/p081.c
@ -10,8 +10,6 @@
|
|||||||
* Find the minimal path sum, in matrix.txt, a 31K text file containing a 80 by 80 matrix, from the top left to the bottom right
|
* Find the minimal path sum, in matrix.txt, a 31K text file containing a 80 by 80 matrix, from the top left to the bottom right
|
||||||
* by only moving right and down.*/
|
* by only moving right and down.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p082.c
2
C/p082.c
@ -11,8 +11,6 @@
|
|||||||
*
|
*
|
||||||
* Find the minimal path sum, in matrix.txt, a 31K text file containing a 80 by 80 matrix, from the left column to the right column.*/
|
* Find the minimal path sum, in matrix.txt, a 31K text file containing a 80 by 80 matrix, from the left column to the right column.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p083.c
2
C/p083.c
@ -12,8 +12,6 @@
|
|||||||
* Find the minimal path sum, in matrix.txt, a 31K text file containing a 80 by 80 matrix,
|
* Find the minimal path sum, in matrix.txt, a 31K text file containing a 80 by 80 matrix,
|
||||||
* from the top left to the bottom right by moving left, right, up, and down.*/
|
* from the top left to the bottom right by moving left, right, up, and down.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
17
C/p084.c
17
C/p084.c
@ -66,8 +66,6 @@
|
|||||||
*
|
*
|
||||||
* If, instead of using two 6-sided dice, two 4-sided dice are used, find the six-digit modal string.*/
|
* If, instead of using two 6-sided dice, two 4-sided dice are used, find the six-digit modal string.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -78,8 +76,7 @@
|
|||||||
/* Define the squares, the type of Community Chest cards and the type of Chance cards.*/
|
/* Define the squares, the type of Community Chest cards and the type of Chance cards.*/
|
||||||
typedef enum {GO, A1, CC1, A2, T1, R1, B1, CH1, B2, B3, JAIL,
|
typedef enum {GO, A1, CC1, A2, T1, R1, B1, CH1, B2, B3, JAIL,
|
||||||
C1, U1, C2, C3, R2, D1, CC2, D2, D3, FP, E1, CH2, E2, E3, R3, F1,
|
C1, U1, C2, C3, R2, D1, CC2, D2, D3, FP, E1, CH2, E2, E3, R3, F1,
|
||||||
F2, U2, F3, G2J, G1, G2, CC3, G3, R4, CH3, H1, T2, H2
|
F2, U2, F3, G2J, G1, G2, CC3, G3, R4, CH3, H1, T2, H2} squares;
|
||||||
} squares;
|
|
||||||
typedef enum {GO_cc, JAIL_cc, NOP_cc} cc_card;
|
typedef enum {GO_cc, JAIL_cc, NOP_cc} cc_card;
|
||||||
typedef enum {GO_ch, JAIL_ch, C1_ch, E3_ch, H2_ch, R1_ch, R_ch1, R_ch2, U_ch, M3, NOP_ch} ch_card;
|
typedef enum {GO_ch, JAIL_ch, C1_ch, E3_ch, H2_ch, R1_ch, R_ch1, R_ch2, U_ch, M3, NOP_ch} ch_card;
|
||||||
|
|
||||||
@ -168,11 +165,11 @@ void shuffle_cc(cc_card cc[])
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
i = rand() % 16;
|
i = rand() % 16;
|
||||||
} while(cc[i] != NOP_cc);
|
}while(cc[i] != NOP_cc);
|
||||||
|
|
||||||
cc[i] = c;
|
cc[i] = c;
|
||||||
c++;
|
c++;
|
||||||
} while(c < NOP_cc);
|
}while(c < NOP_cc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Shuffle the Chance cards.*/
|
/* Shuffle the Chance cards.*/
|
||||||
@ -193,11 +190,11 @@ void shuffle_ch(ch_card ch[])
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
i = rand() % 16;
|
i = rand() % 16;
|
||||||
} while(ch[i] != NOP_ch);
|
}while(ch[i] != NOP_ch);
|
||||||
|
|
||||||
ch[i] = h;
|
ch[i] = h;
|
||||||
h++;
|
h++;
|
||||||
} while(h < NOP_ch);
|
}while(h < NOP_ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Function to play Monopoly, rolling the dice N times.*/
|
/* Function to play Monopoly, rolling the dice N times.*/
|
||||||
@ -308,7 +305,7 @@ void play(long int *count_squares)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
current = (current + 1) % 40;
|
current = (current + 1) % 40;
|
||||||
} while(current != R1 && current != R2 && current != R3 && current != R4);
|
}while(current != R1 && current != R2 && current != R3 && current != R4);
|
||||||
}
|
}
|
||||||
/* Go to the next Utility company.*/
|
/* Go to the next Utility company.*/
|
||||||
else if(ch[ch_i] == U_ch)
|
else if(ch[ch_i] == U_ch)
|
||||||
@ -316,7 +313,7 @@ void play(long int *count_squares)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
current = (current + 1) % 40;
|
current = (current + 1) % 40;
|
||||||
} while(current != U1 && current != U2);
|
}while(current != U1 && current != U2);
|
||||||
}
|
}
|
||||||
/* Go back three squares.*/
|
/* Go back three squares.*/
|
||||||
else if(ch[ch_i] == M3)
|
else if(ch[ch_i] == M3)
|
||||||
|
2
C/p085.c
2
C/p085.c
@ -2,8 +2,6 @@
|
|||||||
*
|
*
|
||||||
* Although there exists no rectangular grid that contains exactly two million rectangles, find the area of the grid with the nearest solution.*/
|
* Although there exists no rectangular grid that contains exactly two million rectangles, find the area of the grid with the nearest solution.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
2
C/p086.c
2
C/p086.c
@ -9,8 +9,6 @@
|
|||||||
*
|
*
|
||||||
* Find the least value of M such that the number of solutions first exceeds one million.*/
|
* Find the least value of M such that the number of solutions first exceeds one million.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
2
C/p087.c
2
C/p087.c
@ -8,8 +8,6 @@
|
|||||||
*
|
*
|
||||||
* How many numbers below fifty million can be expressed as the sum of a prime square, prime cube, and prime fourth power?*/
|
* How many numbers below fifty million can be expressed as the sum of a prime square, prime cube, and prime fourth power?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
2
C/p089.c
2
C/p089.c
@ -19,8 +19,6 @@
|
|||||||
*
|
*
|
||||||
* Note: You can assume that all the Roman numerals in the file contain no more than four consecutive identical units.*/
|
* Note: You can assume that all the Roman numerals in the file contain no more than four consecutive identical units.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
2
C/p092.c
2
C/p092.c
@ -10,8 +10,6 @@
|
|||||||
*
|
*
|
||||||
* How many starting numbers below ten million will arrive at 89?*/
|
* How many starting numbers below ten million will arrive at 89?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p095.c
2
C/p095.c
@ -12,8 +12,6 @@
|
|||||||
*
|
*
|
||||||
* Find the smallest member of the longest amicable chain with no element exceeding one million.*/
|
* Find the smallest member of the longest amicable chain with no element exceeding one million.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
2
C/p096.c
2
C/p096.c
@ -25,8 +25,6 @@
|
|||||||
* By solving all fifty puzzles find the sum of the 3-digit numbers found in the top left corner of each solution grid;
|
* By solving all fifty puzzles find the sum of the 3-digit numbers found in the top left corner of each solution grid;
|
||||||
* for example, 483 is the 3-digit number found in the top left corner of the solution grid above.*/
|
* for example, 483 is the 3-digit number found in the top left corner of the solution grid above.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p097.c
2
C/p097.c
@ -5,8 +5,6 @@
|
|||||||
*
|
*
|
||||||
* Find the last ten digits of this prime number.*/
|
* Find the last ten digits of this prime number.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p099.c
2
C/p099.c
@ -8,8 +8,6 @@
|
|||||||
*
|
*
|
||||||
* NOTE: The first two lines in the file represent the numbers in the example given above.*/
|
* NOTE: The first two lines in the file represent the numbers in the example given above.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
4
C/p102.c
4
C/p102.c
@ -12,8 +12,6 @@
|
|||||||
*
|
*
|
||||||
* NOTE: The first two examples in the file represent the triangles in the example given above.*/
|
* NOTE: The first two examples in the file represent the triangles in the example given above.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
@ -23,7 +21,7 @@ typedef struct point
|
|||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
} point;
|
}point;
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
2
C/p104.c
2
C/p104.c
@ -7,8 +7,6 @@
|
|||||||
*
|
*
|
||||||
* Given that F_k is the first Fibonacci number for which the first nine digits AND the last nine digits are 1-9 pandigital, find k.*/
|
* Given that F_k is the first Fibonacci number for which the first nine digits AND the last nine digits are 1-9 pandigital, find k.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p112.c
2
C/p112.c
@ -11,8 +11,6 @@
|
|||||||
*
|
*
|
||||||
* Find the least number for which the proportion of bouncy numbers is exactly 99%.*/
|
* Find the least number for which the proportion of bouncy numbers is exactly 99%.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
4
C/p124.c
4
C/p124.c
@ -19,8 +19,6 @@
|
|||||||
*
|
*
|
||||||
* If rad(n) is sorted for 1 ≤ n ≤ 100000, find E(10000).*/
|
* If rad(n) is sorted for 1 ≤ n ≤ 100000, find E(10000).*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
@ -33,7 +31,7 @@ typedef struct n_rad
|
|||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
int radn;
|
int radn;
|
||||||
} n_radn;
|
}n_radn;
|
||||||
|
|
||||||
int compare(void *a, void *b);
|
int compare(void *a, void *b);
|
||||||
|
|
||||||
|
2
C/p145.c
2
C/p145.c
@ -6,8 +6,6 @@
|
|||||||
*
|
*
|
||||||
* How many reversible numbers are there below one-billion (109)?*/
|
* How many reversible numbers are there below one-billion (109)?*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
2
C/p206.c
2
C/p206.c
@ -1,8 +1,6 @@
|
|||||||
/* Find the unique positive integer whose square has the form 1_2_3_4_5_6_7_8_9_0,
|
/* Find the unique positive integer whose square has the form 1_2_3_4_5_6_7_8_9_0,
|
||||||
* where each “_” is a single digit.*/
|
* where each “_” is a single digit.*/
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE 199309L
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user