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.
Files changed (303) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -0
  3. data/data/images/sod_13.gif +4 -0
  4. data/data/problems/100.yml +1 -1
  5. data/data/problems/101.yml +16 -16
  6. data/data/problems/102.yml +2 -3
  7. data/data/problems/103.yml +16 -16
  8. data/data/problems/105.yml +2 -2
  9. data/data/problems/106.yml +2 -2
  10. data/data/problems/107.yml +15 -15
  11. data/data/problems/108.yml +13 -16
  12. data/data/problems/109.yml +16 -17
  13. data/data/problems/11.yml +22 -23
  14. data/data/problems/110.yml +9 -10
  15. data/data/problems/114.yml +30 -41
  16. data/data/problems/116.yml +19 -25
  17. data/data/problems/117.yml +24 -33
  18. data/data/problems/120.yml +3 -3
  19. data/data/problems/122.yml +18 -20
  20. data/data/problems/123.yml +2 -2
  21. data/data/problems/124.yml +18 -23
  22. data/data/problems/126.yml +10 -11
  23. data/data/problems/127.yml +7 -7
  24. data/data/problems/128.yml +1 -1
  25. data/data/problems/130.yml +6 -7
  26. data/data/problems/131.yml +1 -1
  27. data/data/problems/132.yml +1 -1
  28. data/data/problems/134.yml +2 -2
  29. data/data/problems/135.yml +2 -2
  30. data/data/problems/136.yml +2 -2
  31. data/data/problems/137.yml +4 -4
  32. data/data/problems/138.yml +4 -4
  33. data/data/problems/139.yml +1 -1
  34. data/data/problems/14.yml +12 -13
  35. data/data/problems/140.yml +3 -3
  36. data/data/problems/142.yml +1 -1
  37. data/data/problems/143.yml +2 -2
  38. data/data/problems/144.yml +3 -3
  39. data/data/problems/147.yml +1 -1
  40. data/data/problems/149.yml +11 -13
  41. data/data/problems/15.yml +3 -3
  42. data/data/problems/150.yml +8 -8
  43. data/data/problems/151.yml +1 -1
  44. data/data/problems/152.yml +1 -1
  45. data/data/problems/153.yml +24 -26
  46. data/data/problems/154.yml +10 -9
  47. data/data/problems/155.yml +3 -3
  48. data/data/problems/156.yml +7 -8
  49. data/data/problems/157.yml +3 -4
  50. data/data/problems/158.yml +4 -5
  51. data/data/problems/159.yml +3 -3
  52. data/data/problems/161.yml +5 -4
  53. data/data/problems/163.yml +10 -10
  54. data/data/problems/165.yml +1 -1
  55. data/data/problems/166.yml +7 -7
  56. data/data/problems/167.yml +3 -4
  57. data/data/problems/168.yml +5 -5
  58. data/data/problems/170.yml +2 -2
  59. data/data/problems/171.yml +3 -3
  60. data/data/problems/173.yml +1 -1
  61. data/data/problems/174.yml +3 -3
  62. data/data/problems/175.yml +4 -4
  63. data/data/problems/177.yml +1 -1
  64. data/data/problems/179.yml +1 -1
  65. data/data/problems/180.yml +8 -9
  66. data/data/problems/182.yml +22 -24
  67. data/data/problems/183.yml +14 -15
  68. data/data/problems/184.yml +2 -2
  69. data/data/problems/186.yml +10 -11
  70. data/data/problems/187.yml +6 -8
  71. data/data/problems/189.yml +10 -9
  72. data/data/problems/190.yml +1 -1
  73. data/data/problems/192.yml +11 -12
  74. data/data/problems/194.yml +8 -8
  75. data/data/problems/195.yml +2 -2
  76. data/data/problems/197.yml +5 -6
  77. data/data/problems/198.yml +11 -12
  78. data/data/problems/199.yml +7 -7
  79. data/data/problems/20.yml +8 -10
  80. data/data/problems/202.yml +1 -1
  81. data/data/problems/207.yml +4 -4
  82. data/data/problems/208.yml +4 -5
  83. data/data/problems/21.yml +5 -6
  84. data/data/problems/210.yml +4 -5
  85. data/data/problems/211.yml +1 -1
  86. data/data/problems/212.yml +22 -26
  87. data/data/problems/213.yml +5 -6
  88. data/data/problems/214.yml +8 -9
  89. data/data/problems/215.yml +4 -4
  90. data/data/problems/216.yml +5 -5
  91. data/data/problems/217.yml +8 -10
  92. data/data/problems/218.yml +1 -1
  93. data/data/problems/22.yml +1 -1
  94. data/data/problems/220.yml +15 -15
  95. data/data/problems/221.yml +4 -5
  96. data/data/problems/223.yml +5 -6
  97. data/data/problems/224.yml +5 -6
  98. data/data/problems/226.yml +8 -8
  99. data/data/problems/228.yml +4 -5
  100. data/data/problems/229.yml +16 -16
  101. data/data/problems/230.yml +4 -4
  102. data/data/problems/231.yml +4 -5
  103. data/data/problems/233.yml +1 -1
  104. data/data/problems/234.yml +9 -10
  105. data/data/problems/236.yml +4 -4
  106. data/data/problems/237.yml +3 -3
  107. data/data/problems/238.yml +3 -4
  108. data/data/problems/241.yml +4 -4
  109. data/data/problems/242.yml +2 -2
  110. data/data/problems/243.yml +12 -12
  111. data/data/problems/244.yml +10 -11
  112. data/data/problems/245.yml +14 -15
  113. data/data/problems/246.yml +10 -9
  114. data/data/problems/247.yml +12 -13
  115. data/data/problems/251.yml +3 -3
  116. data/data/problems/252.yml +6 -7
  117. data/data/problems/254.yml +2 -2
  118. data/data/problems/255.yml +35 -36
  119. data/data/problems/256.yml +16 -20
  120. data/data/problems/257.yml +9 -9
  121. data/data/problems/258.yml +5 -6
  122. data/data/problems/26.yml +1 -1
  123. data/data/problems/260.yml +6 -8
  124. data/data/problems/261.yml +6 -7
  125. data/data/problems/262.yml +1 -1
  126. data/data/problems/264.yml +10 -11
  127. data/data/problems/265.yml +1 -1
  128. data/data/problems/27.yml +10 -11
  129. data/data/problems/270.yml +3 -3
  130. data/data/problems/271.yml +5 -6
  131. data/data/problems/272.yml +6 -7
  132. data/data/problems/273.yml +3 -3
  133. data/data/problems/274.yml +15 -15
  134. data/data/problems/275.yml +3 -3
  135. data/data/problems/276.yml +3 -3
  136. data/data/problems/277.yml +3 -3
  137. data/data/problems/278.yml +15 -17
  138. data/data/problems/281.yml +4 -4
  139. data/data/problems/282.yml +2 -2
  140. data/data/problems/284.yml +7 -8
  141. data/data/problems/287.yml +18 -17
  142. data/data/problems/288.yml +1 -1
  143. data/data/problems/289.yml +1 -1
  144. data/data/problems/29.yml +12 -13
  145. data/data/problems/290.yml +1 -1
  146. data/data/problems/291.yml +3 -3
  147. data/data/problems/292.yml +1 -1
  148. data/data/problems/293.yml +7 -7
  149. data/data/problems/295.yml +8 -8
  150. data/data/problems/296.yml +4 -5
  151. data/data/problems/297.yml +4 -5
  152. data/data/problems/299.yml +11 -12
  153. data/data/problems/300.yml +10 -9
  154. data/data/problems/301.yml +2 -2
  155. data/data/problems/303.yml +3 -3
  156. data/data/problems/304.yml +6 -7
  157. data/data/problems/305.yml +3 -2
  158. data/data/problems/306.yml +8 -11
  159. data/data/problems/307.yml +2 -3
  160. data/data/problems/309.yml +8 -8
  161. data/data/problems/31.yml +1 -1
  162. data/data/problems/310.yml +6 -7
  163. data/data/problems/311.yml +11 -11
  164. data/data/problems/312.yml +5 -5
  165. data/data/problems/313.yml +4 -4
  166. data/data/problems/314.yml +4 -5
  167. data/data/problems/315.yml +26 -27
  168. data/data/problems/316.yml +2 -4
  169. data/data/problems/318.yml +27 -34
  170. data/data/problems/319.yml +11 -12
  171. data/data/problems/32.yml +1 -1
  172. data/data/problems/320.yml +1 -1
  173. data/data/problems/321.yml +3 -3
  174. data/data/problems/322.yml +4 -4
  175. data/data/problems/323.yml +7 -8
  176. data/data/problems/324.yml +8 -9
  177. data/data/problems/325.yml +1 -1
  178. data/data/problems/326.yml +2 -2
  179. data/data/problems/327.yml +27 -29
  180. data/data/problems/328.yml +2 -2
  181. data/data/problems/330.yml +13 -14
  182. data/data/problems/331.yml +12 -12
  183. data/data/problems/332.yml +10 -9
  184. data/data/problems/333.yml +15 -16
  185. data/data/problems/334.yml +14 -14
  186. data/data/problems/335.yml +2 -2
  187. data/data/problems/336.yml +5 -4
  188. data/data/problems/337.yml +7 -7
  189. data/data/problems/338.yml +21 -24
  190. data/data/problems/340.yml +6 -7
  191. data/data/problems/341.yml +3 -5
  192. data/data/problems/342.yml +6 -7
  193. data/data/problems/343.yml +8 -12
  194. data/data/problems/344.yml +1 -1
  195. data/data/problems/347.yml +8 -8
  196. data/data/problems/350.yml +5 -5
  197. data/data/problems/351.yml +1 -1
  198. data/data/problems/352.yml +25 -26
  199. data/data/problems/353.yml +1 -1
  200. data/data/problems/354.yml +6 -6
  201. data/data/problems/356.yml +2 -3
  202. data/data/problems/358.yml +13 -14
  203. data/data/problems/359.yml +1 -1
  204. data/data/problems/361.yml +2 -1
  205. data/data/problems/362.yml +11 -13
  206. data/data/problems/363.yml +6 -6
  207. data/data/problems/364.yml +3 -3
  208. data/data/problems/365.yml +2 -2
  209. data/data/problems/366.yml +4 -5
  210. data/data/problems/369.yml +1 -1
  211. data/data/problems/370.yml +3 -3
  212. data/data/problems/372.yml +6 -8
  213. data/data/problems/374.yml +5 -7
  214. data/data/problems/375.yml +5 -6
  215. data/data/problems/377.yml +2 -2
  216. data/data/problems/378.yml +2 -2
  217. data/data/problems/379.yml +7 -8
  218. data/data/problems/38.yml +9 -9
  219. data/data/problems/380.yml +12 -15
  220. data/data/problems/381.yml +8 -11
  221. data/data/problems/382.yml +6 -6
  222. data/data/problems/383.yml +4 -4
  223. data/data/problems/384.yml +7 -8
  224. data/data/problems/385.yml +8 -8
  225. data/data/problems/386.yml +2 -2
  226. data/data/problems/388.yml +5 -6
  227. data/data/problems/39.yml +1 -1
  228. data/data/problems/390.yml +4 -6
  229. data/data/problems/391.yml +11 -12
  230. data/data/problems/392.yml +1 -1
  231. data/data/problems/393.yml +2 -2
  232. data/data/problems/394.yml +6 -7
  233. data/data/problems/395.yml +5 -5
  234. data/data/problems/396.yml +15 -17
  235. data/data/problems/397.yml +5 -8
  236. data/data/problems/4.yml +1 -1
  237. data/data/problems/40.yml +1 -1
  238. data/data/problems/400.yml +5 -6
  239. data/data/problems/401.yml +2 -2
  240. data/data/problems/402.yml +7 -8
  241. data/data/problems/403.yml +9 -10
  242. data/data/problems/404.yml +5 -6
  243. data/data/problems/405.yml +7 -7
  244. data/data/problems/406.yml +8 -10
  245. data/data/problems/407.yml +9 -9
  246. data/data/problems/410.yml +5 -6
  247. data/data/problems/411.yml +11 -12
  248. data/data/problems/412.yml +9 -9
  249. data/data/problems/414.yml +13 -15
  250. data/data/problems/415.yml +2 -2
  251. data/data/problems/417.yml +4 -5
  252. data/data/problems/418.yml +7 -8
  253. data/data/problems/419.yml +8 -8
  254. data/data/problems/420.yml +5 -5
  255. data/data/problems/421.yml +11 -12
  256. data/data/problems/422.yml +9 -9
  257. data/data/problems/423.yml +5 -7
  258. data/data/problems/424.yml +8 -9
  259. data/data/problems/425.yml +2 -3
  260. data/data/problems/426.yml +3 -3
  261. data/data/problems/427.yml +8 -8
  262. data/data/problems/428.yml +16 -19
  263. data/data/problems/430.yml +4 -5
  264. data/data/problems/44.yml +3 -3
  265. data/data/problems/45.yml +2 -2
  266. data/data/problems/46.yml +8 -8
  267. data/data/problems/47.yml +6 -10
  268. data/data/problems/53.yml +8 -9
  269. data/data/problems/56.yml +1 -1
  270. data/data/problems/57.yml +5 -5
  271. data/data/problems/58.yml +1 -1
  272. data/data/problems/6.yml +1 -1
  273. data/data/problems/61.yml +4 -4
  274. data/data/problems/64.yml +39 -46
  275. data/data/problems/65.yml +13 -14
  276. data/data/problems/66.yml +10 -10
  277. data/data/problems/68.yml +4 -5
  278. data/data/problems/69.yml +2 -2
  279. data/data/problems/70.yml +3 -4
  280. data/data/problems/71.yml +3 -3
  281. data/data/problems/72.yml +3 -3
  282. data/data/problems/73.yml +3 -3
  283. data/data/problems/74.yml +15 -22
  284. data/data/problems/75.yml +1 -1
  285. data/data/problems/8.yml +14 -14
  286. data/data/problems/81.yml +7 -7
  287. data/data/problems/82.yml +4 -4
  288. data/data/problems/83.yml +4 -4
  289. data/data/problems/85.yml +1 -1
  290. data/data/problems/86.yml +8 -8
  291. data/data/problems/88.yml +22 -27
  292. data/data/problems/9.yml +6 -6
  293. data/data/problems/90.yml +13 -13
  294. data/data/problems/91.yml +8 -8
  295. data/data/problems/92.yml +7 -9
  296. data/data/problems/93.yml +9 -10
  297. data/data/problems/95.yml +1 -1
  298. data/data/problems/96.yml +17 -17
  299. data/data/problems/97.yml +2 -2
  300. data/data/problems/99.yml +2 -2
  301. data/lib/euler/problem.rb +6 -1
  302. data/lib/euler/version.rb +1 -1
  303. metadata +2 -2
