Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion project_euler/problems/004_largest_palindrome_product.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ http://projecteuler.net/problem=004

Largest palindrome product

A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 99.
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 x 99.
Find the largest palindrome made from the product of two 3-digit numbers.

2 changes: 1 addition & 1 deletion project_euler/problems/006_sum_square_difference.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ The sum of the squares of the first ten natural numbers is,
12 + 22 + ... + 102 = 385
The square of the sum of the first ten natural numbers is,
(1 + 2 + ... + 10)2 = 552 = 3025
Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 385 = 2640.
Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 - 385 = 2640.
Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.

2 changes: 1 addition & 1 deletion project_euler/problems/009_special_pythagorean_triplet.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ http://projecteuler.net/problem=009

Special Pythagorean triplet

A Pythagorean triplet is a set of three natural numbers, a b c, for which,
A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,
a2 + b2 = c2
For example, 32 + 42 = 9 + 16 = 25 = 52.
There exists exactly one Pythagorean triplet for which a + b + c = 1000.Find the product abc.
Expand Down
4 changes: 2 additions & 2 deletions project_euler/problems/020_factorial_digit_sum.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ http://projecteuler.net/problem=020

Factorial digit sum

n! means n (n 1) ... 3 2 1
For example, 10! = 10 9 ... 3 2 1 = 3628800,and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27.
n! means n x (n 1) x ... x 3 x 2 x 1
For example, 10! = 10 x 9 x ... x 3 x 2 x 1 = 3628800, and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27.
Find the sum of the digits in the number 100!

2 changes: 1 addition & 1 deletion project_euler/problems/021_amicable_numbers.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ http://projecteuler.net/problem=021
Amicable numbers

Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n).
If d(a) = b and d(b) = a, where a b, then a and b are an amicable pair and each of a and b are called amicable numbers.
If d(a) = b and d(b) = a, where a <> b, then a and b are an amicable pair and each of a and b are called amicable numbers.
For example, the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110; therefore d(220) = 284. The proper divisors of 284 are 1, 2, 4, 71 and 142; so d(284) = 220.
Evaluate the sum of all the amicable numbers under 10000.

2 changes: 1 addition & 1 deletion project_euler/problems/022_names_scores.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ http://projecteuler.net/problem=022
Names scores

Using names.txt (right click and 'Save Link/Target As...'), a 46K text file containing over five-thousand first names, begin by sorting it into alphabetical order. Then working out the alphabetical value for each name, multiply this value by its alphabetical position in the list to obtain a name score.
For example, when the list is sorted into alphabetical order, COLIN, which is worth 3 + 15 + 12 + 9 + 14 = 53, is the 938th name in the list. So, COLIN would obtain a score of 938 53 = 49714.
For example, when the list is sorted into alphabetical order, COLIN, which is worth 3 + 15 + 12 + 9 + 14 = 53, is the 938th name in the list. So, COLIN would obtain a score of 938 x 53 = 49714.
What is the total of all the name scores in the file?

22 changes: 11 additions & 11 deletions project_euler/problems/025_1000_digit_fibonacci_number.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ http://projecteuler.net/problem=025
The Fibonacci sequence is defined by the recurrence relation:
Fn = Fn1 + Fn2, where F1 = 1 and F2 = 1.
Hence the first 12 terms will be:
F1 = 1
F2 = 1
F3 = 2
F4 = 3
F5 = 5
F6 = 8
F7 = 13
F8 = 21
F9 = 34
F10 = 55
F11 = 89
F1 = 1
F2 = 1
F3 = 2
F4 = 3
F5 = 5
F6 = 8
F7 = 13
F8 = 21
F9 = 34
F10 = 55
F11 = 89
F12 = 144
The 12th term, F12, is the first term to contain three digits.
What is the first term in the Fibonacci sequence to contain 1000 digits?
Expand Down
12 changes: 6 additions & 6 deletions project_euler/problems/046_goldbachs_other_conjecture.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ http://projecteuler.net/problem=046
Goldbach's other conjecture

It was proposed by Christian Goldbach that every odd composite number can be written as the sum of a prime and twice a square.
9 = 7 + 212
15 = 7 + 222
21 = 3 + 232
25 = 7 + 232
27 = 19 + 222
33 = 31 + 212
9 = 7 + 2 x 12
15 = 7 + 2 x 22
21 = 3 + 2 x 32
25 = 7 + 2 x 32
27 = 19 + 2 x 22
33 = 31 + 2 x 12
It turns out that the conjecture was false.
What is the smallest odd composite that cannot be written as the sum of a prime and twice a square?

8 changes: 4 additions & 4 deletions project_euler/problems/057_square_root_convergents.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ http://projecteuler.net/problem=057
Square root convergents

