euler-manager 0.0.6 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +13 -0
- data/data/images/sod_13.gif +4 -0
- data/data/problems/100.yml +1 -1
- data/data/problems/101.yml +16 -16
- data/data/problems/102.yml +2 -3
- data/data/problems/103.yml +16 -16
- data/data/problems/105.yml +2 -2
- data/data/problems/106.yml +2 -2
- data/data/problems/107.yml +15 -15
- data/data/problems/108.yml +13 -16
- data/data/problems/109.yml +16 -17
- data/data/problems/11.yml +22 -23
- data/data/problems/110.yml +9 -10
- data/data/problems/114.yml +30 -41
- data/data/problems/116.yml +19 -25
- data/data/problems/117.yml +24 -33
- data/data/problems/120.yml +3 -3
- data/data/problems/122.yml +18 -20
- data/data/problems/123.yml +2 -2
- data/data/problems/124.yml +18 -23
- data/data/problems/126.yml +10 -11
- data/data/problems/127.yml +7 -7
- data/data/problems/128.yml +1 -1
- data/data/problems/130.yml +6 -7
- data/data/problems/131.yml +1 -1
- data/data/problems/132.yml +1 -1
- data/data/problems/134.yml +2 -2
- data/data/problems/135.yml +2 -2
- data/data/problems/136.yml +2 -2
- data/data/problems/137.yml +4 -4
- data/data/problems/138.yml +4 -4
- data/data/problems/139.yml +1 -1
- data/data/problems/14.yml +12 -13
- data/data/problems/140.yml +3 -3
- data/data/problems/142.yml +1 -1
- data/data/problems/143.yml +2 -2
- data/data/problems/144.yml +3 -3
- data/data/problems/147.yml +1 -1
- data/data/problems/149.yml +11 -13
- data/data/problems/15.yml +3 -3
- data/data/problems/150.yml +8 -8
- data/data/problems/151.yml +1 -1
- data/data/problems/152.yml +1 -1
- data/data/problems/153.yml +24 -26
- data/data/problems/154.yml +10 -9
- data/data/problems/155.yml +3 -3
- data/data/problems/156.yml +7 -8
- data/data/problems/157.yml +3 -4
- data/data/problems/158.yml +4 -5
- data/data/problems/159.yml +3 -3
- data/data/problems/161.yml +5 -4
- data/data/problems/163.yml +10 -10
- data/data/problems/165.yml +1 -1
- data/data/problems/166.yml +7 -7
- data/data/problems/167.yml +3 -4
- data/data/problems/168.yml +5 -5
- data/data/problems/170.yml +2 -2
- data/data/problems/171.yml +3 -3
- data/data/problems/173.yml +1 -1
- data/data/problems/174.yml +3 -3
- data/data/problems/175.yml +4 -4
- data/data/problems/177.yml +1 -1
- data/data/problems/179.yml +1 -1
- data/data/problems/180.yml +8 -9
- data/data/problems/182.yml +22 -24
- data/data/problems/183.yml +14 -15
- data/data/problems/184.yml +2 -2
- data/data/problems/186.yml +10 -11
- data/data/problems/187.yml +6 -8
- data/data/problems/189.yml +10 -9
- data/data/problems/190.yml +1 -1
- data/data/problems/192.yml +11 -12
- data/data/problems/194.yml +8 -8
- data/data/problems/195.yml +2 -2
- data/data/problems/197.yml +5 -6
- data/data/problems/198.yml +11 -12
- data/data/problems/199.yml +7 -7
- data/data/problems/20.yml +8 -10
- data/data/problems/202.yml +1 -1
- data/data/problems/207.yml +4 -4
- data/data/problems/208.yml +4 -5
- data/data/problems/21.yml +5 -6
- data/data/problems/210.yml +4 -5
- data/data/problems/211.yml +1 -1
- data/data/problems/212.yml +22 -26
- data/data/problems/213.yml +5 -6
- data/data/problems/214.yml +8 -9
- data/data/problems/215.yml +4 -4
- data/data/problems/216.yml +5 -5
- data/data/problems/217.yml +8 -10
- data/data/problems/218.yml +1 -1
- data/data/problems/22.yml +1 -1
- data/data/problems/220.yml +15 -15
- data/data/problems/221.yml +4 -5
- data/data/problems/223.yml +5 -6
- data/data/problems/224.yml +5 -6
- data/data/problems/226.yml +8 -8
- data/data/problems/228.yml +4 -5
- data/data/problems/229.yml +16 -16
- data/data/problems/230.yml +4 -4
- data/data/problems/231.yml +4 -5
- data/data/problems/233.yml +1 -1
- data/data/problems/234.yml +9 -10
- data/data/problems/236.yml +4 -4
- data/data/problems/237.yml +3 -3
- data/data/problems/238.yml +3 -4
- data/data/problems/241.yml +4 -4
- data/data/problems/242.yml +2 -2
- data/data/problems/243.yml +12 -12
- data/data/problems/244.yml +10 -11
- data/data/problems/245.yml +14 -15
- data/data/problems/246.yml +10 -9
- data/data/problems/247.yml +12 -13
- data/data/problems/251.yml +3 -3
- data/data/problems/252.yml +6 -7
- data/data/problems/254.yml +2 -2
- data/data/problems/255.yml +35 -36
- data/data/problems/256.yml +16 -20
- data/data/problems/257.yml +9 -9
- data/data/problems/258.yml +5 -6
- data/data/problems/26.yml +1 -1
- data/data/problems/260.yml +6 -8
- data/data/problems/261.yml +6 -7
- data/data/problems/262.yml +1 -1
- data/data/problems/264.yml +10 -11
- data/data/problems/265.yml +1 -1
- data/data/problems/27.yml +10 -11
- data/data/problems/270.yml +3 -3
- data/data/problems/271.yml +5 -6
- data/data/problems/272.yml +6 -7
- data/data/problems/273.yml +3 -3
- data/data/problems/274.yml +15 -15
- data/data/problems/275.yml +3 -3
- data/data/problems/276.yml +3 -3
- data/data/problems/277.yml +3 -3
- data/data/problems/278.yml +15 -17
- data/data/problems/281.yml +4 -4
- data/data/problems/282.yml +2 -2
- data/data/problems/284.yml +7 -8
- data/data/problems/287.yml +18 -17
- data/data/problems/288.yml +1 -1
- data/data/problems/289.yml +1 -1
- data/data/problems/29.yml +12 -13
- data/data/problems/290.yml +1 -1
- data/data/problems/291.yml +3 -3
- data/data/problems/292.yml +1 -1
- data/data/problems/293.yml +7 -7
- data/data/problems/295.yml +8 -8
- data/data/problems/296.yml +4 -5
- data/data/problems/297.yml +4 -5
- data/data/problems/299.yml +11 -12
- data/data/problems/300.yml +10 -9
- data/data/problems/301.yml +2 -2
- data/data/problems/303.yml +3 -3
- data/data/problems/304.yml +6 -7
- data/data/problems/305.yml +3 -2
- data/data/problems/306.yml +8 -11
- data/data/problems/307.yml +2 -3
- data/data/problems/309.yml +8 -8
- data/data/problems/31.yml +1 -1
- data/data/problems/310.yml +6 -7
- data/data/problems/311.yml +11 -11
- data/data/problems/312.yml +5 -5
- data/data/problems/313.yml +4 -4
- data/data/problems/314.yml +4 -5
- data/data/problems/315.yml +26 -27
- data/data/problems/316.yml +2 -4
- data/data/problems/318.yml +27 -34
- data/data/problems/319.yml +11 -12
- data/data/problems/32.yml +1 -1
- data/data/problems/320.yml +1 -1
- data/data/problems/321.yml +3 -3
- data/data/problems/322.yml +4 -4
- data/data/problems/323.yml +7 -8
- data/data/problems/324.yml +8 -9
- data/data/problems/325.yml +1 -1
- data/data/problems/326.yml +2 -2
- data/data/problems/327.yml +27 -29
- data/data/problems/328.yml +2 -2
- data/data/problems/330.yml +13 -14
- data/data/problems/331.yml +12 -12
- data/data/problems/332.yml +10 -9
- data/data/problems/333.yml +15 -16
- data/data/problems/334.yml +14 -14
- data/data/problems/335.yml +2 -2
- data/data/problems/336.yml +5 -4
- data/data/problems/337.yml +7 -7
- data/data/problems/338.yml +21 -24
- data/data/problems/340.yml +6 -7
- data/data/problems/341.yml +3 -5
- data/data/problems/342.yml +6 -7
- data/data/problems/343.yml +8 -12
- data/data/problems/344.yml +1 -1
- data/data/problems/347.yml +8 -8
- data/data/problems/350.yml +5 -5
- data/data/problems/351.yml +1 -1
- data/data/problems/352.yml +25 -26
- data/data/problems/353.yml +1 -1
- data/data/problems/354.yml +6 -6
- data/data/problems/356.yml +2 -3
- data/data/problems/358.yml +13 -14
- data/data/problems/359.yml +1 -1
- data/data/problems/361.yml +2 -1
- data/data/problems/362.yml +11 -13
- data/data/problems/363.yml +6 -6
- data/data/problems/364.yml +3 -3
- data/data/problems/365.yml +2 -2
- data/data/problems/366.yml +4 -5
- data/data/problems/369.yml +1 -1
- data/data/problems/370.yml +3 -3
- data/data/problems/372.yml +6 -8
- data/data/problems/374.yml +5 -7
- data/data/problems/375.yml +5 -6
- data/data/problems/377.yml +2 -2
- data/data/problems/378.yml +2 -2
- data/data/problems/379.yml +7 -8
- data/data/problems/38.yml +9 -9
- data/data/problems/380.yml +12 -15
- data/data/problems/381.yml +8 -11
- data/data/problems/382.yml +6 -6
- data/data/problems/383.yml +4 -4
- data/data/problems/384.yml +7 -8
- data/data/problems/385.yml +8 -8
- data/data/problems/386.yml +2 -2
- data/data/problems/388.yml +5 -6
- data/data/problems/39.yml +1 -1
- data/data/problems/390.yml +4 -6
- data/data/problems/391.yml +11 -12
- data/data/problems/392.yml +1 -1
- data/data/problems/393.yml +2 -2
- data/data/problems/394.yml +6 -7
- data/data/problems/395.yml +5 -5
- data/data/problems/396.yml +15 -17
- data/data/problems/397.yml +5 -8
- data/data/problems/4.yml +1 -1
- data/data/problems/40.yml +1 -1
- data/data/problems/400.yml +5 -6
- data/data/problems/401.yml +2 -2
- data/data/problems/402.yml +7 -8
- data/data/problems/403.yml +9 -10
- data/data/problems/404.yml +5 -6
- data/data/problems/405.yml +7 -7
- data/data/problems/406.yml +8 -10
- data/data/problems/407.yml +9 -9
- data/data/problems/410.yml +5 -6
- data/data/problems/411.yml +11 -12
- data/data/problems/412.yml +9 -9
- data/data/problems/414.yml +13 -15
- data/data/problems/415.yml +2 -2
- data/data/problems/417.yml +4 -5
- data/data/problems/418.yml +7 -8
- data/data/problems/419.yml +8 -8
- data/data/problems/420.yml +5 -5
- data/data/problems/421.yml +11 -12
- data/data/problems/422.yml +9 -9
- data/data/problems/423.yml +5 -7
- data/data/problems/424.yml +8 -9
- data/data/problems/425.yml +2 -3
- data/data/problems/426.yml +3 -3
- data/data/problems/427.yml +8 -8
- data/data/problems/428.yml +16 -19
- data/data/problems/430.yml +4 -5
- data/data/problems/44.yml +3 -3
- data/data/problems/45.yml +2 -2
- data/data/problems/46.yml +8 -8
- data/data/problems/47.yml +6 -10
- data/data/problems/53.yml +8 -9
- data/data/problems/56.yml +1 -1
- data/data/problems/57.yml +5 -5
- data/data/problems/58.yml +1 -1
- data/data/problems/6.yml +1 -1
- data/data/problems/61.yml +4 -4
- data/data/problems/64.yml +39 -46
- data/data/problems/65.yml +13 -14
- data/data/problems/66.yml +10 -10
- data/data/problems/68.yml +4 -5
- data/data/problems/69.yml +2 -2
- data/data/problems/70.yml +3 -4
- data/data/problems/71.yml +3 -3
- data/data/problems/72.yml +3 -3
- data/data/problems/73.yml +3 -3
- data/data/problems/74.yml +15 -22
- data/data/problems/75.yml +1 -1
- data/data/problems/8.yml +14 -14
- data/data/problems/81.yml +7 -7
- data/data/problems/82.yml +4 -4
- data/data/problems/83.yml +4 -4
- data/data/problems/85.yml +1 -1
- data/data/problems/86.yml +8 -8
- data/data/problems/88.yml +22 -27
- data/data/problems/9.yml +6 -6
- data/data/problems/90.yml +13 -13
- data/data/problems/91.yml +8 -8
- data/data/problems/92.yml +7 -9
- data/data/problems/93.yml +9 -10
- data/data/problems/95.yml +1 -1
- data/data/problems/96.yml +17 -17
- data/data/problems/97.yml +2 -2
- data/data/problems/99.yml +2 -2
- data/lib/euler/problem.rb +6 -1
- data/lib/euler/version.rb +1 -1
- metadata +2 -2
data/data/problems/47.yml
CHANGED
@@ -3,14 +3,10 @@
|
|
3
3
|
:name: Distinct primes factors
|
4
4
|
:url: http://projecteuler.net/problem=47
|
5
5
|
:content: "The first two consecutive numbers to have two distinct prime factors are:\n\n14
|
6
|
-
= 2 
|
6
|
+
= 2  7 \n15 = 3 
|
8
7
|
5\n\nThe first three consecutive numbers to have three distinct prime factors are:\n\n644
|
9
|
-
= 2²  19.\n\nFind
|
15
|
-
the first four consecutive integers to have four distinct prime factors. What is
|
16
|
-
the first of these numbers?\n\n"
|
8
|
+
= 2²  7 
|
9
|
+
23 \n645 = 3  5 
|
10
|
+
43 \n646 = 2  17 
|
11
|
+
19.\n\nFind the first four consecutive integers to have four distinct prime factors.
|
12
|
+
What is the first of these numbers?\n\n"
|
data/data/problems/53.yml
CHANGED
@@ -7,13 +7,12 @@
|
|
7
7
|
notation, <sup>5</sup>C<sub>3</sub> = 10.\n\nIn general,\n\n| <sup><var>n</var></sup>C<sub><var>r</var></sub>
|
8
8
|
= | \n<var>n</var>! \n<var>r</var>!(<var>n<img src=\"%7B%7B%20images_dir%20%7D%7D/symbol_minus.gif\"
|
9
9
|
width=\"9\" height=\"3\" alt=\"−\" border=\"0\" style=\"vertical-align:middle;\">r</var>)!\n
|
10
|
-
| ,where <var>r</var> 
|
10
|
+
| ,where <var>r</var>  <var>n</var>, <var>n</var>!
|
11
|
+
= <var>n</var> (<var>n</var> 1) ... 3 2 1, and 0! = 1. |\n\nIt is not until <var>n</var> = 23, that
|
15
|
+
a value exceeds one-million: <sup>23</sup>C<sub>10</sub> = 1144066.\n\nHow many,
|
16
|
+
not necessarily distinct, values of <sup><var>n</var></sup>C<sub><var>r</var></sub>,
|
17
|
+
for 1  <var>n</var> 
|
19
18
|
100, are greater than one-million?\n\n"
|
data/data/problems/56.yml
CHANGED
@@ -5,5 +5,5 @@
|
|
5
5
|
:content: |+
|
6
6
|
A googol (10<sup>100</sup>) is a massive number: one followed by one-hundred zeros; 100<sup>100</sup> is almost unimaginably large: one followed by two-hundred zeros. Despite their size, the sum of the digits in each number is only 1.
|
7
7
|
|
8
|
-
Considering natural numbers of the form, _a<sup>b</sup>_, where _a, b_  100, what is the maximum digital sum?
|
9
9
|
|
data/data/problems/57.yml
CHANGED
@@ -3,11 +3,11 @@
|
|
3
3
|
:name: Square root convergents
|
4
4
|
:url: http://projecteuler.net/problem=57
|
5
5
|
:content: "It is possible to show that the square root of two can be expressed as
|
6
|
-
an infinite continued fraction.\n\n 2 = 1
|
7
|
+
+ 1/(2 + 1/(2 + 1/(2 + ... ))) = 1.414213...\n\nBy expanding this for the first
|
8
|
+
four iterations, we get:\n\n1 + 1/2 = 3/2 = 1.5 \n\r1 + 1/(2 + 1/2) = 7/5 = 1.4
|
9
|
+
\ \n\r1 + 1/(2 + 1/(2 + 1/2)) = 17/12 = 1.41666... \n\r1 + 1/(2 + 1/(2 + 1/(2 +
|
10
|
+
1/2))) = 41/29 = 1.41379...\n\nThe next three expansions are 99/70, 239/169, and
|
11
11
|
577/408, but the eighth expansion, 1393/985, is the first example where the number
|
12
12
|
of digits in the numerator exceeds the number of digits in the denominator.\n\nIn
|
13
13
|
the first one-thousand expansions, how many fractions contain a numerator with more
|
data/data/problems/58.yml
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
\ \n\r41 20 **7** 8 9 10 27 \n\r42 21 22 23 24 25 26 \n**43** 44 45 46 47
|
9
9
|
48 49\n\nIt is interesting to note that the odd squares lie along the bottom right
|
10
10
|
diagonal, but what is more interesting is that 8 out of the 13 numbers lying along
|
11
|
-
both diagonals are prime; that is, a ratio of 8/13 
|
12
12
|
62%.\n\nIf one complete new layer is wrapped around the spiral above, a square spiral
|
13
13
|
with side length 9 will be formed. If this process is continued, what is the side
|
14
14
|
length of the square spiral for which the ratio of primes along both diagonals first
|
data/data/problems/6.yml
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
|
12
12
|
(1 + 2 + ... + 10)<sup>2</sup> = 55<sup>2</sup> = 3025
|
13
13
|
|
14
|
-
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.
|
15
15
|
|
16
16
|
Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.
|
17
17
|
|
data/data/problems/61.yml
CHANGED
@@ -7,10 +7,10 @@
|
|
7
7
|
|
8
8
|
| Triangle | | P<sub>3,<i>n</i></sub>=_n_(_n_+1)/2 | | 1, 3, 6, 10, 15, ... |
|
9
9
|
| Square | | P<sub>4,<i>n</i></sub>=_n_<sup>2</sup> | | 1, 4, 9, 16, 25, ... |
|
10
|
-
| Pentagonal | | P<sub>5,<i>n</i></sub>=_n_(3_n_ 1)/2 | | 1, 5, 12, 22, 35, ... |
|
11
|
+
| Hexagonal | | P<sub>6,<i>n</i></sub>=_n_(2_n_ 1) | | 1, 6, 15, 28, 45, ... |
|
12
|
+
| Heptagonal | | P<sub>7,<i>n</i></sub>=_n_(5_n_ 3)/2 | | 1, 7, 18, 34, 55, ... |
|
13
|
+
| Octagonal | | P<sub>8,<i>n</i></sub>=_n_(3_n_ 2) | | 1, 8, 21, 40, 65, ... |
|
14
14
|
|
15
15
|
The ordered set of three 4-digit numbers: 8128, 2882, 8281, has three interesting properties.
|
16
16
|
|
data/data/problems/64.yml
CHANGED
@@ -3,54 +3,47 @@
|
|
3
3
|
:name: Odd period square roots
|
4
4
|
:url: http://projecteuler.net/problem=64
|
5
5
|
:content: "All square roots are periodic when written as continued fractions and can
|
6
|
-
be written in the form:\n\n| <var>N</var>
|
7
7
|
= <var>a</var><sub>0</sub> + | \n1\n |\n| | <var>a</var><sub>1</sub> + | \n1\n
|
8
8
|
|\n| | | <var>a</var><sub>2</sub> + | \n1\n |\n| | | | <var>a</var><sub>3</sub>
|
9
|
-
+ ... |\n\nFor example, let us consider 23
|
9
|
+
+ ... |\n\nFor example, let us consider 23:\n\n|
|
10
|
+
23 = 4 + 23
|
11
|
+
— 4 = 4 + | \n1\n | = 4 + | \n1\n |\n| | \n1 \n 23—4\n
|
12
|
+
| | 1 + | \n 23 – 3 \n7\n |\n\nIf we
|
13
|
+
continue we would get the following expansion:\n\n| 23
|
15
14
|
= 4 + | \n1\n |\n| | 1 + | \n1\n |\n| | | 3 + | \n1\n |\n| | | | 1 +
|
16
15
|
| \n1\n |\n| | | | | 8 + ... |\n\nThe process can be summarised as follows:\n\n|
|
17
|
-
<var>a</var><sub>0</sub> = 4, | | \n1 \n 23—4
|
38
|
-
\ \n7\n |\n| <var>a</var><sub>7</sub> = 1, | | \n7 \n 23—4\n
|
39
|
-
| = | \n7( 23+4)
|
40
|
-
\ \n7\n | = 8 + | 23—4
|
16
|
+
<var>a</var><sub>0</sub> = 4, | | \n1 \n 23—4\n
|
17
|
+
| = | \n 23+4 \n7\n | = 1 + | \n 23—3 \n7\n |\n| <var>a</var><sub>1</sub> = 1, |
|
19
|
+
| \n7 \n 23—3\n | = | \n7( 23+3) \n14\n | = 3 + | \n 23—3
|
21
|
+
\ \n2\n |\n| <var>a</var><sub>2</sub> = 3, | | \n2 \n 23—3\n
|
22
|
+
| = | \n2( 23+3) \n14\n | = 1 + | \n
|
23
|
+
23—4 \n7\n |\n| <var>a</var><sub>3</sub>
|
24
|
+
= 1, | | \n7 \n 23—4\n | = | \n7( 23+4) \n7\n | = 8 + | 23—4
|
26
|
+
|\n| <var>a</var><sub>4</sub> = 8, | | \n1 \n 23—4\n
|
27
|
+
| = | \n 23+4 \n7\n | = 1 + | \n 23—3 \n7\n |\n| <var>a</var><sub>5</sub> = 1, |
|
29
|
+
| \n7 \n 23—3\n | = | \n7( 23+3) \n14\n | = 3 + | \n 23—3
|
31
|
+
\ \n2\n |\n| <var>a</var><sub>6</sub> = 3, | | \n2 \n 23—3\n
|
32
|
+
| = | \n2( 23+3) \n14\n | = 1 + | \n
|
33
|
+
23—4 \n7\n |\n| <var>a</var><sub>7</sub>
|
34
|
+
= 1, | | \n7 \n 23—4\n | = | \n7( 23+4) \n7\n | = 8 + | 23—4
|
41
36
|
|\n\nIt can be seen that the sequence is repeating. For conciseness, we use the
|
42
|
-
notation 
|
56
|
-
10000 have an odd period?\n\n"
|
37
|
+
notation 23 = [4;(1,3,1,8)], to indicate
|
38
|
+
that the block (1,3,1,8) repeats indefinitely.\n\nThe first ten continued fraction
|
39
|
+
representations of (irrational) square roots are:\n\n2=[1;(2)],
|
40
|
+
period=1 \n 3=[1;(1,2)], period=2 \n 5=[2;(4)], period=1 \n 6=[2;(2,4)],
|
42
|
+
period=2 \n 7=[2;(1,1,1,4)], period=4 \n
|
43
|
+
8=[2;(1,4)], period=2 \n 10=[3;(6)], period=1 \n 11=[3;(3,6)],
|
45
|
+
period=2 \n 12= [3;(2,6)], period=2 \n
|
46
|
+
13=[3;(1,1,1,1,6)], period=5\n\nExactly four
|
47
|
+
continued fractions, for <var>N</var>  13, have
|
48
|
+
an odd period.\n\nHow many continued fractions for <var>N</var>  10000 have an odd period?\n\n"
|
data/data/problems/65.yml
CHANGED
@@ -3,24 +3,23 @@
|
|
3
3
|
:name: Convergents of e
|
4
4
|
:url: http://projecteuler.net/problem=65
|
5
5
|
:content: "The square root of 2 can be written as an infinite continued fraction.\n\n|
|
6
|
-
2.\n\n|
|
6
|
+
2 = 1 + | \n1\n |\n| | 2 + | \n1\n |\n|
|
7
|
+
| | 2 + | \n1\n |\n| | | | 2 + | \n1\n |\n| | | | | 2 + ... |\n\nThe
|
8
|
+
infinite continued fraction can be written, 2
|
9
|
+
= [1;(2)], (2) indicates that 2 repeats _ad infinitum_. In a similar way, 23 = [4;(1,3,1,8)].\n\nIt turns out that the sequence
|
11
|
+
of partial values of continued fractions for square roots provide the best rational
|
12
|
+
approximations. Let us consider the convergents for 2.\n\n|
|
14
13
|
1 + | \n1\n | = 3/2 |\n| | \n2\n | |\n\n| 1 + | \n1\n | = 7/5 |\n| | 2 + |
|
15
14
|
\n1\n |\n| | | \n2\n | |\n\n| 1 + | \n1\n | = 17/12 |\n| | 2 + | \n1\n |
|
16
15
|
|\n| | | 2 + | \n1\n | |\n| | | | \n2\n | |\n\n| 1 + | \n1\n | =
|
17
16
|
41/29 |\n| | 2 + | \n1\n |\n| | | 2 + | \n1\n | |\n| | | | 2 + | \n1\n
|
18
17
|
| |\n| | | | | \n2\n | |\n\nHence the sequence of the first ten convergents
|
19
|
-
for 2 are:\n\n1, 3/2, 7/5, 17/12, 41/29,
|
19
|
+
99/70, 239/169, 577/408, 1393/985, 3363/2378, ...\n\nWhat is most surprising is
|
20
|
+
that the important mathematical constant, \n_e_ = [2; 1,2,1, 1,4,1, 1,6,1 , ...
|
21
|
+
, 1,2_k_,1, ...].\n\nThe first ten terms in the sequence of convergents for _e_
|
22
|
+
are:\n\n2, 3, 8/3, 11/4, 19/7, 87/32, 106/39, 193/71, 1264/465, 1457/536, ...\n\nThe
|
23
|
+
sum of digits in the numerator of the 10<sup>th</sup> convergent is 1+4+5+7=17.\n\nFind
|
25
24
|
the sum of digits in the numerator of the 100<sup>th</sup> convergent of the continued
|
26
25
|
fraction for _e_.\n\n"
|
data/data/problems/66.yml
CHANGED
@@ -4,14 +4,14 @@
|
|
4
4
|
:url: http://projecteuler.net/problem=66
|
5
5
|
:content: "Consider quadratic Diophantine equations of the form:\n\n_x_<sup>2</sup>
|
6
6
|
– D_y_<sup>2</sup> = 1\n\nFor example, when D=13, the minimal solution in _x_ is
|
7
|
-
649<sup>2</sup> – 13 180<sup>2</sup> = 1.\n\nIt
|
8
|
+
can be assumed that there are no solutions in positive integers when D is square.\n\nBy
|
9
|
+
finding minimal solutions in _x_ for D = {2, 3, 5, 6, 7}, we obtain the following:\n\n3<sup>2</sup>
|
10
|
+
– 2 2<sup>2</sup> = 1 \n\r2<sup>2</sup>
|
11
|
+
– 3 1<sup>2</sup> = 1 \n9<sup>2</sup> –
|
12
|
+
5 4<sup>2</sup> = 1 \n\r5<sup>2</sup> –
|
13
|
+
6 2<sup>2</sup> = 1 \n\r8<sup>2</sup> –
|
14
|
+
7 3<sup>2</sup> = 1\n\nHence, by considering
|
15
|
+
minimal solutions in _x_ for D  7, the largest
|
16
|
+
_x_ is obtained when D=5.\n\nFind the value of D 
|
17
17
|
1000 in minimal solutions of _x_ for which the largest value of _x_ is obtained.\n\n"
|
data/data/problems/68.yml
CHANGED
@@ -3,9 +3,9 @@
|
|
3
3
|
:name: Magic 5-gon ring
|
4
4
|
:url: http://projecteuler.net/problem=68
|
5
5
|
:content: "Consider the following \"magic\" 3-gon ring, filled with the numbers 1
|
6
|
-
to 6, and each line adding to nine.\n\n  \n\nWorking
|
7
|
+
**clockwise** , and starting from the group of three with the numerically lowest
|
8
|
+
external node (4,3,2 in this example), each solution can be described uniquely.
|
9
9
|
For example, the above solution can be described by the set: 4,3,2; 6,2,1; 5,1,3.\n\nIt
|
10
10
|
is possible to complete the ring with four different totals: 9, 10, 11, and 12.
|
11
11
|
There are eight solutions in total.\n\n| **Total** | **Solution Set** |\n| 9 | 4,2,3;
|
@@ -15,5 +15,4 @@
|
|
15
15
|
each group it is possible to form 9-digit strings; the maximum string for a 3-gon
|
16
16
|
ring is 432621513.\n\nUsing the numbers 1 to 10, and depending on arrangements,
|
17
17
|
it is possible to form 16- and 17-digit strings. What is the maximum **16-digit**
|
18
|
-
string for a \"magic\" 5-gon ring?\n\n  \n\n"
|
data/data/problems/69.yml
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
| 9 | 1,2,4,5,7,8 | 6 | 1.5 |
|
17
17
|
| 10 | 1,3,7,9 | 4 | 2.5 |
|
18
18
|
|
19
|
-
It can be seen that _n_=6 produces a maximum _n_/φ(_n_) for _n_  for _n_  10.
|
20
20
|
|
21
|
-
Find the value of _n_  1,000,000 for which _n_/φ(_n_) is a maximum.
|
22
22
|
|
data/data/problems/70.yml
CHANGED
@@ -8,7 +8,6 @@
|
|
8
8
|
are all less than nine and relatively prime to nine, φ(9)=6. \nThe number 1 is
|
9
9
|
considered to be relatively prime to every positive number, so φ(1)=1.\n\nInterestingly,
|
10
10
|
φ(87109)=79180, and it can be seen that 87109 is a permutation of 79180.\n\nFind
|
11
|
-
the value of <var>n</var>, 1  produces a minimum.\n\n"
|
11
|
+
the value of <var>n</var>, 1  <var>n</var>  10<sup>7</sup>, for which φ(<var>n</var>) is a permutation
|
13
|
+
of <var>n</var> and the ratio <var>n</var>/φ(<var>n</var>) produces a minimum.\n\n"
|
data/data/problems/71.yml
CHANGED
@@ -3,13 +3,13 @@
|
|
3
3
|
:name: Ordered fractions
|
4
4
|
:url: http://projecteuler.net/problem=71
|
5
5
|
:content: |+
|
6
|
-
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.
|
7
7
|
|
8
|
-
If we list the set of reduced proper fractions for _d_  8 in ascending order of size, we get:
|
9
9
|
|
10
10
|
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
|
11
11
|
|
12
12
|
It can be seen that 2/5 is the fraction immediately to the left of 3/7.
|
13
13
|
|
14
|
-
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.
|
15
15
|
|
data/data/problems/72.yml
CHANGED
@@ -3,13 +3,13 @@
|
|
3
3
|
:name: Counting fractions
|
4
4
|
:url: http://projecteuler.net/problem=72
|
5
5
|
:content: |+
|
6
|
-
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.
|
7
7
|
|
8
|
-
If we list the set of reduced proper fractions for _d_  8 in ascending order of size, we get:
|
9
9
|
|
10
10
|
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
|
11
11
|
|
12
12
|
It can be seen that there are 21 elements in this set.
|
13
13
|
|
14
|
-
How many elements would be contained in the set of reduced proper fractions for _d_  1,000,000?
|
15
15
|
|
data/data/problems/73.yml
CHANGED
@@ -3,13 +3,13 @@
|
|
3
3
|
:name: Counting fractions in a range
|
4
4
|
:url: http://projecteuler.net/problem=73
|
5
5
|
:content: |+
|
6
|
-
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.
|
7
7
|
|
8
|
-
If we list the set of reduced proper fractions for _d_  8 in ascending order of size, we get:
|
9
9
|
|
10
10
|
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
|
11
11
|
|
12
12
|
It can be seen that there are 3 fractions between 1/3 and 1/2.
|
13
13
|
|
14
|
-
How many fractions lie between 1/3 and 1/2 in the sorted set of reduced proper fractions for _d_  12,000?
|
15
15
|
|
data/data/problems/74.yml
CHANGED
@@ -5,25 +5,18 @@
|
|
5
5
|
:content: "The number 145 is well known for the property that the sum of the factorial
|
6
6
|
of its digits is equal to 145:\n\n1! + 4! + 5! = 1 + 24 + 120 = 145\n\nPerhaps less
|
7
7
|
well known is 169, in that it produces the longest chain of numbers that link back
|
8
|
-
to 169; it turns out that there are only three such loops that exist:\n\n169  45361 (
|
24
|
-
 871) \n540
|
25
|
-
 145 ( 
|
26
|
-
145)\n\nStarting with 69 produces a chain of five non-repeating terms, but the longest
|
27
|
-
non-repeating chain with a starting number below one million is sixty terms.\n\nHow
|
28
|
-
many chains, with a starting number below one million, contain exactly sixty non-repeating
|
29
|
-
terms?\n\n"
|
8
|
+
to 169; it turns out that there are only three such loops that exist:\n\n169  363601  1454
|
10
|
+
 169 \n871 
|
11
|
+
45361  871 \n872 
|
12
|
+
45362  872\n\nIt is not difficult to prove
|
13
|
+
that EVERY starting number will eventually get stuck in a loop. For example,\n\n69
|
14
|
+
 363600 
|
15
|
+
1454  169 
|
16
|
+
363601 (  1454) \n78 
|
17
|
+
45360  871 
|
18
|
+
45361 (  871) \n540 
|
19
|
+
145 (  145)\n\nStarting with 69 produces a
|
20
|
+
chain of five non-repeating terms, but the longest non-repeating chain with a starting
|
21
|
+
number below one million is sixty terms.\n\nHow many chains, with a starting number
|
22
|
+
below one million, contain exactly sixty non-repeating terms?\n\n"
|
data/data/problems/75.yml
CHANGED
@@ -10,5 +10,5 @@
|
|
10
10
|
right angle triangle, and other lengths allow more than one solution to be found;
|
11
11
|
for example, using 120 cm it is possible to form exactly three different integer
|
12
12
|
sided right angle triangles.\n\n**120 cm** : (30,40,50), (20,48,52), (24,45,51)\n\nGiven
|
13
|
-
that L is the length of the wire, for how many values of L 
|
14
14
|
1,500,000 can exactly one integer sided right angle triangle be formed?\n\n"
|
data/data/problems/8.yml
CHANGED
@@ -3,17 +3,17 @@
|
|
3
3
|
:name: Largest product in a series
|
4
4
|
:url: http://projecteuler.net/problem=8
|
5
5
|
:content: "The four adjacent digits in the 1000-digit number that have the greatest
|
6
|
-
product are 9  9 
|
7
|
+
8  9 = 5832.\n\n73167176531330624919225119674426574742355349194934
|
8
|
+
\ \n\r96983520312774506326239578318016984801869478851843 \n\r85861560789112949495459501737958331952853208805511
|
9
|
+
\ \n\r12540698747158523863050715693290963295227443043557 \n\r66896648950445244523161731856403098711121722383113
|
10
|
+
\ \n\r62229893423380308135336276614282806444486645238749 \n\r30358907296290491560440772390713810515859307960866
|
11
|
+
\ \n\r70172427121883998797908792274921901699720888093776 \n\r65727333001053367881220235421809751254540594752243
|
12
|
+
\ \n\r52584907711670556013604839586446706324415722155397 \n\r53697817977846174064955149290862569321978468622482
|
13
|
+
\ \n\r83972241375657056057490261407972968652414535100474 \n\r82166370484403199890008895243450658541227588666881
|
14
|
+
\ \n\r16427171479924442928230863465674813919123162824586 \n\r17866458359124566529476545682848912883142607690042
|
15
|
+
\ \n\r24219022671055626321111109370544217506941658960408 \n\r07198403850962455444362981230987879927244284909188
|
16
|
+
\ \n\r84580156166097919133875499200524063689912560717606 \n\r05886116467109405077541002256983155200055935729725
|
17
|
+
\ \n\r71636269561882670428252483600823257530420752963450\n\nFind the thirteen adjacent
|
18
|
+
digits in the 1000-digit number that have the greatest product. What is the value
|
19
|
+
of this product?\n\n"
|
data/data/problems/81.yml
CHANGED
@@ -4,10 +4,10 @@
|
|
4
4
|
:url: http://projecteuler.net/problem=81
|
5
5
|
:content: "In the 5 by 5 matrix below, the minimal path sum from the top left to the
|
6
6
|
bottom right, by **only moving to the right and down** , is indicated in bold red
|
7
|
-
and is equal to 2427.\n\n|  \n | \n\n| **131**
|
8
|
+
| 673 | 234 | 103 | 18 |\n| **201** | **96** | **342** | 965 | 150 |\n| 630 | 803
|
9
|
+
| **746** | **422** | 111 |\n| 537 | 699 | 497 | **121** | 956 |\n| 805 | 732 |
|
10
|
+
524 | **37** | **331** |\n\n |  \n |\n\nFind
|
11
|
+
the minimal path sum, in [matrix.txt](project/matrix.txt) (right click and 'Save
|
12
|
+
Link/Target As...'), a 31K text file containing a 80 by 80 matrix, from the top
|
13
|
+
left to the bottom right by only moving right and down.\n\n"
|
data/data/problems/82.yml
CHANGED
@@ -5,10 +5,10 @@
|
|
5
5
|
:content: "NOTE: This problem is a more challenging version of [Problem 81](problem=81).\n\nThe
|
6
6
|
minimal path sum in the 5 by 5 matrix below, by starting in any cell in the left
|
7
7
|
column and finishing in any cell in the right column, and only moving up, down,
|
8
|
-
and right, is indicated in red and bold; the sum is equal to 994.\n\n|  \n | \n\n| 131 | 673 | **234** | **103** | **18** |\n| **201**
|
10
|
+
| **96** | **342** | 965 | 150 |\n| 630 | 803 | 746 | 422 | 111 |\n| 537 | 699 |
|
11
|
+
497 | 121 | 956 |\n| 805 | 732 | 524 | 37 | 331 |\n\n | 
|
12
12
|
\ \n |\n\nFind the minimal path sum, in [matrix.txt](project/matrix.txt) (right
|
13
13
|
click and 'Save Link/Target As...'), a 31K text file containing a 80 by 80 matrix,
|
14
14
|
from the left column to the right column.\n\n"
|
data/data/problems/83.yml
CHANGED
@@ -5,10 +5,10 @@
|
|
5
5
|
:content: "NOTE: This problem is a significantly more challenging version of [Problem
|
6
6
|
81](problem=81).\n\nIn the 5 by 5 matrix below, the minimal path sum from the top
|
7
7
|
left to the bottom right, by moving left, right, up, and down, is indicated in bold
|
8
|
-
red and is equal to 2297.\n\n|  \n | \n\n|
|
9
|
+
**131** | 673 | **234** | **103** | **18** |\n| **201** | **96** | **342** | 965
|
10
|
+
| **150** |\n| 630 | 803 | 746 | **422** | **111** |\n| 537 | 699 | 497 | **121**
|
11
|
+
| 956 |\n| 805 | 732 | 524 | **37** | **331** |\n\n | 
|
12
12
|
\ \n |\n\nFind the minimal path sum, in [matrix.txt](project/matrix.txt) (right
|
13
13
|
click and 'Save Link/Target As...'), a 31K text file containing a 80 by 80 matrix,
|
14
14
|
from the top left to the bottom right by moving left, right, up, and down.\n\n"
|
data/data/problems/85.yml
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
:content: |+
|
6
6
|
By counting carefully it can be seen that a rectangular grid measuring 3 by 2 contains eighteen rectangles:
|
7
7
|
|
8
|
-

|
9
9
|
|
10
10
|
Although there exists no rectangular grid that contains exactly two million rectangles, find the area of the grid with the nearest solution.
|
11
11
|
|
data/data/problems/86.yml
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
:content: "A spider, S, sits in one corner of a cuboid room, measuring 6 by 5 by 3,
|
6
6
|
and a fly, F, sits in the opposite corner. By travelling on the surfaces of the
|
7
7
|
room the shortest \"straight line\" distance from S to F is 10 and the path is shown
|
8
|
-
on the diagram.\n\n  \n\nHowever, there are up to
|
9
|
+
three \"shortest\" path candidates for any given cuboid and the shortest route doesn't
|
10
|
+
always have integer length.\n\nBy considering all cuboid rooms with integer dimensions,
|
11
|
+
up to a maximum size of M by M by M, there are exactly 2060 cuboids for which the
|
12
|
+
shortest route has integer length when M=100, and this is the least value of M for
|
13
|
+
which the number of solutions first exceeds two thousand; the number of solutions
|
14
|
+
is 1975 when M=99.\n\nFind the least value of M such that the number of solutions
|
15
|
+
first exceeds one million.\n\n"
|