@@ -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 ![](/home/will/src/euler-manager/config/../data/images/p_405_tile1.png)\n\nThe
9
- following animation demonstrates the tilings <var>T</var>(<var>n</var>) for <var>n</var>
10
- from 0 to 5:\n\n ![](/home/will/src/euler-manager/config/../data/images/p_405_tile2.gif)\n\nLet
11
- <var>f</var>(<var>n</var>) be the number of points where four tiles meet in <var>T</var>(<var>n</var>).
12
- \ \n\rFor example, <var>f</var>(1) = 0, <var>f</var>(4) = 82 and <var>f</var>(10<sup>9</sup>)
13
- mod 17<sup>7</sup> = 126897180.\n\nFind <var>f</var>(10<sup><var>k</var></sup>)
14
- for <var>k</var> = 10<sup>18</sup>, give your answer modulo 17<sup>7</sup>.\n\n"
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"
@@ -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, ![√](/home/will/src/euler-manager/config/../data/images/symbol_radic.gif)2,
29
- ![√](/home/will/src/euler-manager/config/../data/images/symbol_radic.gif)3) = 13.22073197...
30
- \ \n\rC(20000, 5, 7) = 82 \n\rC(2000000, ![√](/home/will/src/euler-manager/config/../data/images/symbol_radic.gif)5,
31
- ![√](/home/will/src/euler-manager/config/../data/images/symbol_radic.gif)7) = 49.63755955...\n\nLet
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 ![∑](/home/will/src/euler-manager/config/../data/images/symbol_sum.gif)<sub>1<img
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;\"><var>k</var><img src=\"%7B%7B%20images_dir%20%7D%7D/symbol_le.gif\"
37
- width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">30</sub> C(10<sup>12</sup>,
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"
@@ -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 ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif)
6
- <var>a</var> ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif)
7
- 5 we get: 0,1,4,3,4,1.\n\nThe largest value of <var>a</var> such that <var>a</var><sup>2</sup>
8
- ![≡](/home/will/src/euler-manager/config/../data/images/symbol_cong.gif) <var>a</var>
9
- mod 6 is 4. \n\rLet's call M(<var>n</var>) the largest value of <var>a</var> ![<](/home/will/src/euler-manager/config/../data/images/symbol_lt.gif)
10
- <var>n</var> such that <var>a</var><sup>2</sup> ![≡](/home/will/src/euler-manager/config/../data/images/symbol_cong.gif)
11
- <var>a</var> (mod <var>n</var>). \n\rSo M(6) = 4.\n\nFind ![∑](/home/will/src/euler-manager/config/../data/images/symbol_sum.gif)M(<var>n</var>)
12
- for 1 ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif) <var>n</var>
13
- ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif) 10<sup>7</sup>.\n\n"
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"
@@ -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 ![<](/home/will/src/euler-manager/config/../data/images/symbol_lt.gif)
12
- <var>r</var> ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif)
13
- <var>R</var> and 0 ![<](/home/will/src/euler-manager/config/../data/images/symbol_lt.gif)
14
- <var>a</var> ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif)
15
- <var>X</var>.\n\nWe can verify that F(1, 5) = 10, F(2, 10) = 52 and F(10, 100) =
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"
@@ -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 ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif)
8
- <var>i</var> ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif)
9
- 2<var>n</var>. We will consider stations with the same coordinates as the same station.\n\nWe
10
- wish to form a path from (0, 0) to (<var>n</var>, <var>n</var>) such that the x
11
- and y coordinates never decrease. \n\rLet S(<var>n</var>) be the maximum number
12
- of stations such a path can pass through.\n\nFor example, if <var>n</var> = 22,
13
- there are 11 distinct stations, and a valid path can pass through at most 5 stations.
14
- Therefore, S(22) = 5.\rThe case is illustrated below, with an example of an optimal
15
- path:\n\n![](/home/will/src/euler-manager/config/../data/images/p411_longpath.png)\n\nIt
16
- can also be verified that S(123) = 14 and S(10000) = 48.\n\nFind ![∑](/home/will/src/euler-manager/config/../data/images/symbol_sum.gif)
17
- S(<var>k</var><sup>5</sup>) for 1 ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif)
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"
@@ -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  ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif) <var>n</var> m),
6
- let L(<var>m</var>, <var>n</var>) be an <var>m</var> ![×](/home/will/src/euler-manager/config/../data/images/symbol_times.gif)<var>m</var>
7
- grid with the top-right <var>n</var> ![×](/home/will/src/euler-manager/config/../data/images/symbol_times.gif)<var>n</var>
8
- grid removed.\n\nFor example, L(5, 3) looks like this:\n\n![](/home/will/src/euler-manager/config/../data/images/p412_table53.png)\n\nWe
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![](/home/will/src/euler-manager/config/../data/images/p412_tablenums.png)\n\nLet
12
- LC(<var>m</var>, <var>n</var>) be the number of valid numberings of L(<var>m</var>,
13
- <var>n</var>). \n\rIt can be verified that LC(3, 0) = 42, LC(5, 3) = 250250, LC(6, 3)
14
- = 406029023400 and LC(105) mod 76543217 = 61251715.\n\nFind LC(100005000) mod
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(53) = 250250, LC(6, 3) = 406029023400 and LC(105) mod 76543217
15
+ = 61251715.\n\nFind LC(10000, 5000) mod 76543217.\n\n"
@@ -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 ![≠](/home/will/src/euler-manager/config/../data/images/symbol_ne.gif)9,
20
- a Kaprekar constant exists. \n\rE.g. base 15: (10,4,14,9,5)<sub>15</sub> \n\rbase
21
- 21: (14,6,20,13,7)<sub>21</sub>\n\nDefine <var>C<sub>b</sub></var> to be the Kaprekar
22
- constant in base <var>b</var> for 5 digits.\rDefine the function <var>sb(i)</var>
23
- to be\n\n- 0 if i = <var>C<sub>b</sub></var> or if <var>i</var> written in base
24
- <var>b</var> consists of 5 identical digits\r\n- the number of iterations it takes
25
- the Kaprekar routine in base <var>b</var> to arrive at <var>C<sub>b</sub></var>,
26
- otherwise\r\n\rNote that we can define <var>sb(i)</var> for all integers <var>i</var>
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 ![<](/home/will/src/euler-manager/config/../data/images/symbol_lt.gif)
31
- <var>i</var> ![<](/home/will/src/euler-manager/config/../data/images/symbol_lt.gif)
32
- <var>b</var><sup>5</sup>. \n\rE.g. S(15) = 5274369 \n \rS(111) = 400668930299\n\nFind
33
- the sum of S(6k+3) for 2 ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif)
34
- k ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif) 300. \n\rGive
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"
@@ -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 ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif)
13
- <var>x</var>, <var>y</var> ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif)
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"
@@ -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 ![∑](/home/will/src/euler-manager/config/../data/images/symbol_sum.gif)L(n)
17
- for 3 ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif) n ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif)
18
- 1 000 000 equals 55535191115.\n\nFind ![∑](/home/will/src/euler-manager/config/../data/images/symbol_sum.gif)L(n)
19
- for 3 ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif) n ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif)
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"
@@ -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 ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif) <var>a</var>
8
- ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif) <var>b</var>
9
- ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif) <var>c</var>\n-
10
- <var>a</var>·<var>b</var>·<var>c</var> = <var>n</var>.\r\n\nDefine <var>f</var>(<var>n</var>)
11
- to be <var>a</var> + <var>b</var> + <var>c</var> for the factorisation triple (<var>a</var>,
12
- <var>b</var>, <var>c</var>) of <var>n</var> which minimises <var>c</var> / <var>a</var>.
13
- One can show that this triple is unique.\n\nFor example, <var>f</var>(165) = 19,
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"
@@ -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' ![→](/home/will/src/euler-manager/config/../data/images/symbol_maps.gif)
9
- 11 \n\r11 is 'two ones' ![→](/home/will/src/euler-manager/config/../data/images/symbol_maps.gif)
10
- 21 \n\r21 is 'one two and one one' ![→](/home/will/src/euler-manager/config/../data/images/symbol_maps.gif)
11
- 1211 \n\r1211 is 'one one, one two and two ones' ![→](/home/will/src/euler-manager/config/../data/images/symbol_maps.gif)
12
- 111221 \n\r111221 is 'three ones, two twos and one one' ![→](/home/will/src/euler-manager/config/../data/images/symbol_maps.gif)
13
- 312211 \n\r...\n\nDefine A(n), B(n) and C(n) as the number of ones, twos and threes
14
- in 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>.
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"
@@ -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 ![](/home/will/src/euler-manager/config/../data/images/p_420_matrix.gif)\n\nWe
8
- define F(<var>N</var>) as the number of the 2x2 positive integer matrices which
9
- have a <dfn title=\"the sum of the elements on the main diagonal\">trace</dfn> less
10
- than <var>N</var> and which can be expressed as a square of a positive integer matrix
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"
@@ -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> ![>](/home/will/src/euler-manager/config/../data/images/symbol_gt.gif)
7
- 1. \n\rFor positive integers <var>n</var> and <var>m</var> let <var>s</var>(<var>n,m</var>)
8
- be defined as the sum of the _distinct_ prime factors of <var>n</var><sup>15</sup>+1
9
- not exceeding <var>m</var>.\n\n\rE.g. 2<sup>15</sup>+1 = 3 ![×](/home/will/src/euler-manager/config/../data/images/symbol_times.gif)3
10
- ![×](/home/will/src/euler-manager/config/../data/images/symbol_times.gif)11 ![×](/home/will/src/euler-manager/config/../data/images/symbol_times.gif)331.
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 ![×](/home/will/src/euler-manager/config/../data/images/symbol_times.gif)11
13
- ![×](/home/will/src/euler-manager/config/../data/images/symbol_times.gif)13 ![×](/home/will/src/euler-manager/config/../data/images/symbol_times.gif)211
14
- ![×](/home/will/src/euler-manager/config/../data/images/symbol_times.gif)241 ![×](/home/will/src/euler-manager/config/../data/images/symbol_times.gif)2161
15
- ![×](/home/will/src/euler-manager/config/../data/images/symbol_times.gif)9091. \n\rSo
16
- <var>s</var>(10,100) = 31 and <var>s</var>(10,1000) = 483. \n\nFind &Sum; <var>s</var>(<var>n</var>,10<sup>8</sup>)
17
- for 1 ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif) <var>n</var>
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 &Sum; <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"
@@ -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> ![≥](/home/will/src/euler-manager/config/../data/images/symbol_ge.gif)
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 ![](/home/will/src/euler-manager/config/../data/images/p422_hyperbola.gif)\n\nYou
14
- are given that P<sub>3</sub> = (-19/2, -229/24), P<sub>4</sub> = (1267/144, -37/12)
15
- and P<sub>7</sub> = (17194218091/143327232, 274748766781/1719926784).\n\nFind P<sub><var>n</var></sub>
16
- for <var>n</var> = 11<sup>14</sup> in the following format: \nIf P<sub><var>n</var></sub>
17
- = (<var>a</var>/<var>b</var>, <var>c</var>/<var>d</var>) where the fractions are
18
- in lowest terms and the denominators are positive, then the answer is (<var>a</var>
19
- + <var>b</var> + <var>c</var> + <var>d</var>) mod 1 000 000 007.\n\nFor <var>n</var>
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"
@@ -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 ![∑](/home/will/src/euler-manager/config/../data/images/symbol_sum.gif)
15
- C(<var>n</var>) for 1 ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif)
16
- <var>n</var> ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif)
17
- <var>L</var>. \n\rFor example, S(50) mod 1 000 000 007 = 832833871.\n\nFind S(50 000 000)
18
- mod 1 000 000 007.\n\n<sup>1</sup> π denotes the **prime-counting function** , i.e.
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"
@@ -2,15 +2,14 @@
2
2
  :id: 424