It is possible to show that the square root of two can be expressed as an infinite continued fraction.
2 = 1 + 1/(2 + 1/(2 + 1/(2 + ... ))) = 1.414213...
2 = 1 + 1/(2 + 1/(2 + 1/(2 + ... ))) = 1.414213...
By expanding this for the first four iterations, we get:
1 + 1/2 = 3/2 = 1.5
1 + 1/(2 + 1/2) = 7/5 = 1.4
1 + 1/(2 + 1/(2 + 1/2)) = 17/12 = 1.41666...
1 + 1/2 = 3/2 = 1.5
1 + 1/(2 + 1/2) = 7/5 = 1.4
1 + 1/(2 + 1/(2 + 1/2)) = 17/12 = 1.41666...
1 + 1/(2 + 1/(2 + 1/(2 + 1/2))) = 41/29 = 1.41379...
The next three expansions are 99/70, 239/169, and 577/408, but the eighth expansion, 1393/985, is the first example where the number of digits in the numerator exceeds the number of digits in the denominator.
In the first one-thousand expansions, how many fractions contain a numerator with more digits than denominator?
Expand Down
8 changes: 4 additions & 4 deletions project_euler/problems/061_cyclical_figurate_numbers.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,28 @@ P4,n=n2

Pentagonal

P5,n=n(3n1)/2
P5,n=n(3n-1)/2

1, 5, 12, 22, 35, ...


Hexagonal

P6,n=n(2n1)
P6,n=n(2n-1)

1, 6, 15, 28, 45, ...


Heptagonal

P7,n=n(5n3)/2
P7,n=n(5n-3)/2

1, 7, 18, 34, 55, ...


Octagonal

P8,n=n(3n2)
P8,n=n(3n-2)

1, 8, 21, 40, 65, ...

Expand Down
86 changes: 43 additions & 43 deletions project_euler/problems/064_odd_period_square_roots.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ All square roots are periodic when written as continued fractions and can be wri



N = a0 +
N = a0 +
1


Expand All @@ -28,29 +28,29 @@ a3 + ...



For example, let us consider 23:
For example, let us consider 23:



23 = 4 + 23 — 4 = 4 + 
23 = 4 + 23 — 4 = 4 + 
1
 = 4 + 
1



123—4
1√23—4

1 + 
23 – 37
23 – 37



If we continue we would get the following expansion:



23 = 4 +
23 = 4 +
1


Expand Down Expand Up @@ -86,89 +86,89 @@ The process can be summarised as follows:

a0 = 4,

123—4
1√23—4
 = 
23+47
23+47
 = 1 + 
23—37
23—37


a1 = 1,

723—3
7√23—3
 = 
7(23+3)14
7(23+3)14
 = 3 + 
23—32
23—32


a2 = 3,

223—3
2√23—3
 = 
2(23+3)14
2(23+3)14
 = 1 + 
23—47
23—47


a3 = 1,

723—4
7√23—4
 = 
7(23+4)7
7(23+4)7
 = 8 + 
23—4
23—4


a4 = 8,

123—4
1√23—4
 = 
23+47
23+47
 = 1 + 
23—37
23—37


a5 = 1,

723—3
7√23—3
 = 
7(23+3)14
7(23+3)14
 = 3 + 
23—32
23—32


a6 = 3,

223—3
2√23—3
 = 
2(23+3)14
2(23+3)14
 = 1 + 
23—47
23—47


a7 = 1,

723—4
7√23—4
 = 
7(23+4)7
7(23+4)7
 = 8 + 
23—4
23—4



It can be seen that the sequence is repeating. For conciseness, we use the notation 23 = [4;(1,3,1,8)], to indicate that the block (1,3,1,8) repeats indefinitely.
It can be seen that the sequence is repeating. For conciseness, we use the notation 23 = [4;(1,3,1,8)], to indicate that the block (1,3,1,8) repeats indefinitely.
The first ten continued fraction representations of (irrational) square roots are:
2=[1;(2)], period=1
3=[1;(1,2)], period=2
5=[2;(4)], period=1
6=[2;(2,4)], period=2
7=[2;(1,1,1,4)], period=4
8=[2;(1,4)], period=2
10=[3;(6)], period=1
11=[3;(3,6)], period=2
12= [3;(2,6)], period=2
13=[3;(1,1,1,1,6)], period=5
Exactly four continued fractions, for N 13, have an odd period.
How many continued fractions for N 10000 have an odd period?
2=[1;(2)], period=1
3=[1;(1,2)], period=2
5=[2;(4)], period=1
6=[2;(2,4)], period=2
7=[2;(1,1,1,4)], period=4
8=[2;(1,4)], period=2
10=[3;(6)], period=1
11=[3;(3,6)], period=2
12= [3;(2,6)], period=2
13=[3;(1,1,1,1,6)], period=5
Exactly four continued fractions, for N <= 13, have an odd period.
How many continued fractions for N <= 10000 have an odd period?

