euler-manager 0.0.6 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- 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/405.yml
CHANGED
@@ -5,10 +5,10 @@
|
|
5
5
|
:content: "We wish to tile a rectangle whose length is twice its width. \n\rLet <var>T</var>(0)
|
6
6
|
be the tiling consisting of a single rectangle. \n\rFor <var>n</var> > 0, let <var>T</var>(<var>n</var>)
|
7
7
|
be obtained from <var>T</var>(<var>n</var>-1) by replacing all tiles in the following
|
8
|
-
manner:\n\n ![](/
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
8
|
+
manner:\n\n ![]({{ images_dir }}/p_405_tile1.png)\n\nThe following animation demonstrates
|
9
|
+
the tilings <var>T</var>(<var>n</var>) for <var>n</var> from 0 to 5:\n\n ![]({{
|
10
|
+
images_dir }}/p_405_tile2.gif)\n\nLet <var>f</var>(<var>n</var>) be the number of
|
11
|
+
points where four tiles meet in <var>T</var>(<var>n</var>). \n\rFor example, <var>f</var>(1)
|
12
|
+
= 0, <var>f</var>(4) = 82 and <var>f</var>(10<sup>9</sup>) mod 17<sup>7</sup> =
|
13
|
+
126897180.\n\nFind <var>f</var>(10<sup><var>k</var></sup>) for <var>k</var> = 10<sup>18</sup>,
|
14
|
+
give your answer modulo 17<sup>7</sup>.\n\n"
|
data/data/problems/406.yml
CHANGED
@@ -25,16 +25,14 @@
|
|
25
25
|
<var>a</var>, and <var>b</var>.\n\nLet C(<var>n</var>, <var>a</var>, <var>b</var>)
|
26
26
|
be the worst-case cost achieved by an optimal strategy for the given values of <var>n</var>,
|
27
27
|
<var>a</var>, and <var>b</var>.\n\nHere are a few examples: \n\rC(5, 2, 3) = 5
|
28
|
-
\ \n\rC(500, ![√](/
|
29
|
-
![√](/
|
30
|
-
|
31
|
-
|
32
|
-
F<sub><var>k</var></sub> be the Fibonacci numbers: F<sub><var>k</var></sub> = F<sub><var>k</var>-1</sub>
|
28
|
+
\ \n\rC(500, ![√]({{ images_dir }}/symbol_radic.gif)2, ![√]({{ images_dir }}/symbol_radic.gif)3)
|
29
|
+
= 13.22073197... \n\rC(20000, 5, 7) = 82 \n\rC(2000000, ![√]({{ images_dir }}/symbol_radic.gif)5,
|
30
|
+
![√]({{ images_dir }}/symbol_radic.gif)7) = 49.63755955...\n\nLet F<sub><var>k</var></sub>
|
31
|
+
be the Fibonacci numbers: F<sub><var>k</var></sub> = F<sub><var>k</var>-1</sub>
|
33
32
|
+ F<sub><var>k</var>-2</sub> with base cases F<sub>1</sub> = F<sub>2</sub> = 1.
|
34
|
-
\ \nFind ![∑](/
|
33
|
+
\ \nFind ![∑]({{ images_dir }}/symbol_sum.gif)<sub>1<img src=\"%7B%7B%20images_dir%20%7D%7D/symbol_le.gif\"
|
34
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>k</var><img
|
35
35
|
src=\"%7B%7B%20images_dir%20%7D%7D/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\"
|
36
|
-
border=\"0\" style=\"vertical-align:middle;\"
|
37
|
-
|
38
|
-
![√](/home/will/src/euler-manager/config/../data/images/symbol_radic.gif)<var>k</var>,
|
39
|
-
![√](/home/will/src/euler-manager/config/../data/images/symbol_radic.gif)F<sub><var>k</var></sub>),
|
36
|
+
border=\"0\" style=\"vertical-align:middle;\">30</sub> C(10<sup>12</sup>, ![√]({{
|
37
|
+
images_dir }}/symbol_radic.gif)<var>k</var>, ![√]({{ images_dir }}/symbol_radic.gif)F<sub><var>k</var></sub>),
|
40
38
|
and give your answer rounded to 8 decimal places behind the decimal point.\n\n"
|
data/data/problems/407.yml
CHANGED
@@ -2,12 +2,12 @@
|
|
2
2
|
:id: 407
|
3
3
|
:name: Idempotents
|
4
4
|
:url: http://projecteuler.net/problem=407
|
5
|
-
:content: "If we calculate <var>a</var><sup>2</sup> mod 6 for 0 ![≤](
|
6
|
-
<var>a</var> ![≤](/
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
for 1 ![≤](/
|
13
|
-
|
5
|
+
:content: "If we calculate <var>a</var><sup>2</sup> mod 6 for 0 ![≤]({{ images_dir
|
6
|
+
}}/symbol_le.gif) <var>a</var> ![≤]({{ images_dir }}/symbol_le.gif) 5 we get: 0,1,4,3,4,1.\n\nThe
|
7
|
+
largest value of <var>a</var> such that <var>a</var><sup>2</sup> ![≡]({{ images_dir
|
8
|
+
}}/symbol_cong.gif) <var>a</var> mod 6 is 4. \n\rLet's call M(<var>n</var>) the
|
9
|
+
largest value of <var>a</var> ![<]({{ images_dir }}/symbol_lt.gif) <var>n</var>
|
10
|
+
such that <var>a</var><sup>2</sup> ![≡]({{ images_dir }}/symbol_cong.gif) <var>a</var>
|
11
|
+
(mod <var>n</var>). \n\rSo M(6) = 4.\n\nFind ![∑]({{ images_dir }}/symbol_sum.gif)M(<var>n</var>)
|
12
|
+
for 1 ![≤]({{ images_dir }}/symbol_le.gif) <var>n</var> ![≤]({{ images_dir }}/symbol_le.gif)
|
13
|
+
10<sup>7</sup>.\n\n"
|
data/data/problems/410.yml
CHANGED
@@ -8,9 +8,8 @@
|
|
8
8
|
P and Q is tangent to C.\n\nFor example, the quadruplet (<var>r</var>, <var>a</var>,
|
9
9
|
<var>b</var>, <var>c</var>) = (2, 6, 2, -7) satisfies this property.\n\nLet F(<var>R</var>,
|
10
10
|
<var>X</var>) be the number of the integer quadruplets (<var>r</var>, <var>a</var>,
|
11
|
-
<var>b</var>, <var>c</var>) with this property, and with 0 ![<](/
|
12
|
-
<var>r</var> ![≤](/
|
13
|
-
<var>
|
14
|
-
<
|
15
|
-
<
|
16
|
-
3384. \n\rFind F(10<sup>8</sup>, 10<sup>9</sup>) + F(10<sup>9</sup>, 10<sup>8</sup>).\n\n"
|
11
|
+
<var>b</var>, <var>c</var>) with this property, and with 0 ![<]({{ images_dir }}/symbol_lt.gif)
|
12
|
+
<var>r</var> ![≤]({{ images_dir }}/symbol_le.gif) <var>R</var> and 0 ![<]({{ images_dir
|
13
|
+
}}/symbol_lt.gif) <var>a</var> ![≤]({{ images_dir }}/symbol_le.gif) <var>X</var>.\n\nWe
|
14
|
+
can verify that F(1, 5) = 10, F(2, 10) = 52 and F(10, 100) = 3384. \n\rFind F(10<sup>8</sup>,
|
15
|
+
10<sup>9</sup>) + F(10<sup>9</sup>, 10<sup>8</sup>).\n\n"
|
data/data/problems/411.yml
CHANGED
@@ -4,16 +4,15 @@
|
|
4
4
|
:url: http://projecteuler.net/problem=411
|
5
5
|
:content: "Let <var>n</var> be a positive integer. Suppose there are stations at the
|
6
6
|
coordinates (<var>x</var>, <var>y</var>) = (2<sup><var>i</var></sup> mod <var>n</var>,
|
7
|
-
3<sup><var>i</var></sup> mod <var>n</var>) for 0 ![≤](/
|
8
|
-
<var>i</var> ![≤](/
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
<var>k</var> ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif)
|
7
|
+
3<sup><var>i</var></sup> mod <var>n</var>) for 0 ![≤]({{ images_dir }}/symbol_le.gif)
|
8
|
+
<var>i</var> ![≤]({{ images_dir }}/symbol_le.gif) 2<var>n</var>. We will consider
|
9
|
+
stations with the same coordinates as the same station.\n\nWe wish to form a path
|
10
|
+
from (0, 0) to (<var>n</var>, <var>n</var>) such that the x and y coordinates never
|
11
|
+
decrease. \n\rLet S(<var>n</var>) be the maximum number of stations such a path
|
12
|
+
can pass through.\n\nFor example, if <var>n</var> = 22, there are 11 distinct stations,
|
13
|
+
and a valid path can pass through at most 5 stations. Therefore, S(22) = 5.\rThe
|
14
|
+
case is illustrated below, with an example of an optimal path:\n\n![]({{ images_dir
|
15
|
+
}}/p411_longpath.png)\n\nIt can also be verified that S(123) = 14 and S(10000) =
|
16
|
+
48.\n\nFind ![∑]({{ images_dir }}/symbol_sum.gif) S(<var>k</var><sup>5</sup>) for
|
17
|
+
1 ![≤]({{ images_dir }}/symbol_le.gif) <var>k</var> ![≤]({{ images_dir }}/symbol_le.gif)
|
19
18
|
30.\n\n"
|
data/data/problems/412.yml
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
:id: 412
|
3
3
|
:name: Gnomon numbering
|
4
4
|
:url: http://projecteuler.net/problem=412
|
5
|
-
:content: "For integers <var>m</var>, <var>n</var> (0 ![≤](/
|
6
|
-
let L(<var>m</var>, <var>n</var>) be an <var>m</var> ![×](/
|
7
|
-
grid with the top-right <var>n</var> ![×](/
|
8
|
-
grid removed.\n\nFor example, L(5, 3) looks like this:\n\n![](/
|
5
|
+
:content: "For integers <var>m</var>, <var>n</var> (0 ![≤]({{ images_dir }}/symbol_le.gif) <var>n</var> m),
|
6
|
+
let L(<var>m</var>, <var>n</var>) be an <var>m</var> ![×]({{ images_dir }}/symbol_times.gif)<var>m</var>
|
7
|
+
grid with the top-right <var>n</var> ![×]({{ images_dir }}/symbol_times.gif)<var>n</var>
|
8
|
+
grid removed.\n\nFor example, L(5, 3) looks like this:\n\n![]({{ images_dir }}/p412_table53.png)\n\nWe
|
9
9
|
want to number each cell of L(<var>m</var>, <var>n</var>) with consecutive integers
|
10
10
|
1, 2, 3, ... such that the number in every cell is smaller than the number below
|
11
|
-
it and to the left of it.\n\nFor example, here are two valid numberings of L(5, 3):\n\n![](
|
12
|
-
LC(<var>m</var>, <var>n</var>) be the number
|
13
|
-
<var>n</var>). \n\rIt can be verified that
|
14
|
-
=
|
15
|
-
76543217.\n\n"
|
11
|
+
it and to the left of it.\n\nFor example, here are two valid numberings of L(5, 3):\n\n![]({{
|
12
|
+
images_dir }}/p412_tablenums.png)\n\nLet LC(<var>m</var>, <var>n</var>) be the number
|
13
|
+
of valid numberings of L(<var>m</var>, <var>n</var>). \n\rIt can be verified that
|
14
|
+
LC(3, 0) = 42, LC(5, 3) = 250250, LC(6, 3) = 406029023400 and LC(10, 5) mod 76543217
|
15
|
+
= 61251715.\n\nFind LC(10000, 5000) mod 76543217.\n\n"
|
data/data/problems/414.yml
CHANGED
@@ -16,20 +16,18 @@
|
|
16
16
|
a Kaprekar constant exists in all cases; either the routine can end up in a cycle
|
17
17
|
for some input numbers or the constant the routine arrives at can be different for
|
18
18
|
different input numbers. \n\rHowever, it can be shown that for 5 digits and a base
|
19
|
-
b = 6t+3 ![≠](/
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
![<](/home/will/src/euler-manager/config/../data/images/symbol_lt.gif) <var>b</var><sup>5</sup>.
|
19
|
+
b = 6t+3 ![≠]({{ images_dir }}/symbol_ne.gif)9, a Kaprekar constant exists. \n\rE.g.
|
20
|
+
base 15: (10,4,14,9,5)<sub>15</sub> \n\rbase 21: (14,6,20,13,7)<sub>21</sub>\n\nDefine
|
21
|
+
<var>C<sub>b</sub></var> to be the Kaprekar constant in base <var>b</var> for 5
|
22
|
+
digits.\rDefine the function <var>sb(i)</var> to be\n\n- 0 if i = <var>C<sub>b</sub></var>
|
23
|
+
or if <var>i</var> written in base <var>b</var> consists of 5 identical digits\r\n-
|
24
|
+
the number of iterations it takes the Kaprekar routine in base <var>b</var> to arrive
|
25
|
+
at <var>C<sub>b</sub></var>, otherwise\r\n\rNote that we can define <var>sb(i)</var>
|
26
|
+
for all integers <var>i</var> ![<]({{ images_dir }}/symbol_lt.gif) <var>b</var><sup>5</sup>.
|
28
27
|
If <var>i</var> written in base <var>b</var> takes less than 5 digits, the number
|
29
28
|
is padded with leading zero digits until we have 5 digits before applying the Kaprekar
|
30
|
-
routine.\r\r\n\nDefine <var>S(b)</var> as the sum of <var>sb(i)</var> for 0 ![<](
|
31
|
-
<var>i</var> ![<](/
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
the last 18 digits as your answer.\n\n"
|
29
|
+
routine.\r\r\n\nDefine <var>S(b)</var> as the sum of <var>sb(i)</var> for 0 ![<]({{
|
30
|
+
images_dir }}/symbol_lt.gif) <var>i</var> ![<]({{ images_dir }}/symbol_lt.gif) <var>b</var><sup>5</sup>.
|
31
|
+
\ \n\rE.g. S(15) = 5274369 \n \rS(111) = 400668930299\n\nFind the sum of S(6k+3)
|
32
|
+
for 2 ![≤]({{ images_dir }}/symbol_le.gif) k ![≤]({{ images_dir }}/symbol_le.gif)
|
33
|
+
300. \n\rGive the last 18 digits as your answer.\n\n"
|
data/data/problems/415.yml
CHANGED
@@ -9,8 +9,8 @@
|
|
9
9
|
the set {(0, 0), (1, 1), (2, 2), (4, 4)} is not a titanic set since the line passing
|
10
10
|
through any two points in the set also passes through the other two.\n\nFor any
|
11
11
|
positive integer <var>N</var>, let <var>T</var>(<var>N</var>) be the number of titanic
|
12
|
-
sets S whose every point (<var>x</var>, <var>y</var>) satisfies 0 ![≤](
|
13
|
-
<var>x</var>, <var>y</var> ![≤](/
|
12
|
+
sets S whose every point (<var>x</var>, <var>y</var>) satisfies 0 ![≤]({{ images_dir
|
13
|
+
}}/symbol_le.gif) <var>x</var>, <var>y</var> ![≤]({{ images_dir }}/symbol_le.gif)
|
14
14
|
<var>N</var>.\rIt can be verified that <var>T</var>(1) = 11, <var>T</var>(2) = 494,
|
15
15
|
<var>T</var>(4) = 33554178, <var>T</var>(111) mod 10<sup>8</sup> = 13500401 and
|
16
16
|
<var>T</var>(10<sup>5</sup>) mod 10<sup>8</sup> = 63259062.\n\nFind <var>T</var>(10<sup>11</sup>) mod 10<sup>8</sup>.\n\n"
|
data/data/problems/417.yml
CHANGED
@@ -13,8 +13,7 @@
|
|
13
13
|
fractions whose denominator has no other prime factors than 2 and/or 5 are not considered
|
14
14
|
to have a recurring cycle. \n\rWe define the length of the recurring cycle of those
|
15
15
|
unit fractions as 0.\n\nLet L(n) denote the length of the recurring cycle of 1/n.\rYou
|
16
|
-
are given that ![∑](/
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
100 000 000\n\n"
|
16
|
+
are given that ![∑]({{ images_dir }}/symbol_sum.gif)L(n) for 3 ![≤]({{ images_dir
|
17
|
+
}}/symbol_le.gif) n ![≤]({{ images_dir }}/symbol_le.gif) 1 000 000 equals 55535191115.\n\nFind
|
18
|
+
![∑]({{ images_dir }}/symbol_sum.gif)L(n) for 3 ![≤]({{ images_dir }}/symbol_le.gif)
|
19
|
+
n ![≤]({{ images_dir }}/symbol_le.gif) 100 000 000\n\n"
|
data/data/problems/418.yml
CHANGED
@@ -4,11 +4,10 @@
|
|
4
4
|
:url: http://projecteuler.net/problem=418
|
5
5
|
:content: "Let <var>n</var> be a positive integer. An integer triple (<var>a</var>,
|
6
6
|
<var>b</var>, <var>c</var>) is called a _factorisation triple_ of <var>n</var> if:\n\n-
|
7
|
-
1 ![≤](/
|
8
|
-
![≤](/
|
9
|
-
|
10
|
-
<var>
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
<var>f</var>(100100) = 142 and <var>f</var>(20!) = 4034872.\n\nFind <var>f</var>(43!).\n\n"
|
7
|
+
1 ![≤]({{ images_dir }}/symbol_le.gif) <var>a</var> ![≤]({{ images_dir }}/symbol_le.gif)
|
8
|
+
<var>b</var> ![≤]({{ images_dir }}/symbol_le.gif) <var>c</var>\n- <var>a</var>·<var>b</var>·<var>c</var>
|
9
|
+
= <var>n</var>.\r\n\nDefine <var>f</var>(<var>n</var>) to be <var>a</var> + <var>b</var>
|
10
|
+
+ <var>c</var> for the factorisation triple (<var>a</var>, <var>b</var>, <var>c</var>)
|
11
|
+
of <var>n</var> which minimises <var>c</var> / <var>a</var>. One can show that this
|
12
|
+
triple is unique.\n\nFor example, <var>f</var>(165) = 19, <var>f</var>(100100) =
|
13
|
+
142 and <var>f</var>(20!) = 4034872.\n\nFind <var>f</var>(43!).\n\n"
|
data/data/problems/419.yml
CHANGED
@@ -5,13 +5,13 @@
|
|
5
5
|
:content: "The **look and say** sequence goes 1, 11, 21, 1211, 111221, 312211, 13112221,
|
6
6
|
1113213211, ... \n\rThe sequence starts with 1 and all other members are obtained
|
7
7
|
by describing the previous member in terms of consecutive digits. \n\rIt helps
|
8
|
-
to do this out loud: \n\r1 is 'one one' ![→](/
|
9
|
-
11 \n\r11 is 'two ones' ![→](/
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
8
|
+
to do this out loud: \n\r1 is 'one one' ![→]({{ images_dir }}/symbol_maps.gif)
|
9
|
+
11 \n\r11 is 'two ones' ![→]({{ images_dir }}/symbol_maps.gif) 21 \n\r21 is 'one
|
10
|
+
two and one one' ![→]({{ images_dir }}/symbol_maps.gif) 1211 \n\r1211 is 'one
|
11
|
+
one, one two and two ones' ![→]({{ images_dir }}/symbol_maps.gif) 111221 \n\r111221
|
12
|
+
is 'three ones, two twos and one one' ![→]({{ images_dir }}/symbol_maps.gif) 312211
|
13
|
+
\ \n\r...\n\nDefine A(n), B(n) and C(n) as the number of ones, twos and threes in
|
14
|
+
the n'th element of the sequence respectively. \n\rOne can verify that A(40) =
|
15
|
+
31254, B(40) = 20259 and C(40) = 11625.\n\nFind A(n), B(n) and C(n) for n = 10<sup>12</sup>.
|
16
16
|
\ \n \rGive your answer modulo 2<sup>30</sup> and separate your values for A, B
|
17
17
|
and C by a comma. \n \rE.g. for n = 40 the answer would be 31254,20259,11625\n\n"
|
data/data/problems/420.yml
CHANGED
@@ -4,9 +4,9 @@
|
|
4
4
|
:url: http://projecteuler.net/problem=420
|
5
5
|
:content: "A _positive integer matrix_ is a matrix whose elements are all positive
|
6
6
|
integers. \n\rSome positive integer matrices can be expressed as a square of a
|
7
|
-
positive integer matrix in two different ways. Here is an example:\n\n ![](
|
8
|
-
define F(<var>N</var>) as the number of the 2x2 positive
|
9
|
-
have a <dfn title=\"the sum of the elements on the main diagonal\">trace</dfn>
|
10
|
-
than <var>N</var> and which can be expressed as a square of a positive integer
|
11
|
-
in two different ways. \n\rWe can verify that F(50) = 7 and F(1000) = 1019.\n\nFind
|
7
|
+
positive integer matrix in two different ways. Here is an example:\n\n ![]({{ images_dir
|
8
|
+
}}/p_420_matrix.gif)\n\nWe define F(<var>N</var>) as the number of the 2x2 positive
|
9
|
+
integer matrices which have a <dfn title=\"the sum of the elements on the main diagonal\">trace</dfn>
|
10
|
+
less than <var>N</var> and which can be expressed as a square of a positive integer
|
11
|
+
matrix in two different ways. \n\rWe can verify that F(50) = 7 and F(1000) = 1019.\n\nFind
|
12
12
|
F(10<sup>7</sup>).\n\n"
|
data/data/problems/421.yml
CHANGED
@@ -3,16 +3,15 @@
|
|
3
3
|
:name: Prime factors of <var>n</var><sup>15</sup>+1
|
4
4
|
:url: http://projecteuler.net/problem=421
|
5
5
|
:content: "Numbers of the form <var>n</var><sup>15</sup>+1 are composite for every
|
6
|
-
integer <var>n</var> ![>](/
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
![×](/
|
6
|
+
integer <var>n</var> ![>]({{ images_dir }}/symbol_gt.gif) 1. \n\rFor positive integers
|
7
|
+
<var>n</var> and <var>m</var> let <var>s</var>(<var>n,m</var>) be defined as the
|
8
|
+
sum of the _distinct_ prime factors of <var>n</var><sup>15</sup>+1 not exceeding
|
9
|
+
<var>m</var>.\n\n\rE.g. 2<sup>15</sup>+1 = 3 ![×]({{ images_dir }}/symbol_times.gif)3
|
10
|
+
![×]({{ images_dir }}/symbol_times.gif)11 ![×]({{ images_dir }}/symbol_times.gif)331.
|
11
11
|
\ \n\rSo <var>s</var>(2,10) = 3 and <var>s</var>(2,1000) = 3+11+331 = 345. \n \n
|
12
|
-
\ \n\r\rAlso 10<sup>15</sup>+1 = 7 ![×](/
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif) 10<sup>11</sup>.\n\n"
|
12
|
+
\ \n\r\rAlso 10<sup>15</sup>+1 = 7 ![×]({{ images_dir }}/symbol_times.gif)11 ![×]({{
|
13
|
+
images_dir }}/symbol_times.gif)13 ![×]({{ images_dir }}/symbol_times.gif)211 ![×]({{
|
14
|
+
images_dir }}/symbol_times.gif)241 ![×]({{ images_dir }}/symbol_times.gif)2161 ![×]({{
|
15
|
+
images_dir }}/symbol_times.gif)9091. \n\rSo <var>s</var>(10,100) = 31 and <var>s</var>(10,1000)
|
16
|
+
= 483. \n\nFind ∑ <var>s</var>(<var>n</var>,10<sup>8</sup>) for 1 ![≤]({{ images_dir
|
17
|
+
}}/symbol_le.gif) <var>n</var> ![≤]({{ images_dir }}/symbol_le.gif) 10<sup>11</sup>.\n\n"
|
data/data/problems/422.yml
CHANGED
@@ -5,16 +5,16 @@
|
|
5
5
|
:content: "Let H be the hyperbola defined by the equation 12<var>x</var><sup>2</sup>
|
6
6
|
+ 7<var>x</var><var>y</var> - 12<var>y</var><sup>2</sup> = 625.\n\nNext, define
|
7
7
|
X as the point (7, 1). It can be seen that X is in H.\n\nNow we define a sequence
|
8
|
-
of points in H, {P<sub><var>i</var></sub> : <var>i</var> ![≥](/
|
8
|
+
of points in H, {P<sub><var>i</var></sub> : <var>i</var> ![≥]({{ images_dir }}/symbol_ge.gif)
|
9
9
|
1}, as:\n\n- P<sub>1</sub> = (13, 61/4).\r\n- P<sub>2</sub> = (-43/6, -4).\r\n-
|
10
10
|
For <var>i</var> > 2, P<sub><var>i</var></sub> is the unique point in H that is
|
11
11
|
different from P<sub><var>i</var>-1</sub> and such that line P<sub><var>i</var></sub>P<sub><var>i</var>-1</sub>
|
12
12
|
is parallel to line P<sub><var>i</var>-2</sub>X. It can be shown that P<sub><var>i</var></sub>
|
13
|
-
is well-defined, and that its coordinates are always rational.\r\n ![](
|
14
|
-
are given that P<sub>3</sub> = (-19/2, -229/24), P<sub>4</sub>
|
15
|
-
and P<sub>7</sub> = (17194218091/143327232, 274748766781/1719926784).\n\nFind
|
16
|
-
for <var>n</var> = 11<sup>14</sup> in the following format:
|
17
|
-
= (<var>a</var>/<var>b</var>, <var>c</var>/<var>d</var>)
|
18
|
-
in lowest terms and the denominators are positive, then
|
19
|
-
+ <var>b</var> + <var>c</var> + <var>d</var>) mod 1 000 000 007.\n\nFor
|
20
|
-
= 7, the answer would have been: 806236837.\n\n"
|
13
|
+
is well-defined, and that its coordinates are always rational.\r\n ![]({{ images_dir
|
14
|
+
}}/p422_hyperbola.gif)\n\nYou are given that P<sub>3</sub> = (-19/2, -229/24), P<sub>4</sub>
|
15
|
+
= (1267/144, -37/12) and P<sub>7</sub> = (17194218091/143327232, 274748766781/1719926784).\n\nFind
|
16
|
+
P<sub><var>n</var></sub> for <var>n</var> = 11<sup>14</sup> in the following format:
|
17
|
+
\ \nIf P<sub><var>n</var></sub> = (<var>a</var>/<var>b</var>, <var>c</var>/<var>d</var>)
|
18
|
+
where the fractions are in lowest terms and the denominators are positive, then
|
19
|
+
the answer is (<var>a</var> + <var>b</var> + <var>c</var> + <var>d</var>) mod 1 000 000 007.\n\nFor
|
20
|
+
<var>n</var> = 7, the answer would have been: 806236837.\n\n"
|
data/data/problems/423.yml
CHANGED
@@ -11,10 +11,8 @@
|
|
11
11
|
as the number of outcomes of throwing a 6-sided die <var>n</var> times such that
|
12
12
|
<var>c</var> does not exceed π(<var>n</var>).<sup>1</sup> \n\rFor example, C(3)
|
13
13
|
= 216, C(4) = 1290, C(11) = 361912500 and C(24) = 4727547363281250000.\n\nDefine
|
14
|
-
S(<var>L</var>) as ![∑](/
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
π(<var>n</var>) is the number of primes ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif)
|
20
|
-
<var>n</var>.\n\n"
|
14
|
+
S(<var>L</var>) as ![∑]({{ images_dir }}/symbol_sum.gif) C(<var>n</var>) for 1 ![≤]({{
|
15
|
+
images_dir }}/symbol_le.gif) <var>n</var> ![≤]({{ images_dir }}/symbol_le.gif) <var>L</var>.
|
16
|
+
\ \n\rFor example, S(50) mod 1 000 000 007 = 832833871.\n\nFind S(50 000 000) mod
|
17
|
+
1 000 000 007.\n\n<sup>1</sup> π denotes the **prime-counting function** , i.e.
|
18
|
+
π(<var>n</var>) is the number of primes ![≤]({{ images_dir }}/symbol_le.gif) <var>n</var>.\n\n"
|
data/data/problems/424.yml
CHANGED
@@ -2,15 +2,14 @@
|
|
2
2
|
:id: 424
|
3
3
|
:name: Kakuro
|
4
4
|
:url: http://projecteuler.net/problem=424
|
5
|
-
:content: "![](/
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
is coded as follows:\n\n6,X,X,(vCC),(vI),X,X,X,(hH),B,O,(vCA),(vJE),X,(hFE,vD),O,O,O,O,(hA),O,I,(hJC,vB),O,O,(hJC),H,O,O,O,X,X,X,(hJE),O,O,X\n\nThe
|
5
|
+
:content: "![]({{ images_dir }}/p_424_kakuro1.gif)\n\nThe above is an example of a
|
6
|
+
cryptic kakuro (also known as cross sums, or even sums cross) puzzle, with its final
|
7
|
+
solution on the right. (The common rules of kakuro puzzles can be found easily on
|
8
|
+
numerous internet sites. Other related information can also be currently found at
|
9
|
+
[krazydad.com](http://krazydad.com/) whose author has provided the puzzle data for
|
10
|
+
this challenge.)\n\nThe downloadable text file ( [kakuro200.txt](project/kakuro200.txt))
|
11
|
+
contains the description of 200 such puzzles, a mix of 5x5 and 6x6 types. The first
|
12
|
+
puzzle in the file is the above example which is coded as follows:\n\n6,X,X,(vCC),(vI),X,X,X,(hH),B,O,(vCA),(vJE),X,(hFE,vD),O,O,O,O,(hA),O,I,(hJC,vB),O,O,(hJC),H,O,O,O,X,X,X,(hJE),O,O,X\n\nThe
|
14
13
|
first character is a numerical digit indicating the size of the information grid.
|
15
14
|
It would be either a 6 (for a 5x5 kakuro puzzle) or a 7 (for a 6x6 puzzle) followed
|
16
15
|
by a comma (,). The extra top line and left column are needed to insert information.\n\nThe
|
data/data/problems/425.yml
CHANGED
@@ -10,6 +10,5 @@
|
|
10
10
|
and P and no prime in the chain exceeds P.\n\nFor example, 127 is a 2's relative.
|
11
11
|
One of the possible chains is shown below: \n\r2 ↔ 3 ↔ 13 ↔ 113 ↔ 103 ↔ 107 ↔ 127
|
12
12
|
\ \n\rHowever, 11 and 103 are not 2's relatives.\n\nLet F(N) be the sum of the primes
|
13
|
-
![≤](/
|
14
|
-
|
15
|
-
= 78728.\n\nFind F(10<sup>7</sup>).\n\n"
|
13
|
+
![≤]({{ images_dir }}/symbol_le.gif) N which are not 2's relatives. \n\rWe can
|
14
|
+
verify that F(10<sup>3</sup>) = 431 and F(10<sup>4</sup>) = 78728.\n\nFind F(10<sup>7</sup>).\n\n"
|
data/data/problems/426.yml
CHANGED
@@ -10,13 +10,13 @@
|
|
10
10
|
according to the following rule: Transfer the leftmost ball which has not been moved
|
11
11
|
to the nearest empty box to its right.\n\nAfter one turn the sequence (2, 2, 2,
|
12
12
|
1, 2) becomes (2, 2, 1, 2, 3) as can be seen below; note that we begin the new sequence
|
13
|
-
starting at the first occupied box.\n\n ![](/
|
13
|
+
starting at the first occupied box.\n\n ![]({{ images_dir }}/p_426_baxball1.gif)\n\nA
|
14
14
|
system like this is called a **Box-Ball System** or **BBS** for short.\n\nIt can
|
15
15
|
be shown that after a sufficient number of turns, the system evolves to a state
|
16
16
|
where the consecutive numbers of occupied boxes is invariant. In the example below,
|
17
17
|
the consecutive numbers of **occupied boxes** evolves to [1, 2, 3]; we shall call
|
18
|
-
this the final state.\n\n ![](/
|
19
|
-
|
18
|
+
this the final state.\n\n ![]({{ images_dir }}/p_426_baxball2.gif)\n\nWe define
|
19
|
+
the sequence {<var>t</var><sub><var>i</var></sub>}:\n\n- <var>s</var><sub>0</sub>
|
20
20
|
= 290797\r\n- <var>s</var><sub><var>k</var>+1</sub> = <var>s</var><sub><var>k</var></sub><sup>2</sup>
|
21
21
|
mod 50515093\r\n- <var>t</var><sub><var>k</var></sub> = (<var>s</var><sub><var>k</var></sub>
|
22
22
|
mod 64) + 1\r\n\nStarting from the initial configuration (<var>t</var><sub>0</sub>,
|
data/data/problems/427.yml
CHANGED
@@ -4,13 +4,13 @@
|
|
4
4
|
:url: http://projecteuler.net/problem=427
|
5
5
|
:content: "A sequence of integers S = {s<sub><var>i</var></sub>} is called an <var>n-sequence</var>
|
6
6
|
if it has <var>n</var> elements and each element s<sub><var>i</var></sub> satisfies
|
7
|
-
1 ![≤](/
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
7
|
+
1 ![≤]({{ images_dir }}/symbol_le.gif) s<sub><var>i</var></sub> ![≤]({{ images_dir
|
8
|
+
}}/symbol_le.gif) <var>n</var>. Thus there are <var>n</var><sup><var>n</var></sup>
|
9
|
+
distinct <var>n</var>-sequences in total.\rFor example, the sequence S = {1, 5,
|
10
|
+
5, 10, 7, 7, 7, 2, 3, 7} is a 10-sequence.\n\nFor any sequence S, let L(S) be the
|
11
|
+
length of the longest contiguous subsequence of S with the same value.\rFor example,
|
12
|
+
for the given sequence S above, L(S) = 3, because of the three consecutive 7's.\n\nLet
|
13
|
+
<var>f</var>(<var>n</var>) = ![∑]({{ images_dir }}/symbol_sum.gif) L(S) for all
|
14
|
+
<var>n</var>-sequences S.\n\nFor example, <var>f</var>(3) = 45, <var>f</var>(7)
|
15
15
|
= 1403689 and <var>f</var>(11) = 481496895121.\n\nFind <var>f</var>(7 500 000) mod
|
16
16
|
1 000 000 009.\n\n"
|
data/data/problems/428.yml
CHANGED
@@ -7,22 +7,19 @@
|
|
7
7
|
|YZ| = <var>c</var> and |WZ| = <var>a</var> + <var>b</var> + <var>c</var>. \n\rLet
|
8
8
|
C<sub>in</sub> be the circle having the diameter XY. \n\rLet C<sub>out</sub> be
|
9
9
|
the circle having the diameter WZ.\n\nThe triplet (<var>a</var>, <var>b</var>, <var>c</var>)
|
10
|
-
is called a _necklace triplet_ if you can place <var>k</var> ![≥](
|
11
|
-
3 distinct circles C<sub>1</sub>, C<sub>2</sub>, ..., C<sub><var>k</var></sub>
|
12
|
-
that:\n\n- C<sub><var>i</var></sub> has no common interior points with any
|
13
|
-
for 1 ![≤](/
|
14
|
-
<var>j</var> ![≤](/
|
15
|
-
<var>
|
16
|
-
|
17
|
-
|
18
|
-
<var>i</var> ![≤](/
|
19
|
-
<var>
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
integers, and <var>b</var> ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif)
|
27
|
-
<var>n</var>.\rFor example, T(1) = 9, T(20) = 732 and T(3000) = 438106.\n\nFind
|
28
|
-
T(1 000 000 000).\n\n"
|
10
|
+
is called a _necklace triplet_ if you can place <var>k</var> ![≥]({{ images_dir
|
11
|
+
}}/symbol_ge.gif) 3 distinct circles C<sub>1</sub>, C<sub>2</sub>, ..., C<sub><var>k</var></sub>
|
12
|
+
such that:\n\n- C<sub><var>i</var></sub> has no common interior points with any
|
13
|
+
C<sub><var>j</var></sub> for 1 ![≤]({{ images_dir }}/symbol_le.gif) <var>i</var>,
|
14
|
+
<var>j</var> ![≤]({{ images_dir }}/symbol_le.gif) <var>k</var> and <var>i</var>
|
15
|
+
![≠]({{ images_dir }}/symbol_ne.gif) <var>j</var>,\r\n- C<sub><var>i</var></sub>
|
16
|
+
is tangent to both C<sub>in</sub> and C<sub>out</sub> for 1 ![≤]({{ images_dir }}/symbol_le.gif)
|
17
|
+
<var>i</var> ![≤]({{ images_dir }}/symbol_le.gif) <var>k</var>,\r\n- C<sub><var>i</var></sub>
|
18
|
+
is tangent to C<sub><var>i</var>+1</sub> for 1 ![≤]({{ images_dir }}/symbol_le.gif)
|
19
|
+
<var>i</var> k, and\r\n- C<sub><var>k</var></sub> is tangent to C<sub>1</sub>.\r\n\nFor
|
20
|
+
example, (5, 5, 5) and (4, 3, 21) are necklace triplets, while it can be shown that
|
21
|
+
(2, 2, 5) is not.\n\n![]({{ images_dir }}/p428_necklace.png)\n\nLet T(<var>n</var>)
|
22
|
+
be the number of necklace triplets (<var>a</var>, <var>b</var>, <var>c</var>) such
|
23
|
+
that <var>a</var>, <var>b</var> and <var>c</var> are positive integers, and <var>b</var>
|
24
|
+
![≤]({{ images_dir }}/symbol_le.gif) <var>n</var>.\rFor example, T(1) = 9, T(20) = 732
|
25
|
+
and T(3000) = 438106.\n\nFind T(1 000 000 000).\n\n"
|
data/data/problems/430.yml
CHANGED
@@ -9,10 +9,9 @@
|
|
9
9
|
uniformly at random. \n\rAll disks with an index from <var>A</var> to <var>B</var>
|
10
10
|
(inclusive) are flipped.\n\nThe following example shows the case <var>N</var> =
|
11
11
|
8. At the first turn <var>A</var> = 5 and <var>B</var> = 2, and at the second turn
|
12
|
-
<var>A</var> = 4 and <var>B</var> = 6.\n\n![](/
|
12
|
+
<var>A</var> = 4 and <var>B</var> = 6.\n\n![]({{ images_dir }}/p_430_flips.gif)\n\nLet
|
13
13
|
E(<var>N</var>, <var>M</var>) be the expected number of disks that show their white
|
14
14
|
side after <var>M</var> turns. \n\rWe can verify that E(3, 1) = 10/9, E(3, 2) =
|
15
|
-
5/3, E(10, 4) ![≈](/
|
16
|
-
|
17
|
-
|
18
|
-
places behind the decimal point.\n\n"
|
15
|
+
5/3, E(10, 4) ![≈]({{ images_dir }}/symbol_asymp.gif) 5.157 and E(100, 10) ![≈]({{
|
16
|
+
images_dir }}/symbol_asymp.gif) 51.893.\n\nFind E(10<sup>10</sup>, 4000). \n\rGive
|
17
|
+
your answer rounded to 2 decimal places behind the decimal point.\n\n"
|
data/data/problems/44.yml
CHANGED
@@ -3,11 +3,11 @@
|
|
3
3
|
:name: Pentagon numbers
|
4
4
|
:url: http://projecteuler.net/problem=44
|
5
5
|
:content: |+
|
6
|
-
Pentagonal numbers are generated by the formula, P<sub><var>n</var></sub>=<var>n</var>(3<var>n</var> ![−](/
|
6
|
+
Pentagonal numbers are generated by the formula, P<sub><var>n</var></sub>=<var>n</var>(3<var>n</var> ![−]({{ images_dir }}/symbol_minus.gif)1)/2. The first ten pentagonal numbers are:
|
7
7
|
|
8
8
|
1, 5, 12, 22, 35, 51, 70, 92, 117, 145, ...
|
9
9
|
|
10
|
-
It can be seen that P<sub>4</sub> + P<sub>7</sub> = 22 + 70 = 92 = P<sub>8</sub>. However, their difference, 70 ![−](/
|
10
|
+
It can be seen that P<sub>4</sub> + P<sub>7</sub> = 22 + 70 = 92 = P<sub>8</sub>. However, their difference, 70 ![−]({{ images_dir }}/symbol_minus.gif) 22 = 48, is not pentagonal.
|
11
11
|
|
12
|
-
Find the pair of pentagonal numbers, P<sub><var>j</var></sub> and P<sub><var>k</var></sub>, for which their sum and difference are pentagonal and D = |P<sub><var>k</var></sub> ![−](/
|
12
|
+
Find the pair of pentagonal numbers, P<sub><var>j</var></sub> and P<sub><var>k</var></sub>, for which their sum and difference are pentagonal and D = |P<sub><var>k</var></sub> ![−]({{ images_dir }}/symbol_minus.gif) P<sub><var>j</var></sub>| is minimised; what is the value of D?
|
13
13
|
|
data/data/problems/45.yml
CHANGED
@@ -6,8 +6,8 @@
|
|
6
6
|
Triangle, pentagonal, and hexagonal numbers are generated by the following formulae:
|
7
7
|
|
8
8
|
| Triangle | | T<sub><i>n</i></sub>=_n_(_n_+1)/2 | | 1, 3, 6, 10, 15, ... |
|
9
|
-
| Pentagonal | | P<sub><i>n</i></sub>=_n_(3_n_ ![−](/
|
10
|
-
| Hexagonal | | H<sub><i>n</i></sub>=_n_(2_n_ ![−](/
|
9
|
+
| Pentagonal | | P<sub><i>n</i></sub>=_n_(3_n_ ![−]({{ images_dir }}/symbol_minus.gif)1)/2 | | 1, 5, 12, 22, 35, ... |
|
10
|
+
| Hexagonal | | H<sub><i>n</i></sub>=_n_(2_n_ ![−]({{ images_dir }}/symbol_minus.gif)1) | | 1, 6, 15, 28, 45, ... |
|
11
11
|
|
12
12
|
It can be verified that T<sub>285</sub> = P<sub>165</sub> = H<sub>143</sub> = 40755.
|
13
13
|
|
data/data/problems/46.yml
CHANGED
@@ -3,11 +3,11 @@
|
|
3
3
|
:name: Goldbach's other conjecture
|
4
4
|
:url: http://projecteuler.net/problem=46
|
5
5
|
:content: "It was proposed by Christian Goldbach that every odd composite number can
|
6
|
-
be written as the sum of a prime and twice a square.\n\n9 = 7 + 2 ![×](
|
7
|
-
\
|
8
|
-
\ \n\r21 = 3 + 2 ![×](/
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
be written as the sum of a prime and twice a square.\n\n9 = 7 + 2 ![×]({{ images_dir
|
7
|
+
}}/symbol_times.gif)1<sup>2</sup> \n\r15 = 7 + 2 ![×]({{ images_dir }}/symbol_times.gif)2<sup>2</sup>
|
8
|
+
\ \n\r21 = 3 + 2 ![×]({{ images_dir }}/symbol_times.gif)3<sup>2</sup> \n\r25 =
|
9
|
+
7 + 2 ![×]({{ images_dir }}/symbol_times.gif)3<sup>2</sup> \n\r27 = 19 + 2 ![×]({{
|
10
|
+
images_dir }}/symbol_times.gif)2<sup>2</sup> \n\r33 = 31 + 2 ![×]({{ images_dir
|
11
|
+
}}/symbol_times.gif)1<sup>2</sup>\n\nIt turns out that the conjecture was false.\n\nWhat
|
12
|
+
is the smallest odd composite that cannot be written as the sum of a prime and twice
|
13
|
+
a square?\n\n"
|