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/315.yml
CHANGED
@@ -2,30 +2,29 @@
|
|
2
2
|
:id: 315
|
3
3
|
:name: Digital root clocks
|
4
4
|
:url: http://projecteuler.net/problem=315
|
5
|
-
:content: " ![](/
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
\" ![→](/
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
\"
|
19
|
-
|
20
|
-
|
21
|
-
is
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
2 = 10 transitions (\" **2** \" on/off). |\n\n\rFor a grand total of 40 transitions.\r\r\n\nMax's
|
5
|
+
:content: " ![]({{ images_dir }}/p_315_clocks.gif)\n\nSam and Max are asked to transform
|
6
|
+
two digital clocks into two \"digital root\" clocks. \n\rA digital root clock is
|
7
|
+
a digital clock that calculates digital roots step by step.\n\nWhen a clock is fed
|
8
|
+
a number, it will show it and then it will start the calculation, showing all the
|
9
|
+
intermediate values until it gets to the result. \n\rFor example, if the clock
|
10
|
+
is fed the number 137, it will show: \" **137** \" ![→]({{ images_dir }}/symbol_maps.gif)
|
11
|
+
\" **11** \" ![→]({{ images_dir }}/symbol_maps.gif) \" **2** \" and then it will
|
12
|
+
go black, waiting for the next number.\n\nEvery digital number consists of some
|
13
|
+
light segments: three horizontal (top, middle, bottom) and four vertical (top-left,
|
14
|
+
top-right, bottom-left, bottom-right). \n\rNumber \" **1** \" is made of vertical
|
15
|
+
top-right and bottom-right, number \" **4** \" is made by middle horizontal and
|
16
|
+
vertical top-left, top-right and bottom-right. Number \" **8** \" lights them all.\n\nThe
|
17
|
+
clocks consume energy only when segments are turned on/off. \n\rTo turn on a \"
|
18
|
+
**2** \" will cost 5 transitions, while a \" **7** \" will cost only 4 transitions.\n\nSam
|
19
|
+
and Max built two different clocks.\n\nSam's clock is fed e.g. number 137: the clock
|
20
|
+
shows \" **137** \", then the panel is turned off, then the next number (\" **11**
|
21
|
+
\") is turned on, then the panel is turned off again and finally the last number
|
22
|
+
(\" **2** \") is turned on and, after some time, off. \n\rFor the example, with
|
23
|
+
number 137, Sam's clock requires:\n\n| \" **137** \" | : | (2 + 5 + 4) ![×]({{ images_dir
|
24
|
+
}}/symbol_times.gif) 2 = 22 transitions (\" **137** \" on/off). |\n| \" **11** \"
|
25
|
+
| : | (2 + 2) ![×]({{ images_dir }}/symbol_times.gif) 2 = 8 transitions (\" **11**
|
26
|
+
\" on/off). |\n| \" **2** \" | : | (5) ![×]({{ images_dir }}/symbol_times.gif) 2
|
27
|
+
= 10 transitions (\" **2** \" on/off). |\n\n\rFor a grand total of 40 transitions.\r\r\n\nMax's
|
29
28
|
clock works differently. Instead of turning off the whole panel, it is smart enough
|
30
29
|
to turn off only those segments that won't be needed for the next number. \n\rFor
|
31
30
|
number 137, Max's clock requires:\n\n| \" **137** \" \n \n \n | : \n \n \n
|
@@ -38,6 +37,6 @@
|
|
38
37
|
(to turn on the remaining segments in order to get a \" **2** \") \n\r5 transitions
|
39
38
|
(to turn off number \" **2** \"). |\n\n\rFor a grand total of 30 transitions.\r\r\n\nOf
|
40
39
|
course, Max's clock consumes less power than Sam's one. \n\rThe two clocks are
|
41
|
-
fed all the prime numbers between A = 10<sup>7</sup> and B = 2 ![×](
|
42
|
-
\
|
43
|
-
clock and that needed by Max's one.\n\n"
|
40
|
+
fed all the prime numbers between A = 10<sup>7</sup> and B = 2 ![×]({{ images_dir
|
41
|
+
}}/symbol_times.gif)10<sup>7</sup>. \n\rFind the difference between the total
|
42
|
+
number of transitions needed by Sam's clock and that needed by Max's one.\n\n"
|
data/data/problems/316.yml
CHANGED
@@ -19,7 +19,5 @@
|
|
19
19
|
<var>n</var> = 535, then \n\rfor <var>p</var> = 31415926 **535** 897...., we get
|
20
20
|
<var>k</var> = 9 \n\rfor <var>p</var> = 35528714365004956000049084876408468 **535**
|
21
21
|
4..., we get <var>k</var> = 36 \n\retc and we find that <var>g</var>(535) = 1008.\n\nGiven
|
22
|
-
that ![](/
|
23
|
-
|
24
|
-
![](/home/will/src/euler-manager/config/../data/images/p_316_decexp3.gif) represents
|
25
|
-
the floor function.\r\n"
|
22
|
+
that ![]({{ images_dir }}/p_316_decexp1.gif), find ![]({{ images_dir }}/p_316_decexp2.gif)\n\n<u><i>Note</i></u>:
|
23
|
+
![]({{ images_dir }}/p_316_decexp3.gif) represents the floor function.\r\n"
|
data/data/problems/318.yml
CHANGED
@@ -2,38 +2,31 @@
|
|
2
2
|
:id: 318
|
3
3
|
:name: 2011 nines
|
4
4
|
:url: http://projecteuler.net/problem=318
|
5
|
-
:content: "Consider the real number ![√](/
|
6
|
-
|
7
|
-
|
8
|
-
![√](/
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
![√](/
|
13
|
-
=
|
14
|
-
![√](/
|
15
|
-
=
|
16
|
-
|
17
|
-
|
18
|
-
![√](/
|
19
|
-
=
|
20
|
-
|
21
|
-
|
22
|
-
![√](/
|
23
|
-
|
24
|
-
![√](/
|
25
|
-
|
26
|
-
|
27
|
-
fact it can be proven that the fractional part of ( ![√](/home/will/src/euler-manager/config/../data/images/symbol_radic.gif)2+
|
28
|
-
![√](/home/will/src/euler-manager/config/../data/images/symbol_radic.gif)3)<sup>2n</sup>
|
29
|
-
approaches 1 for large n.\n\nConsider all real numbers of the form ![√](/home/will/src/euler-manager/config/../data/images/symbol_radic.gif)p+
|
30
|
-
![√](/home/will/src/euler-manager/config/../data/images/symbol_radic.gif)q with
|
31
|
-
p and q positive integers and p ![<](/home/will/src/euler-manager/config/../data/images/symbol_lt.gif)q,
|
32
|
-
such that the fractional part \rof ( ![√](/home/will/src/euler-manager/config/../data/images/symbol_radic.gif)p+
|
33
|
-
![√](/home/will/src/euler-manager/config/../data/images/symbol_radic.gif)q)<sup>2n</sup>
|
5
|
+
:content: "Consider the real number ![√]({{ images_dir }}/symbol_radic.gif)2+ ![√]({{
|
6
|
+
images_dir }}/symbol_radic.gif)3. \n\rWhen we calculate the even powers of ![√]({{
|
7
|
+
images_dir }}/symbol_radic.gif)2+ ![√]({{ images_dir }}/symbol_radic.gif)3\rwe get:
|
8
|
+
\ \n\r( ![√]({{ images_dir }}/symbol_radic.gif)2+ ![√]({{ images_dir }}/symbol_radic.gif)3)<sup>2</sup>
|
9
|
+
= 9.898979485566356... \n\r( ![√]({{ images_dir }}/symbol_radic.gif)2+ ![√]({{
|
10
|
+
images_dir }}/symbol_radic.gif)3)<sup>4</sup> = 97.98979485566356... \n\r( ![√]({{
|
11
|
+
images_dir }}/symbol_radic.gif)2+ ![√]({{ images_dir }}/symbol_radic.gif)3)<sup>6</sup>
|
12
|
+
= 969.998969071069263... \n\r( ![√]({{ images_dir }}/symbol_radic.gif)2+ ![√]({{
|
13
|
+
images_dir }}/symbol_radic.gif)3)<sup>8</sup> = 9601.99989585502907... \n\r( ![√]({{
|
14
|
+
images_dir }}/symbol_radic.gif)2+ ![√]({{ images_dir }}/symbol_radic.gif)3)<sup>10</sup>
|
15
|
+
= 95049.999989479221... \n\r( ![√]({{ images_dir }}/symbol_radic.gif)2+ ![√]({{
|
16
|
+
images_dir }}/symbol_radic.gif)3)<sup>12</sup> = 940897.9999989371855... \n\r(
|
17
|
+
![√]({{ images_dir }}/symbol_radic.gif)2+ ![√]({{ images_dir }}/symbol_radic.gif)3)<sup>14</sup>
|
18
|
+
= 9313929.99999989263... \n\r( ![√]({{ images_dir }}/symbol_radic.gif)2+ ![√]({{
|
19
|
+
images_dir }}/symbol_radic.gif)3)<sup>16</sup> = 92198401.99999998915...\n\nIt looks
|
20
|
+
like that the number of consecutive nines at the beginning of the fractional part
|
21
|
+
of these powers is non-decreasing. \n\rIn fact it can be proven that the fractional
|
22
|
+
part of ( ![√]({{ images_dir }}/symbol_radic.gif)2+ ![√]({{ images_dir }}/symbol_radic.gif)3)<sup>2n</sup>
|
23
|
+
approaches 1 for large n.\n\nConsider all real numbers of the form ![√]({{ images_dir
|
24
|
+
}}/symbol_radic.gif)p+ ![√]({{ images_dir }}/symbol_radic.gif)q with p and q positive
|
25
|
+
integers and p ![<]({{ images_dir }}/symbol_lt.gif)q, such that the fractional part
|
26
|
+
\rof ( ![√]({{ images_dir }}/symbol_radic.gif)p+ ![√]({{ images_dir }}/symbol_radic.gif)q)<sup>2n</sup>
|
34
27
|
approaches 1 for large n.\n\nLet C(p,q,n) be the number of consecutive nines at
|
35
|
-
the beginning of the fractional part of \n ( ![√](/
|
36
|
-
![√](/
|
37
|
-
|
38
|
-
|
39
|
-
|
28
|
+
the beginning of the fractional part of \n ( ![√]({{ images_dir }}/symbol_radic.gif)p+
|
29
|
+
![√]({{ images_dir }}/symbol_radic.gif)q)<sup>2n</sup>.\n\nLet N(p,q) be the minimal
|
30
|
+
value of n such that C(p,q,n) ![≥]({{ images_dir }}/symbol_ge.gif) 2011.\n\nFind
|
31
|
+
![∑]({{ images_dir }}/symbol_sum.gif)N(p,q) for p+q ![≤]({{ images_dir }}/symbol_le.gif)
|
32
|
+
2011.\n\n"
|
data/data/problems/319.yml
CHANGED
@@ -4,16 +4,15 @@
|
|
4
4
|
:url: http://projecteuler.net/problem=319
|
5
5
|
:content: "Let <var>x</var><sub>1</sub>, <var>x</var><sub>2</sub>,..., <var>x<sub>n</sub></var>
|
6
6
|
be a sequence of length <var>n</var> such that:\n\n- <var>x</var><sub>1</sub> =
|
7
|
-
2\n- for all 1 ![<](/
|
8
|
-
<var>i</var> ![
|
9
|
-
<var>
|
10
|
-
<var>
|
11
|
-
<var>
|
12
|
-
|
13
|
-
|
14
|
-
sequences of length
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
= 86195 and <var>t</var>(20) = 5227991891.\n\nFind <var>t</var>(10<sup>10</sup>)
|
7
|
+
2\n- for all 1 ![<]({{ images_dir }}/symbol_lt.gif) <var>i</var> ![≤]({{ images_dir
|
8
|
+
}}/symbol_le.gif) <var>n</var> : <var>x</var><sub><var>i</var>-<i>1</i></sub> ![<]({{
|
9
|
+
images_dir }}/symbol_lt.gif) <var>x<sub>i</sub></var>\n- for all <var>i</var> and
|
10
|
+
<var>j</var> with 1 ![≤]({{ images_dir }}/symbol_le.gif) <var>i</var>, <var>j</var>
|
11
|
+
![≤]({{ images_dir }}/symbol_le.gif) <var>n</var> : (<var>x<sub>i</sub></var>)<var><sup>
|
12
|
+
j</sup></var> ![<]({{ images_dir }}/symbol_lt.gif) (<var>x<sub>j</sub></var> + 1)<var><sup>i</sup></var>\n\nThere
|
13
|
+
are only five such sequences of length 2, namely:\r{2,4}, {2,5}, {2,6}, {2,7} and
|
14
|
+
{2,8}. \n\rThere are 293 such sequences of length 5; three examples are given below:
|
15
|
+
\ \n\r{2,5,11,25,55}, {2,6,14,36,88}, {2,8,22,64,181}.\n\nLet <var>t</var>(<var>n</var>)
|
16
|
+
denote the number of such sequences of length <var>n</var>. \n\rYou are given that
|
17
|
+
<var>t</var>(10) = 86195 and <var>t</var>(20) = 5227991891.\n\nFind <var>t</var>(10<sup>10</sup>)
|
19
18
|
and give your answer modulo 10<sup>9</sup>.\n\n"
|
data/data/problems/32.yml
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
:content: |+
|
6
6
|
We shall say that an <var>n</var>-digit number is pandigital if it makes use of all the digits 1 to <var>n</var> exactly once; for example, the 5-digit number, 15234, is 1 through 5 pandigital.
|
7
7
|
|
8
|
-
The product 7254 is unusual, as the identity, 39 ![×](/
|
8
|
+
The product 7254 is unusual, as the identity, 39 ![×]({{ images_dir }}/symbol_times.gif) 186 = 7254, containing multiplicand, multiplier, and product is 1 through 9 pandigital.
|
9
9
|
|
10
10
|
Find the sum of all products whose multiplicand/multiplier/product identity can be written as a 1 through 9 pandigital.
|
11
11
|
|
data/data/problems/320.yml
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
:content: |+
|
6
6
|
Let N(<var>i</var>) be the smallest integer <var>n</var> such that <var>n</var>! is divisible by (<var>i</var>!)<sup>1234567890</sup>
|
7
7
|
|
8
|
-
Let S(<var>u</var>)= ![∑](/
|
8
|
+
Let S(<var>u</var>)= ![∑]({{ images_dir }}/symbol_sum.gif)N(<var>i</var>) for 10 ![≤]({{ images_dir }}/symbol_le.gif) <var>i</var> ![≤]({{ images_dir }}/symbol_le.gif) <var>u</var>.
|
9
9
|
|
10
10
|
S(1000)=614538266565663.
|
11
11
|
|
data/data/problems/321.yml
CHANGED
@@ -5,9 +5,9 @@
|
|
5
5
|
:content: "A horizontal row comprising of 2<var>n</var> + 1 squares has <var>n</var>
|
6
6
|
red counters placed at one end and <var>n</var> blue counters at the other end,
|
7
7
|
being separated by a single empty square in the centre. For example, when <var>n</var>
|
8
|
-
= 3.\n\n ![](/
|
9
|
-
|
10
|
-
|
8
|
+
= 3.\n\n ![]({{ images_dir }}/p_321_swapping_counters_1.gif)\n\nA counter can move
|
9
|
+
from one square to the next (slide) or can jump over another counter (hop) as long
|
10
|
+
as the square next to that counter is unoccupied.\n\n ![]({{ images_dir }}/p_321_swapping_counters_2.gif)\n\nLet
|
11
11
|
M(<var>n</var>) represent the minimum number of moves/actions to completely reverse
|
12
12
|
the positions of the coloured counters; that is, move all the red counters to the
|
13
13
|
right and all the blue counters to the left.\n\nIt can be verified M(3) = 15, which
|
data/data/problems/322.yml
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
:url: http://projecteuler.net/problem=322
|
5
5
|
:content: "Let T(<var>m</var>, <var>n</var>) be the number of the binomial coefficients
|
6
6
|
<sup><var>i</var></sup>C<sub><var>n</var></sub> that are divisible by 10 for <var>n</var>
|
7
|
-
![≤](/
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
![≤]({{ images_dir }}/symbol_le.gif) <var>i</var> ![<]({{ images_dir }}/symbol_lt.gif)
|
8
|
+
<var>m</var>(<var>i</var>, <var>m</var> and <var>n</var> are positive integers).
|
9
|
+
\ \n\rYou are given that T(10<sup>9</sup>, 10<sup>7</sup>-10) = 989697000.\n\nFind
|
10
|
+
T(10<sup>18</sup>, 10<sup>12</sup>-10).\n\n"
|
data/data/problems/323.yml
CHANGED
@@ -3,14 +3,13 @@
|
|
3
3
|
:name: Bitwise-OR operations on random integers
|
4
4
|
:url: http://projecteuler.net/problem=323
|
5
5
|
:content: "Let <var>y</var><sub>0</sub>, <var>y</var><sub>1</sub>, <var>y</var><sub>2</sub>,...
|
6
|
-
be a sequence of random unsigned 32 bit integers \n\r(i.e. 0 ![≤](
|
7
|
-
<var>y<sub>i</sub></var> ![<](/
|
6
|
+
be a sequence of random unsigned 32 bit integers \n\r(i.e. 0 ![≤]({{ images_dir
|
7
|
+
}}/symbol_le.gif) <var>y<sub>i</sub></var> ![<]({{ images_dir }}/symbol_lt.gif)
|
8
8
|
2<sup>32</sup>, every value equally likely).\n\nFor the sequence <var>x<sub>i</sub></var>
|
9
9
|
the following recursion is given:\n\n- <var>x</var><sub>0</sub> = 0 and\n- <var>x<sub>i</sub></var>
|
10
10
|
= <var>x</var><sub><var>i</var>-<i>1</i></sub> **|** <var>y</var><sub><var>i</var>-<i>1</i></sub>,
|
11
|
-
for <var>i</var> ![>](/
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
after the decimal point.\n\n"
|
11
|
+
for <var>i</var> ![>]({{ images_dir }}/symbol_gt.gif) 0. ( **|** is the bitwise-OR
|
12
|
+
operator)\n\nIt can be seen that eventually there will be an index N such that <var>x<sub>i</sub></var>
|
13
|
+
= 2<sup>32</sup> -1 (a bit-pattern of all ones) for all <var>i</var> ![≥]({{ images_dir
|
14
|
+
}}/symbol_ge.gif) N.\n\nFind the expected value of N. \n\rGive your answer rounded
|
15
|
+
to 10 digits after the decimal point.\n\n"
|
data/data/problems/324.yml
CHANGED
@@ -3,12 +3,11 @@
|
|
3
3
|
:name: Building a tower
|
4
4
|
:url: http://projecteuler.net/problem=324
|
5
5
|
:content: "Let <var>f</var>(<var>n</var>) represent the number of ways one can fill
|
6
|
-
a 3 ![×](/
|
7
|
-
tower with blocks of 2 ![×](/
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
=
|
12
|
-
mod <var>q</var> =
|
13
|
-
|
14
|
-
mod 100000007.\n\n"
|
6
|
+
a 3 ![×]({{ images_dir }}/symbol_times.gif)3 ![×]({{ images_dir }}/symbol_times.gif)<var>n</var>
|
7
|
+
tower with blocks of 2 ![×]({{ images_dir }}/symbol_times.gif)1 ![×]({{ images_dir
|
8
|
+
}}/symbol_times.gif)1. \nYou're allowed to rotate the blocks in any way you like;
|
9
|
+
however, rotations, reflections etc of the tower itself are counted as distinct.\n\nFor
|
10
|
+
example (with <var>q</var> = 100000007) : \n<var>f</var>(2) = 229, \n<var>f</var>(4)
|
11
|
+
= 117805, \n<var>f</var>(10) mod <var>q</var> = 96149360, \n<var>f</var>(10<sup>3</sup>)
|
12
|
+
mod <var>q</var> = 24806056, \n<var>f</var>(10<sup>6</sup>) mod <var>q</var> =
|
13
|
+
30808124.\n\nFind <var>f</var>(10<sup>10000</sup>) mod 100000007.\n\n"
|
data/data/problems/325.yml
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
|
14
14
|
A _losing configuration_ is one where the second player can force a win, no matter what the first player does. For example, (2,3) and (3,4) are losing configurations: any legal move leaves a winning configuration for the second player.
|
15
15
|
|
16
|
-
Define S(<var>N</var>) as the sum of (<var>x</var><sub><var>i</var></sub>+<var>y</var><sub><var>i</var></sub>) for all losing configurations (<var>x</var><sub><var>i</var></sub>,<var>y</var><sub><var>i</var></sub>), 0 ![<](/
|
16
|
+
Define S(<var>N</var>) as the sum of (<var>x</var><sub><var>i</var></sub>+<var>y</var><sub><var>i</var></sub>) for all losing configurations (<var>x</var><sub><var>i</var></sub>,<var>y</var><sub><var>i</var></sub>), 0 ![<]({{ images_dir }}/symbol_lt.gif) <var>x</var><sub><var>i</var></sub> ![<]({{ images_dir }}/symbol_lt.gif) <var>y</var><sub><var>i</var></sub> ![≤]({{ images_dir }}/symbol_le.gif) <var>N</var>. We can verify that S(10) = 211 and S(10<sup>4</sup>) = 230312207313.
|
17
17
|
|
18
18
|
Find S(10<sup>16</sup>) mod 7<sup>10</sup>.
|
19
19
|
|
data/data/problems/326.yml
CHANGED
@@ -3,13 +3,13 @@
|
|
3
3
|
:name: Modulo Summations
|
4
4
|
:url: http://projecteuler.net/problem=326
|
5
5
|
:content: |+
|
6
|
-
Let <var>a<sub>n</sub></var> be a sequence recursively defined by: ![](/
|
6
|
+
Let <var>a<sub>n</sub></var> be a sequence recursively defined by: ![]({{ images_dir }}/p_326_formula1.gif).
|
7
7
|
|
8
8
|
So the first 10 elements of <var>a<sub>n</sub></var> are: 1,1,0,3,0,3,5,4,1,9.
|
9
9
|
|
10
10
|
Let <var>f</var>(<var>N,M</var>) represent the number of pairs (<var>p,q</var>) such that:
|
11
11
|
|
12
|
-
![](/
|
12
|
+
![]({{ images_dir }}/p_326_formula2.gif)
|
13
13
|
|
14
14
|
It can be seen that <var>f</var>(10,10)=4 with the pairs (3,3), (5,5), (7,9) and (9,10).
|
15
15
|
|
data/data/problems/327.yml
CHANGED
@@ -3,33 +3,31 @@
|
|
3
3
|
:name: Rooms of Doom
|
4
4
|
:url: http://projecteuler.net/problem=327
|
5
5
|
:content: "A series of three rooms are connected to each other by automatic doors.\n\n
|
6
|
-
![](/
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
![≤](/
|
31
|
-
|
32
|
-
<var>C</var> ![≤](/
|
33
|
-
10.\n\nFind ΣM(<var>C</var>,30) for 3 ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif)
|
34
|
-
<var>C</var> ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif)
|
6
|
+
![]({{ images_dir }}/p_327_rooms_of_doom.gif)\n\nEach door is operated by a security
|
7
|
+
card. Once you enter a room the door automatically closes and that security card
|
8
|
+
cannot be used again. A machine at the start will dispense an unlimited number of
|
9
|
+
cards, but each room (including the starting room) contains scanners and if they
|
10
|
+
detect that you are holding more than three security cards or if they detect an
|
11
|
+
unattended security card on the floor, then all the doors will become permanently
|
12
|
+
locked. However, each room contains a box where you may safely store any number
|
13
|
+
of security cards for use at a later stage.\n\nIf you simply tried to travel through
|
14
|
+
the rooms one at a time then as you entered room 3 you would have used all three
|
15
|
+
cards and would be trapped in that room forever!\n\nHowever, if you make use of
|
16
|
+
the storage boxes, then escape is possible. For example, you could enter room 1
|
17
|
+
using your first card, place one card in the storage box, and use your third card
|
18
|
+
to exit the room back to the start. Then after collecting three more cards from
|
19
|
+
the dispensing machine you could use one to enter room 1 and collect the card you
|
20
|
+
placed in the box a moment ago. You now have three cards again and will be able
|
21
|
+
to travel through the remaining three doors. This method allows you to travel through
|
22
|
+
all three rooms using six security cards in total.\n\nIt is possible to travel through
|
23
|
+
six rooms using a total of 123 security cards while carrying a maximum of 3 cards.\n\nLet
|
24
|
+
<var>C</var> be the maximum number of cards which can be carried at any time.\n\nLet
|
25
|
+
<var>R</var> be the number of rooms to travel through.\n\nLet M(<var>C</var>,<var>R</var>)
|
26
|
+
be the minimum number of cards required from the dispensing machine to travel through
|
27
|
+
<var>R</var> rooms carrying up to a maximum of <var>C</var> cards at any time.\n\nFor
|
28
|
+
example, M(3,6)=123 and M(4,6)=23. \nAnd, ΣM(<var>C</var>,6)=146 for 3 ![≤]({{
|
29
|
+
images_dir }}/symbol_le.gif) <var>C</var> ![≤]({{ images_dir }}/symbol_le.gif) 4.\n\nYou
|
30
|
+
are given that ΣM(<var>C</var>,10)=10382 for 3 ![≤]({{ images_dir }}/symbol_le.gif)
|
31
|
+
<var>C</var> ![≤]({{ images_dir }}/symbol_le.gif) 10.\n\nFind ΣM(<var>C</var>,30)
|
32
|
+
for 3 ![≤]({{ images_dir }}/symbol_le.gif) <var>C</var> ![≤]({{ images_dir }}/symbol_le.gif)
|
35
33
|
40.\n\n"
|
data/data/problems/328.yml
CHANGED
@@ -29,5 +29,5 @@
|
|
29
29
|
just described an optimal strategy for <var>n</var>=8.\n\nLet C(<var>n</var>) be
|
30
30
|
the worst-case cost achieved by an optimal strategy for <var>n</var>, as described
|
31
31
|
above. \n\rThus C(1) = 0, C(2) = 1, C(3) = 2 and C(8) = 12. \n\rSimilarly, C(100)
|
32
|
-
= 400 and ![](/
|
33
|
-
|
32
|
+
= 400 and ![]({{ images_dir }}/p_328_sum1.gif)C(<var>n</var>) = 17575.\n\nFind ![]({{
|
33
|
+
images_dir }}/p_328_sum2.gif)C(<var>n</var>).\n\n"
|
data/data/problems/330.yml
CHANGED
@@ -3,19 +3,18 @@
|
|
3
3
|
:name: Euler's Number
|
4
4
|
:url: http://projecteuler.net/problem=330
|
5
5
|
:content: "\rAn infinite sequence of real numbers <var>a</var>(<var>n</var>) is defined
|
6
|
-
for all integers <var>n</var> as follows:\r\n ![](/
|
6
|
+
for all integers <var>n</var> as follows:\r\n ![]({{ images_dir }}/p_330_formula.gif)\n\nFor
|
7
7
|
example,\n\n| <var>a</var>(0) = | \n\n| 1 |\n| 1! |\n\n | + | \n\n| 1 |\n| 2! |\n\n
|
8
|
-
| + | \n\n| 1 |\n| 3! |\n\n | + ... = e ![−](/
|
9
|
-
1 |\n\n| <var>a</var>(1) = | \n\n| e ![−](/
|
10
|
-
1
|
11
|
-
= 2e ![−](
|
12
|
-
|\n\n|
|
13
|
-
3 |\n| 1! |\n\n | + | \n\n| e ![−](/home/will/src/euler-manager/config/../data/images/symbol_minus.gif)
|
8
|
+
| + | \n\n| 1 |\n| 3! |\n\n | + ... = e ![−]({{ images_dir }}/symbol_minus.gif)
|
9
|
+
1 |\n\n| <var>a</var>(1) = | \n\n| e ![−]({{ images_dir }}/symbol_minus.gif) 1 |\n|
|
10
|
+
1! |\n\n | + | \n\n| 1 |\n| 2! |\n\n | + | \n\n| 1 |\n| 3! |\n\n | + ... = 2e ![−]({{
|
11
|
+
images_dir }}/symbol_minus.gif) 3 |\n\n| <var>a</var>(2) = | \n\n| 2e ![−]({{ images_dir
|
12
|
+
}}/symbol_minus.gif) 3 |\n| 1! |\n\n | + | \n\n| e ![−]({{ images_dir }}/symbol_minus.gif)
|
14
13
|
1 |\n| 2! |\n\n | + | \n\n| 1 |\n| 3! |\n\n | + ... = | \n\n| 7 |\n| 2 |\n\n | e
|
15
|
-
![−](/
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
14
|
+
![−]({{ images_dir }}/symbol_minus.gif) 6 |\n\n\rwith e = 2.7182818... being Euler's
|
15
|
+
constant.\r\r\n\n| It can be shown that <var>a</var>(<var>n</var>) is of the form
|
16
|
+
\r | \n\n| A(<var>n</var>) e + B(<var>n</var>) |\n| <var>n</var>! |\n\n | for integers
|
17
|
+
A(<var>n</var>) and B(<var>n</var>). \r |\n\n| For example <var>a</var>(10) = \r
|
18
|
+
| \n\n| 328161643 e ![−]({{ images_dir }}/symbol_minus.gif) 652694486 |\n| 10! |\n\n
|
19
|
+
| . |\n\nFind A(10<sup>9</sup>) + B(10<sup>9</sup>) and give your answer mod 77
|
20
|
+
777 777.\n\n"
|
data/data/problems/331.yml
CHANGED
@@ -2,21 +2,21 @@
|
|
2
2
|
:id: 331
|
3
3
|
:name: Cross flips
|
4
4
|
:url: http://projecteuler.net/problem=331
|
5
|
-
:content: "<var>N</var> ![×](/
|
6
|
-
|
5
|
+
:content: "<var>N</var> ![×]({{ images_dir }}/symbol_times.gif)<var>N</var> disks
|
6
|
+
are placed on a square game board. Each disk has a black side and white side.\n\nAt
|
7
7
|
each turn, you may choose a disk and flip all the disks in the same row and the
|
8
|
-
same column as this disk: thus 2 ![×](/
|
8
|
+
same column as this disk: thus 2 ![×]({{ images_dir }}/symbol_times.gif)<var>N</var>-1
|
9
9
|
disks are flipped. The game ends when all disks show their white side. The following
|
10
|
-
example shows a game on a 5 ![×](/
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
disks: \n\rA disk at (<var>x</var>,<var>y</var>) satisfying ![](/
|
10
|
+
example shows a game on a 5 ![×]({{ images_dir }}/symbol_times.gif)5 board.\n\n
|
11
|
+
![]({{ images_dir }}/p_331_crossflips3.gif)\n\nIt can be proven that 3 is the minimal
|
12
|
+
number of turns to finish this game.\n\nThe bottom left disk on the <var>N</var>
|
13
|
+
![×]({{ images_dir }}/symbol_times.gif)<var>N</var> board has coordinates (0,0);
|
14
|
+
\ \n\rthe bottom right disk has coordinates (<var>N</var>-1,0) and the top left
|
15
|
+
disk has coordinates (0,<var>N</var>-1).\n\nLet C<sub><var>N</var></sub> be the
|
16
|
+
following configuration of a board with <var>N</var> ![×]({{ images_dir }}/symbol_times.gif)<var>N</var>
|
17
|
+
disks: \n\rA disk at (<var>x</var>,<var>y</var>) satisfying ![]({{ images_dir }}/p_331_crossflips1.gif),
|
18
18
|
shows its black side; otherwise, it shows its white side. C<sub>5</sub> is shown
|
19
19
|
above.\n\nLet T(<var>N</var>) be the minimal number of turns to finish a game starting
|
20
20
|
from configuration C<sub><var>N</var></sub> or 0 if configuration C<sub><var>N</var></sub>
|
21
21
|
is unsolvable. \n\rWe have shown that T(5)=3. You are also given that T(10)=29
|
22
|
-
and T(1 000)=395253.\n\nFind ![](/
|
22
|
+
and T(1 000)=395253.\n\nFind ![]({{ images_dir }}/p_331_crossflips2.gif).\n\n"
|
data/data/problems/332.yml
CHANGED
@@ -3,12 +3,13 @@
|
|
3
3
|
:name: Spherical triangles
|
4
4
|
:url: http://projecteuler.net/problem=332
|
5
5
|
:content: "A **spherical triangle** is a figure formed on the surface of a sphere
|
6
|
-
by three **great circular arcs** intersecting pairwise in three vertices.\n\n ![](
|
7
|
-
C(<var>r</var>) be the sphere with the
|
8
|
-
Z(<var>r</var>) be the set of points
|
9
|
-
coordinates. \n\rLet T(<var>r</var>)
|
10
|
-
in Z(<var>r</var>).\rDegenerate
|
11
|
-
same great arc, are <u>not</u>
|
12
|
-
|
13
|
-
A(14) is 3.294040 rounded
|
14
|
-
A(<var>r</var>).
|
6
|
+
by three **great circular arcs** intersecting pairwise in three vertices.\n\n ![]({{
|
7
|
+
images_dir }}/p_332_spherical.jpg)\n\nLet C(<var>r</var>) be the sphere with the
|
8
|
+
centre (0,0,0) and radius <var>r</var>. \n\rLet Z(<var>r</var>) be the set of points
|
9
|
+
on the surface of C(<var>r</var>) with integer coordinates. \n\rLet T(<var>r</var>)
|
10
|
+
be the set of spherical triangles with vertices in Z(<var>r</var>).\rDegenerate
|
11
|
+
spherical triangles, formed by three points on the same great arc, are <u>not</u>
|
12
|
+
included in T(<var>r</var>). \n\rLet A(<var>r</var>) be the area of the smallest
|
13
|
+
spherical triangle in T(<var>r</var>).\n\nFor example A(14) is 3.294040 rounded
|
14
|
+
to six decimal places.\n\nFind ![]({{ images_dir }}/p_332_sum.gif) A(<var>r</var>).
|
15
|
+
Give your answer rounded to six decimal places.\n\n"
|
data/data/problems/333.yml
CHANGED
@@ -4,19 +4,18 @@
|
|
4
4
|
:url: http://projecteuler.net/problem=333
|
5
5
|
:content: "All positive integers can be partitioned in such a way that each and every
|
6
6
|
term of the partition can be expressed as 2<sup>i</sup>x3<sup>j</sup>, where i,j
|
7
|
-
![≥](/
|
8
|
-
|
9
|
-
|
10
|
-
+ 2<sup>
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
that P(<var>q</var>)=1.\n\n"
|
7
|
+
![≥]({{ images_dir }}/symbol_ge.gif) 0.\n\nLet's consider only those such partitions
|
8
|
+
where none of the terms can divide any of the other terms.\r \nFor example, the
|
9
|
+
partition of 17 = 2 + 6 + 9 = (2<sup>1</sup>x3<sup>0</sup> + 2<sup>1</sup>x3<sup>1</sup>
|
10
|
+
+ 2<sup>0</sup>x3<sup>2</sup>) would not be valid since 2 can divide 6. Neither
|
11
|
+
would the partition 17 = 16 + 1 = (2<sup>4</sup>x3<sup>0</sup> + 2<sup>0</sup>x3<sup>0</sup>)
|
12
|
+
since 1 can divide 16. The only valid partition of 17 would be 8 + 9 = (2<sup>3</sup>x3<sup>0</sup>
|
13
|
+
+ 2<sup>0</sup>x3<sup>2</sup>).\n\nMany integers have more than one valid partition,
|
14
|
+
the first being 11 having the following two partitions.\r \n11 = 2 + 9 = (2<sup>1</sup>x3<sup>0</sup>
|
15
|
+
+ 2<sup>0</sup>x3<sup>2</sup>)\r \n11 = 8 + 3 = (2<sup>3</sup>x3<sup>0</sup> +
|
16
|
+
2<sup>0</sup>x3<sup>1</sup>)\n\nLet's define P(<var>n</var>) as the number of valid
|
17
|
+
partitions of <var>n</var>. For example, P(11) = 2.\n\nLet's consider only the prime
|
18
|
+
integers <var>q</var> which would have a single valid partition such as P(17).\n\nThe
|
19
|
+
sum of the primes <var>q</var> ![<]({{ images_dir }}/symbol_lt.gif)100 such that
|
20
|
+
P(<var>q</var>)=1 equals 233.\n\nFind the sum of the primes <var>q</var> ![<]({{
|
21
|
+
images_dir }}/symbol_lt.gif)1000000 such that P(<var>q</var>)=1.\n\n"
|
data/data/problems/334.yml
CHANGED
@@ -8,20 +8,20 @@
|
|
8
8
|
any bowl, and putting one in each of the two adjacent bowls. \n The game ends when
|
9
9
|
each bowl contains either one or no beans.\n\nFor example, consider two adjacent
|
10
10
|
bowls containing 2 and 3 beans respectively, all other bowls being empty. The following
|
11
|
-
eight moves will finish the game:\n\n ![](/
|
11
|
+
eight moves will finish the game:\n\n ![]({{ images_dir }}/p_334_beans.gif)\n\nYou
|
12
12
|
are given the following sequences:\n\n| <var>t</var><sub><i>0</i></sub> = 123456.\r
|
13
|
-
|\n\n| <var>t</var><sub><i>i</i></sub> = \r | ![](/
|
13
|
+
|\n\n| <var>t</var><sub><i>i</i></sub> = \r | ![]({{ images_dir }}/p_334_cases.gif)
|
14
14
|
| \n\n| | \n\n| <var>t</var><sub><i>i-1</i></sub> |\n| 2 |\n\n | \r ,\r | | \r if
|
15
|
-
<var>t</var><sub><i>i-1</i></sub> is even\r |\n| ![](/
|
16
|
-
| \n\n| <var>t</var><sub><i>i-1</i></sub> |\n| 2 |\n\n | ![](/
|
15
|
+
<var>t</var><sub><i>i-1</i></sub> is even\r |\n| ![]({{ images_dir }}/p_334_lfloor.gif)
|
16
|
+
| \n\n| <var>t</var><sub><i>i-1</i></sub> |\n| 2 |\n\n | ![]({{ images_dir }}/p_334_rfloor.gif)
|
17
17
|
| \r 926252, \r | \r if <var>t</var><sub><i>i-1</i></sub> is odd\r |\n\n | |\n|
|
18
|
-
| | \r where ![⌊](/
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
=
|
24
|
-
|
25
|
-
|
26
|
-
<var>b</var><sub><i>
|
27
|
-
|
18
|
+
| | \r where ![⌊]({{ images_dir }}/symbol_lfloor.gif)<var>x</var> ![⌋]({{ images_dir
|
19
|
+
}}/symbol_rfloor.gif) is the floor function\r |\n| | | \r and ![]({{ images_dir
|
20
|
+
}}/p_334_oplus.gif) is the bitwise XOR operator.\r |\n\n| <var>b</var><sub><i>i</i></sub>
|
21
|
+
= ( <var>t</var><sub><i>i</i></sub> mod 2<sup>11</sup>) + 1.\r |\n\nThe first two
|
22
|
+
terms of the last sequence are <var>b</var><sub><i>1</i></sub> = 289 and <var>b</var><sub><i>2</i></sub>
|
23
|
+
= 145. \n\rIf we start with <var>b</var><sub><i>1</i></sub> and <var>b</var><sub><i>2</i></sub>
|
24
|
+
beans in two adjacent bowls, 3419100 moves would be required to finish the game.\n\nConsider
|
25
|
+
now 1500 adjacent bowls containing <var>b</var><sub><i>1</i></sub>, <var>b</var><sub><i>2</i></sub>,...,
|
26
|
+
<var>b</var><sub><i>1500</i></sub> beans respectively, all other bowls being empty.
|
27
|
+
Find how many moves it takes before the game ends.\n\n"
|