8 changes: 4 additions & 4 deletions project_euler/problems/065_convergents_of_e.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The square root of 2 can be written as an infinite continued fraction.



2 = 1 +
2 = 1 +
1


Expand Down Expand Up @@ -36,8 +36,8 @@ The square root of 2 can be written as an infinite continued fraction.



The infinite continued fraction can be written, 2 = [1;(2)], (2) indicates that 2 repeats ad infinitum. In a similar way, 23 = [4;(1,3,1,8)].
It turns out that the sequence of partial values of continued fractions for square roots provide the best rational approximations. Let us consider the convergents for 2.
The infinite continued fraction can be written, 2 = [1;(2)], (2) indicates that 2 repeats ad infinitum. In a similar way, 23 = [4;(1,3,1,8)].
It turns out that the sequence of partial values of continued fractions for square roots provide the best rational approximations. Let us consider the convergents for 2.



Expand Down Expand Up @@ -132,7 +132,7 @@ It turns out that the sequence of partial values of continued fractions for squa



Hence the sequence of the first ten convergents for 2 are:
Hence the sequence of the first ten convergents for 2 are:
1, 3/2, 7/5, 17/12, 41/29, 99/70, 239/169, 577/408, 1393/985, 3363/2378, ...
What is most surprising is that the important mathematical constant,e = [2; 1,2,1, 1,4,1, 1,6,1 , ... , 1,2k,1, ...].
The first ten terms in the sequence of convergents for e are:
Expand Down
17 changes: 8 additions & 9 deletions project_euler/problems/066_diophantine_equation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ http://projecteuler.net/problem=066
Diophantine equation

Consider quadratic Diophantine equations of the form:
x2 Dy2 = 1
For example, when D=13, the minimal solution in x is 6492 – 131802 = 1.
x2 - Dy2 = 1
For example, when D=13, the minimal solution in x is 6492 - 13 x 1802 = 1.
It can be assumed that there are no solutions in positive integers when D is square.
By finding minimal solutions in x for D = {2, 3, 5, 6, 7}, we obtain the following:
32 – 222 = 1
22 – 312 = 1
92 – 542 = 1
52 – 622 = 1
82 – 732 = 1
Hence, by considering minimal solutions in x for D 7, the largest x is obtained when D=5.
Find the value of D 1000 in minimal solutions of x for which the largest value of x is obtained.
32 - 2 x 22 = 1
22 - 3 x 12 = 192 - 5 x 42 = 1
52 - 6 x 22 = 1
82 - 7 x 32 = 1
Hence, by considering minimal solutions in x for D <= 7, the largest x is obtained when D=5.
Find the value of D <= 1000 in minimal solutions of x for which the largest value of x is obtained.

4 changes: 2 additions & 2 deletions project_euler/problems/069_totient_maximum.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ n/φ(n)



It can be seen that n=6 produces a maximum n/φ(n) for n 10.
Find the value of n 1,000,000 for which n/φ(n) is a maximum.
It can be seen that n=6 produces a maximum n/φ(n) for n <= 10.
Find the value of n <= 1,000,000 for which n/φ(n) is a maximum.

2 changes: 1 addition & 1 deletion project_euler/problems/070_totient_permutation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ Totient permutation

Euler's Totient function, φ(n) [sometimes called the phi function], is used to determine the number of positive numbers less than or equal to n which are relatively prime to n. For example, as 1, 2, 4, 5, 7, and 8, are all less than nine and relatively prime to nine, φ(9)=6.The number 1 is considered to be relatively prime to every positive number, so φ(1)=1.
Interestingly, φ(87109)=79180, and it can be seen that 87109 is a permutation of 79180.
Find the value of n, 1 n 107, for which φ(n) is a permutation of n and the ratio n/φ(n) produces a minimum.
Find the value of n, 1 < n < 107, for which φ(n) is a permutation of n and the ratio n/φ(n) produces a minimum.

2 changes: 1 addition & 1 deletion project_euler/problems/071_ordered_fractions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ http://projecteuler.net/problem=071

Ordered fractions

Consider the fraction, n/d, where n and d are positive integers. If nd and HCF(n,d)=1, it is called a reduced proper fraction.
Consider the fraction, n/d, where n and d are positive integers. If n<=d and HCF(n,d)=1, it is called a reduced proper fraction.
If we list the set of reduced proper fractions for d <= 8 in ascending order of size, we get:

1/8, 1/7, 1/6, 1/5, 1/4, 2/7, 1/3, 3/8, 2/5, 3/7, 1/2, 4/7, 3/5, 5/8, 2/3, 5/7, 3/4, 4/5, 5/6, 6/7, 7/8
Expand Down
Loading