3
3
  :name: Kakuro
4
4
  :url: http://projecteuler.net/problem=424
5
- :content: "![](/home/will/src/euler-manager/config/../data/images/p_424_kakuro1.gif)\n\nThe
6
- above is an example of a cryptic kakuro (also known as cross sums, or even sums
7
- cross) puzzle, with its final solution on the right. (The common rules of kakuro
8
- puzzles can be found easily on numerous internet sites. Other related information
9
- can also be currently found at [krazydad.com](http://krazydad.com/) whose author
10
- has provided the puzzle data for this challenge.)\n\nThe downloadable text file
11
- ( [kakuro200.txt](project/kakuro200.txt)) contains the description of 200 such puzzles,
12
- a mix of 5x5 and 6x6 types. The first puzzle in the file is the above example which
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
@@ -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
- ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif) N which are
14
- not 2's relatives. \n\rWe can verify that F(10<sup>3</sup>) = 431 and F(10<sup>4</sup>)
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"
@@ -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 ![](/home/will/src/euler-manager/config/../data/images/p_426_baxball1.gif)\n\nA
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 ![](/home/will/src/euler-manager/config/../data/images/p_426_baxball2.gif)\n\nWe
19
- define the sequence {<var>t</var><sub><var>i</var></sub>}:\n\n- <var>s</var><sub>0</sub>
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>,
@@ -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 ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif) s<sub><var>i</var></sub>
8
- ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif) <var>n</var>.
9
- Thus there are <var>n</var><sup><var>n</var></sup> distinct <var>n</var>-sequences
10
- in total.\rFor example, the sequence S = {1, 5, 5, 10, 7, 7, 7, 2, 3, 7} is a 10-sequence.\n\nFor
11
- any sequence S, let L(S) be the length of the longest contiguous subsequence of
12
- S with the same value.\rFor example, for the given sequence S above, L(S) = 3, because
13
- of the three consecutive 7's.\n\nLet <var>f</var>(<var>n</var>) = ![∑](/home/will/src/euler-manager/config/../data/images/symbol_sum.gif)
14
- L(S) for all <var>n</var>-sequences S.\n\nFor example, <var>f</var>(3) = 45, <var>f</var>(7)
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"
@@ -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> ![≥](/home/will/src/euler-manager/config/../data/images/symbol_ge.gif)
11
- 3 distinct circles C<sub>1</sub>, C<sub>2</sub>, ..., C<sub><var>k</var></sub> such
12
- that:\n\n- C<sub><var>i</var></sub> has no common interior points with any C<sub><var>j</var></sub>
13
- for 1 ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif) <var>i</var>,
14
- <var>j</var> ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif)
15
- <var>k</var> and <var>i</var> ![≠](/home/will/src/euler-manager/config/../data/images/symbol_ne.gif)
16
- <var>j</var>,\r\n- C<sub><var>i</var></sub> is tangent to both C<sub>in</sub> and
17
- C<sub>out</sub> for 1 ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif)
18
- <var>i</var> ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif)
19
- <var>k</var>,\r\n- C<sub><var>i</var></sub> is tangent to C<sub><var>i</var>+1</sub>
20
- for 1 ![≤](/home/will/src/euler-manager/config/../data/images/symbol_le.gif) <var>i</var>
21
- k, and\r\n- C<sub><var>k</var></sub> is tangent to C<sub>1</sub>.\r\n\nFor example,
22
- (5, 5, 5) and (4, 3, 21) are necklace triplets, while it can be shown that (2, 2,
23
- 5) is not.\n\n![](/home/will/src/euler-manager/config/../data/images/p428_necklace.png)\n\nLet
24
- T(<var>n</var>) be the number of necklace triplets (<var>a</var>, <var>b</var>,
25
- <var>c</var>) such that <var>a</var>, <var>b</var> and <var>c</var> are positive
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"
@@ -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![](/home/will/src/euler-manager/config/../data/images/p_430_flips.gif)\n\nLet
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) ![≈](/home/will/src/euler-manager/config/../data/images/symbol_asymp.gif)
16
- 5.157 and E(100, 10) ![≈](/home/will/src/euler-manager/config/../data/images/symbol_asymp.gif)
17
- 51.893.\n\nFind E(10<sup>10</sup>, 4000). \n\rGive your answer rounded to 2 decimal
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> ![−](/home/will/src/euler-manager/config/../data/images/symbol_minus.gif)1)/2. The first ten pentagonal numbers are:
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 ![−](/home/will/src/euler-manager/config/../data/images/symbol_minus.gif) 22 = 48, is not pentagonal.
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> ![−](/home/will/src/euler-manager/config/../data/images/symbol_minus.gif) P<sub><var>j</var></sub>| is minimised; what is the value of D?
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_ ![−](/home/will/src/euler-manager/config/../data/images/symbol_minus.gif)1)/2 |   | 1, 5, 12, 22, 35, ... |
10
- | Hexagonal |   | H<sub><i>n</i></sub>=_n_(2_n_ ![−](/home/will/src/euler-manager/config/../data/images/symbol_minus.gif)1) |   | 1, 6, 15, 28, 45, ... |
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 ![×](/home/will/src/euler-manager/config/../data/images/symbol_times.gif)1<sup>2</sup>
7
- \ \n\r15 = 7 + 2 ![×](/home/will/src/euler-manager/config/../data/images/symbol_times.gif)2<sup>2</sup>
8
- \ \n\r21 = 3 + 2 ![×](/home/will/src/euler-manager/config/../data/images/symbol_times.gif)3<sup>2</sup>
9
- \ \n\r25 = 7 + 2 ![×](/home/will/src/euler-manager/config/../data/images/symbol_times.gif)3<sup>2</sup>
10
- \ \n\r27 = 19 + 2 ![×](/home/will/src/euler-manager/config/../data/images/symbol_times.gif)2<sup>2</sup>
11
- \ \n\r33 = 31 + 2 ![×](/home/will/src/euler-manager/config/../data/images/symbol_times.gif)1<sup>2</sup>\n\nIt
12
- turns out that the conjecture was false.\n\nWhat is the smallest odd composite that
13
- cannot be written as the sum of a prime and twice a square?\n\n"
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"