Compare commits

..

No commits in common. "71e426257eb23df3dc4bc8c806ad451a9bf5be82" and "f09f056c87ef9cdfcbab60836a473fb0eb3d5e02" have entirely different histories.

174 changed files with 7746 additions and 7869 deletions

1
.gitignore vendored
View File

@ -1,3 +1,2 @@
Python/__pycache__ Python/__pycache__
ProblemsOverviews/* ProblemsOverviews/*
Haskell/.stack-work

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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;

View File

@ -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>

View File

@ -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;

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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;

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -10,8 +10,6 @@
* *
* How many, not necessarily distinct, values of (n r) for 1n100, are greater than one-million?*/ * How many, not necessarily distinct, values of (n r) for 1n100, 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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -40,8 +40,6 @@
* *
* How many continued fractions for N10000 have an odd period?*/ * How many continued fractions for N10000 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>

View File

@ -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>

View File

@ -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;
} }
} }

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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;

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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