euler-manager 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +21 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +37 -0
- data/Rakefile +1 -0
- data/bin/euler +145 -0
- data/data/answers.yml +456 -0
- data/data/problems/1.yml +7 -0
- data/data/problems/10.yml +8 -0
- data/data/problems/100.yml +13 -0
- data/data/problems/101.yml +49 -0
- data/data/problems/102.yml +16 -0
- data/data/problems/103.yml +26 -0
- data/data/problems/104.yml +15 -0
- data/data/problems/105.yml +21 -0
- data/data/problems/106.yml +19 -0
- data/data/problems/107.yml +20 -0
- data/data/problems/108.yml +32 -0
- data/data/problems/109.yml +33 -0
- data/data/problems/11.yml +33 -0
- data/data/problems/110.yml +19 -0
- data/data/problems/111.yml +21 -0
- data/data/problems/112.yml +15 -0
- data/data/problems/113.yml +13 -0
- data/data/problems/114.yml +106 -0
- data/data/problems/115.yml +17 -0
- data/data/problems/116.yml +76 -0
- data/data/problems/117.yml +82 -0
- data/data/problems/118.yml +9 -0
- data/data/problems/119.yml +11 -0
- data/data/problems/12.yml +13 -0
- data/data/problems/120.yml +17 -0
- data/data/problems/121.yml +15 -0
- data/data/problems/122.yml +42 -0
- data/data/problems/123.yml +13 -0
- data/data/problems/124.yml +58 -0
- data/data/problems/125.yml +12 -0
- data/data/problems/126.yml +17 -0
- data/data/problems/127.yml +31 -0
- data/data/problems/128.yml +18 -0
- data/data/problems/129.yml +12 -0
- data/data/problems/13.yml +6 -0
- data/data/problems/130.yml +19 -0
- data/data/problems/131.yml +12 -0
- data/data/problems/132.yml +12 -0
- data/data/problems/133.yml +13 -0
- data/data/problems/134.yml +19 -0
- data/data/problems/135.yml +20 -0
- data/data/problems/136.yml +17 -0
- data/data/problems/137.yml +36 -0
- data/data/problems/138.yml +20 -0
- data/data/problems/139.yml +15 -0
- data/data/problems/14.yml +28 -0
- data/data/problems/140.yml +29 -0
- data/data/problems/141.yml +14 -0
- data/data/problems/142.yml +14 -0
- data/data/problems/143.yml +20 -0
- data/data/problems/144.yml +30 -0
- data/data/problems/145.yml +11 -0
- data/data/problems/146.yml +9 -0
- data/data/problems/147.yml +14 -0
- data/data/problems/148.yml +11 -0
- data/data/problems/149.yml +41 -0
- data/data/problems/15.yml +11 -0
- data/data/problems/150.yml +34 -0
- data/data/problems/151.yml +19 -0
- data/data/problems/152.yml +12 -0
- data/data/problems/153.yml +57 -0
- data/data/problems/154.yml +16 -0
- data/data/problems/155.yml +22 -0
- data/data/problems/156.yml +27 -0
- data/data/problems/157.yml +34 -0
- data/data/problems/158.yml +19 -0
- data/data/problems/159.yml +29 -0
- data/data/problems/16.yml +6 -0
- data/data/problems/160.yml +8 -0
- data/data/problems/161.yml +15 -0
- data/data/problems/162.yml +15 -0
- data/data/problems/163.yml +19 -0
- data/data/problems/164.yml +8 -0
- data/data/problems/165.yml +32 -0
- data/data/problems/166.yml +15 -0
- data/data/problems/167.yml +17 -0
- data/data/problems/168.yml +13 -0
- data/data/problems/169.yml +10 -0
- data/data/problems/17.yml +11 -0
- data/data/problems/170.yml +16 -0
- data/data/problems/171.yml +13 -0
- data/data/problems/172.yml +6 -0
- data/data/problems/173.yml +12 -0
- data/data/problems/174.yml +20 -0
- data/data/problems/175.yml +21 -0
- data/data/problems/176.yml +9 -0
- data/data/problems/177.yml +16 -0
- data/data/problems/178.yml +9 -0
- data/data/problems/179.yml +10 -0
- data/data/problems/18.yml +21 -0
- data/data/problems/180.yml +34 -0
- data/data/problems/181.yml +7 -0
- data/data/problems/182.yml +35 -0
- data/data/problems/183.yml +27 -0
- data/data/problems/184.yml +18 -0
- data/data/problems/185.yml +22 -0
- data/data/problems/186.yml +28 -0
- data/data/problems/187.yml +16 -0
- data/data/problems/188.yml +10 -0
- data/data/problems/189.yml +15 -0
- data/data/problems/19.yml +12 -0
- data/data/problems/190.yml +13 -0
- data/data/problems/191.yml +15 -0
- data/data/problems/192.yml +27 -0
- data/data/problems/193.yml +7 -0
- data/data/problems/194.yml +18 -0
- data/data/problems/195.yml +13 -0
- data/data/problems/196.yml +25 -0
- data/data/problems/197.yml +16 -0
- data/data/problems/198.yml +21 -0
- data/data/problems/199.yml +14 -0
- data/data/problems/2.yml +10 -0
- data/data/problems/20.yml +22 -0
- data/data/problems/200.yml +12 -0
- data/data/problems/201.yml +20 -0
- data/data/problems/202.yml +14 -0
- data/data/problems/203.yml +21 -0
- data/data/problems/204.yml +11 -0
- data/data/problems/205.yml +10 -0
- data/data/problems/206.yml +6 -0
- data/data/problems/207.yml +20 -0
- data/data/problems/208.yml +12 -0
- data/data/problems/209.yml +27 -0
- data/data/problems/21.yml +13 -0
- data/data/problems/210.yml +10 -0
- data/data/problems/211.yml +11 -0
- data/data/problems/212.yml +41 -0
- data/data/problems/213.yml +11 -0
- data/data/problems/214.yml +15 -0
- data/data/problems/215.yml +18 -0
- data/data/problems/216.yml +14 -0
- data/data/problems/217.yml +27 -0
- data/data/problems/218.yml +14 -0
- data/data/problems/219.yml +19 -0
- data/data/problems/22.yml +13 -0
- data/data/problems/220.yml +24 -0
- data/data/problems/221.yml +20 -0
- data/data/problems/222.yml +7 -0
- data/data/problems/223.yml +12 -0
- data/data/problems/224.yml +12 -0
- data/data/problems/225.yml +11 -0
- data/data/problems/226.yml +16 -0
- data/data/problems/227.yml +13 -0
- data/data/problems/228.yml +23 -0
- data/data/problems/229.yml +30 -0
- data/data/problems/23.yml +19 -0
- data/data/problems/230.yml +23 -0
- data/data/problems/231.yml +16 -0
- data/data/problems/232.yml +14 -0
- data/data/problems/233.yml +10 -0
- data/data/problems/234.yml +23 -0
- data/data/problems/235.yml +9 -0
- data/data/problems/236.yml +32 -0
- data/data/problems/237.yml +13 -0
- data/data/problems/238.yml +42 -0
- data/data/problems/239.yml +9 -0
- data/data/problems/24.yml +10 -0
- data/data/problems/240.yml +11 -0
- data/data/problems/241.yml +17 -0
- data/data/problems/242.yml +16 -0
- data/data/problems/243.yml +19 -0
- data/data/problems/244.yml +32 -0
- data/data/problems/245.yml +36 -0
- data/data/problems/246.yml +17 -0
- data/data/problems/247.yml +21 -0
- data/data/problems/248.yml +6 -0
- data/data/problems/249.yml +7 -0
- data/data/problems/25.yml +15 -0
- data/data/problems/250.yml +7 -0
- data/data/problems/251.yml +13 -0
- data/data/problems/252.yml +31 -0
- data/data/problems/253.yml +36 -0
- data/data/problems/254.yml +21 -0
- data/data/problems/255.yml +59 -0
- data/data/problems/256.yml +43 -0
- data/data/problems/257.yml +18 -0
- data/data/problems/258.yml +13 -0
- data/data/problems/259.yml +16 -0
- data/data/problems/26.yml +11 -0
- data/data/problems/260.yml +30 -0
- data/data/problems/261.yml +19 -0
- data/data/problems/262.yml +20 -0
- data/data/problems/263.yml +19 -0
- data/data/problems/264.yml +20 -0
- data/data/problems/265.yml +16 -0
- data/data/problems/266.yml +10 -0
- data/data/problems/267.yml +14 -0
- data/data/problems/268.yml +8 -0
- data/data/problems/269.yml +15 -0
- data/data/problems/27.yml +25 -0
- data/data/problems/270.yml +17 -0
- data/data/problems/271.yml +13 -0
- data/data/problems/272.yml +15 -0
- data/data/problems/273.yml +21 -0
- data/data/problems/274.yml +23 -0
- data/data/problems/275.yml +19 -0
- data/data/problems/276.yml +11 -0
- data/data/problems/277.yml +24 -0
- data/data/problems/278.yml +32 -0
- data/data/problems/279.yml +6 -0
- data/data/problems/28.yml +17 -0
- data/data/problems/280.yml +13 -0
- data/data/problems/281.yml +17 -0
- data/data/problems/282.yml +10 -0
- data/data/problems/283.yml +11 -0
- data/data/problems/284.yml +22 -0
- data/data/problems/285.yml +17 -0
- data/data/problems/286.yml +12 -0
- data/data/problems/287.yml +36 -0
- data/data/problems/288.yml +15 -0
- data/data/problems/289.yml +19 -0
- data/data/problems/29.yml +24 -0
- data/data/problems/290.yml +8 -0
- data/data/problems/291.yml +10 -0
- data/data/problems/292.yml +13 -0
- data/data/problems/293.yml +15 -0
- data/data/problems/294.yml +10 -0
- data/data/problems/295.yml +26 -0
- data/data/problems/296.yml +15 -0
- data/data/problems/297.yml +19 -0
- data/data/problems/298.yml +46 -0
- data/data/problems/299.yml +31 -0
- data/data/problems/3.yml +7 -0
- data/data/problems/30.yml +12 -0
- data/data/problems/300.yml +24 -0
- data/data/problems/301.yml +25 -0
- data/data/problems/302.yml +18 -0
- data/data/problems/303.yml +11 -0
- data/data/problems/304.yml +19 -0
- data/data/problems/305.yml +14 -0
- data/data/problems/306.yml +29 -0
- data/data/problems/307.yml +12 -0
- data/data/problems/308.yml +34 -0
- data/data/problems/309.yml +17 -0
- data/data/problems/31.yml +18 -0
- data/data/problems/310.yml +19 -0
- data/data/problems/311.yml +21 -0
- data/data/problems/312.yml +15 -0
- data/data/problems/313.yml +17 -0
- data/data/problems/314.yml +29 -0
- data/data/problems/315.yml +49 -0
- data/data/problems/316.yml +25 -0
- data/data/problems/317.yml +11 -0
- data/data/problems/318.yml +61 -0
- data/data/problems/319.yml +23 -0
- data/data/problems/32.yml +14 -0
- data/data/problems/320.yml +12 -0
- data/data/problems/321.yml +18 -0
- data/data/problems/322.yml +12 -0
- data/data/problems/323.yml +19 -0
- data/data/problems/324.yml +17 -0
- data/data/problems/325.yml +25 -0
- data/data/problems/326.yml +12 -0
- data/data/problems/327.yml +39 -0
- data/data/problems/328.yml +36 -0
- data/data/problems/329.yml +17 -0
- data/data/problems/33.yml +13 -0
- data/data/problems/330.yml +40 -0
- data/data/problems/331.yml +28 -0
- data/data/problems/332.yml +16 -0
- data/data/problems/333.yml +25 -0
- data/data/problems/334.yml +39 -0
- data/data/problems/335.yml +16 -0
- data/data/problems/336.yml +24 -0
- data/data/problems/337.yml +15 -0
- data/data/problems/338.yml +41 -0
- data/data/problems/339.yml +17 -0
- data/data/problems/34.yml +7 -0
- data/data/problems/340.yml +14 -0
- data/data/problems/341.yml +18 -0
- data/data/problems/342.yml +17 -0
- data/data/problems/343.yml +29 -0
- data/data/problems/344.yml +21 -0
- data/data/problems/345.yml +26 -0
- data/data/problems/346.yml +11 -0
- data/data/problems/347.yml +16 -0
- data/data/problems/348.yml +12 -0
- data/data/problems/349.yml +13 -0
- data/data/problems/35.yml +8 -0
- data/data/problems/350.yml +18 -0
- data/data/problems/351.yml +13 -0
- data/data/problems/352.yml +49 -0
- data/data/problems/353.yml +25 -0
- data/data/problems/354.yml +16 -0
- data/data/problems/355.yml +8 -0
- data/data/problems/356.yml +10 -0
- data/data/problems/357.yml +9 -0
- data/data/problems/358.yml +31 -0
- data/data/problems/359.yml +26 -0
- data/data/problems/36.yml +8 -0
- data/data/problems/360.yml +12 -0
- data/data/problems/361.yml +20 -0
- data/data/problems/362.yml +32 -0
- data/data/problems/363.yml +33 -0
- data/data/problems/364.yml +15 -0
- data/data/problems/365.yml +17 -0
- data/data/problems/366.yml +26 -0
- data/data/problems/367.yml +20 -0
- data/data/problems/368.yml +39 -0
- data/data/problems/369.yml +15 -0
- data/data/problems/37.yml +10 -0
- data/data/problems/370.yml +16 -0
- data/data/problems/371.yml +13 -0
- data/data/problems/372.yml +16 -0
- data/data/problems/373.yml +10 -0
- data/data/problems/374.yml +25 -0
- data/data/problems/375.yml +23 -0
- data/data/problems/376.yml +25 -0
- data/data/problems/377.yml +11 -0
- data/data/problems/378.yml +15 -0
- data/data/problems/379.yml +15 -0
- data/data/problems/38.yml +18 -0
- data/data/problems/380.yml +22 -0
- data/data/problems/381.yml +21 -0
- data/data/problems/382.yml +23 -0
- data/data/problems/383.yml +13 -0
- data/data/problems/384.yml +28 -0
- data/data/problems/385.yml +22 -0
- data/data/problems/386.yml +16 -0
- data/data/problems/387.yml +19 -0
- data/data/problems/388.yml +12 -0
- data/data/problems/389.yml +12 -0
- data/data/problems/39.yml +10 -0
- data/data/problems/390.yml +18 -0
- data/data/problems/391.yml +29 -0
- data/data/problems/392.yml +22 -0
- data/data/problems/393.yml +12 -0
- data/data/problems/394.yml +22 -0
- data/data/problems/395.yml +19 -0
- data/data/problems/396.yml +28 -0
- data/data/problems/397.yml +20 -0
- data/data/problems/398.yml +13 -0
- data/data/problems/399.yml +22 -0
- data/data/problems/4.yml +8 -0
- data/data/problems/40.yml +18 -0
- data/data/problems/400.yml +18 -0
- data/data/problems/401.yml +11 -0
- data/data/problems/402.yml +25 -0
- data/data/problems/403.yml +19 -0
- data/data/problems/404.yml +21 -0
- data/data/problems/405.yml +15 -0
- data/data/problems/406.yml +46 -0
- data/data/problems/407.yml +20 -0
- data/data/problems/408.yml +14 -0
- data/data/problems/409.yml +12 -0
- data/data/problems/41.yml +8 -0
- data/data/problems/410.yml +19 -0
- data/data/problems/411.yml +23 -0
- data/data/problems/412.yml +19 -0
- data/data/problems/413.yml +13 -0
- data/data/problems/414.yml +40 -0
- data/data/problems/415.yml +19 -0
- data/data/problems/416.yml +13 -0
- data/data/problems/417.yml +21 -0
- data/data/problems/418.yml +17 -0
- data/data/problems/419.yml +22 -0
- data/data/problems/42.yml +14 -0
- data/data/problems/420.yml +13 -0
- data/data/problems/421.yml +29 -0
- data/data/problems/422.yml +22 -0
- data/data/problems/423.yml +22 -0
- data/data/problems/424.yml +37 -0
- data/data/problems/425.yml +16 -0
- data/data/problems/426.yml +29 -0
- data/data/problems/427.yml +18 -0
- data/data/problems/428.yml +32 -0
- data/data/problems/429.yml +10 -0
- data/data/problems/43.yml +17 -0
- data/data/problems/430.yml +20 -0
- data/data/problems/431.yml +33 -0
- data/data/problems/432.yml +13 -0
- data/data/problems/433.yml +18 -0
- data/data/problems/434.yml +32 -0
- data/data/problems/435.yml +21 -0
- data/data/problems/436.yml +21 -0
- data/data/problems/437.yml +22 -0
- data/data/problems/438.yml +29 -0
- data/data/problems/439.yml +17 -0
- data/data/problems/44.yml +16 -0
- data/data/problems/440.yml +21 -0
- data/data/problems/441.yml +23 -0
- data/data/problems/442.yml +9 -0
- data/data/problems/443.yml +13 -0
- data/data/problems/444.yml +28 -0
- data/data/problems/445.yml +37 -0
- data/data/problems/446.yml +29 -0
- data/data/problems/447.yml +31 -0
- data/data/problems/448.yml +14 -0
- data/data/problems/449.yml +17 -0
- data/data/problems/45.yml +15 -0
- data/data/problems/450.yml +26 -0
- data/data/problems/451.yml +15 -0
- data/data/problems/452.yml +8 -0
- data/data/problems/453.yml +16 -0
- data/data/problems/454.yml +17 -0
- data/data/problems/455.yml +16 -0
- data/data/problems/456.yml +15 -0
- data/data/problems/46.yml +18 -0
- data/data/problems/47.yml +21 -0
- data/data/problems/48.yml +7 -0
- data/data/problems/49.yml +10 -0
- data/data/problems/5.yml +8 -0
- data/data/problems/50.yml +10 -0
- data/data/problems/51.yml +15 -0
- data/data/problems/52.yml +8 -0
- data/data/problems/53.yml +28 -0
- data/data/problems/54.yml +43 -0
- data/data/problems/55.yml +21 -0
- data/data/problems/56.yml +11 -0
- data/data/problems/57.yml +15 -0
- data/data/problems/58.yml +22 -0
- data/data/problems/59.yml +23 -0
- data/data/problems/6.yml +13 -0
- data/data/problems/60.yml +10 -0
- data/data/problems/61.yml +30 -0
- data/data/problems/62.yml +9 -0
- data/data/problems/63.yml +7 -0
- data/data/problems/64.yml +130 -0
- data/data/problems/65.yml +62 -0
- data/data/problems/66.yml +27 -0
- data/data/problems/67.yml +17 -0
- data/data/problems/68.yml +23 -0
- data/data/problems/69.yml +14 -0
- data/data/problems/7.yml +6 -0
- data/data/problems/70.yml +16 -0
- data/data/problems/71.yml +17 -0
- data/data/problems/72.yml +16 -0
- data/data/problems/73.yml +16 -0
- data/data/problems/74.yml +41 -0
- data/data/problems/75.yml +16 -0
- data/data/problems/76.yml +8 -0
- data/data/problems/77.yml +8 -0
- data/data/problems/78.yml +12 -0
- data/data/problems/79.yml +11 -0
- data/data/problems/8.yml +6 -0
- data/data/problems/80.yml +11 -0
- data/data/problems/81.yml +19 -0
- data/data/problems/82.yml +19 -0
- data/data/problems/83.yml +23 -0
- data/data/problems/84.yml +63 -0
- data/data/problems/85.yml +9 -0
- data/data/problems/86.yml +15 -0
- data/data/problems/87.yml +12 -0
- data/data/problems/88.yml +53 -0
- data/data/problems/89.yml +18 -0
- data/data/problems/9.yml +13 -0
- data/data/problems/90.yml +23 -0
- data/data/problems/91.yml +19 -0
- data/data/problems/92.yml +29 -0
- data/data/problems/93.yml +21 -0
- data/data/problems/94.yml +11 -0
- data/data/problems/95.yml +23 -0
- data/data/problems/96.yml +46 -0
- data/data/problems/97.yml +14 -0
- data/data/problems/98.yml +16 -0
- data/data/problems/99.yml +16 -0
- data/euler-manager.gemspec +31 -0
- data/euler-manager.sublime-project +12 -0
- data/example/1/README.md +6 -0
- data/example/1/ruby/1.rb +5 -0
- data/example/1/scala/1.scala +9 -0
- data/example/2/README.md +9 -0
- data/example/2/python/2.py +5 -0
- data/example/2/python/euler.py +0 -0
- data/example/Eulerfile.rb +87 -0
- data/example/README.md +26 -0
- data/example/lib/euler.py +0 -0
- data/example/lib/euler.rb +0 -0
- data/example/lib/euler.scala +5 -0
- data/lib/euler.rb +190 -0
- data/lib/euler/errors.rb +7 -0
- data/lib/euler/languages.rb +12 -0
- data/lib/euler/languages/coffeescript.rb +25 -0
- data/lib/euler/languages/javascript.rb +25 -0
- data/lib/euler/languages/python.rb +27 -0
- data/lib/euler/languages/ruby.rb +25 -0
- data/lib/euler/languages/scala.rb +27 -0
- data/lib/euler/languages/templates/coffeescript.coffee +5 -0
- data/lib/euler/languages/templates/javascript.js +5 -0
- data/lib/euler/languages/templates/python.py +5 -0
- data/lib/euler/languages/templates/ruby.rb +5 -0
- data/lib/euler/languages/templates/scala.scala +9 -0
- data/lib/euler/problem.rb +60 -0
- data/lib/euler/solution.rb +98 -0
- data/lib/euler/version.rb +3 -0
- data/scripts/update_problems +68 -0
- data/spec/euler/problem_spec.rb +5 -0
- data/spec/euler/solution_spec.rb +69 -0
- data/spec/euler_spec.rb +27 -0
- data/spec/spec_helper.rb +3 -0
- metadata +644 -0
@@ -0,0 +1,10 @@
|
|
1
|
+
---
|
2
|
+
:id: 294
|
3
|
+
:name: 'Sum of digits - experience #23'
|
4
|
+
:url: http://projecteuler.net/problem=294
|
5
|
+
:content: "\r\n<p>\r\nFor a positive integer k, define d(k) as the sum of the digits
|
6
|
+
of k in its usual decimal representation.\r\nThus d(42) = 4+2 = 6.\r\n</p>\r\n<p>\r\nFor
|
7
|
+
a positive integer n, define S(n) as the number of positive integers k n with the
|
8
|
+
following properties :\r\n</p>\n<ul>\n<li>k is divisible by 23 and\r\n</li>\n<li>d(k)
|
9
|
+
= 23.\r\n</li>\n</ul>\r\nYou are given that S(9) = 263626 and S(42) = 6377168878570056.\r\n\r\n<p>\r\nFind
|
10
|
+
S(11<sup>12</sup>) and give your answer mod 10<sup>9</sup>.\r\n</p>\r\n\r\n"
|
@@ -0,0 +1,26 @@
|
|
1
|
+
---
|
2
|
+
:id: 295
|
3
|
+
:name: Lenticular holes
|
4
|
+
:url: http://projecteuler.net/problem=295
|
5
|
+
:content: "\r\n<p>We call the convex area enclosed by two circles a <i>lenticular
|
6
|
+
hole</i> if:\r\n</p>\n<ul>\n<li>The centres of both circles are on lattice points.</li>\r\n<li>The
|
7
|
+
two circles intersect at two distinct lattice points.</li>\r\n<li>The interior of
|
8
|
+
the convex area enclosed by both circles does not contain any lattice points.\r\n</li>\r\n</ul>\n<p>Consider
|
9
|
+
the circles:<br>\r\nC<sub>0</sub>: <var>x</var><sup>2</sup>+<var>y</var><sup>2</sup>=25<br>\r\nC<sub>1</sub>:
|
10
|
+
(<var>x</var>+4)<sup>2</sup>+(<var>y</var>-4)<sup>2</sup>=1<br>\r\nC<sub>2</sub>:
|
11
|
+
(<var>x</var>-12)<sup>2</sup>+(<var>y</var>-4)<sup>2</sup>=65\r\n</p>\r\n<p>\r\nThe
|
12
|
+
circles C<sub>0</sub>, C<sub>1</sub> and C<sub>2</sub> are drawn in the picture
|
13
|
+
below.</p>\r\n<div align=\"center\"><img src=\"project/images/p295_lenticular.gif\"></div>\r\n<p>\r\nC<sub>0</sub>
|
14
|
+
and C<sub>1</sub> form a lenticular hole, as well as C<sub>0</sub> and C<sub>2</sub>.</p>\r\n<p>\r\nWe
|
15
|
+
call an ordered pair of positive real numbers (r<sub>1</sub>, r<sub>2</sub>) a <i>lenticular
|
16
|
+
pair</i> if there exist two circles with radii r<sub>1</sub> and r<sub>2</sub> that
|
17
|
+
form a lenticular hole.\r\nWe can verify that (1, 5) and (5, <img src=\"images/symbol_radic.gif\"
|
18
|
+
width=\"14\" height=\"16\" alt=\"√\" border=\"0\" style=\"vertical-align:middle;\">65)
|
19
|
+
are the lenticular pairs of the example above.</p>\r\n<p>\r\nLet L(N) be the number
|
20
|
+
of <b>distinct</b> lenticular pairs (r<sub>1</sub>, r<sub>2</sub>) for which 0 <img
|
21
|
+
src=\"images/symbol_lt.gif\" width=\"10\" height=\"10\" alt=\"<\" border=\"0\"
|
22
|
+
style=\"vertical-align:middle;\"> r<sub>1</sub><img src=\"images/symbol_le.gif\"
|
23
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">
|
24
|
+
r<sub>2</sub><img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\"
|
25
|
+
border=\"0\" style=\"vertical-align:middle;\"> N.<br>\r\nWe can verify that L(10)
|
26
|
+
= 30 and L(100) = 3442.</p>\r\n<p>\r\nFind L(100 000).\r\n</p>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
|
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
:id: 296
|
3
|
+
:name: Angular Bisector and Tangent
|
4
|
+
:url: http://projecteuler.net/problem=296
|
5
|
+
:content: "\r\n<p>\r\nGiven is an integer sided triangle <var>ABC</var> with <var>BC</var>
|
6
|
+
<img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
7
|
+
style=\"vertical-align:middle;\"><var>AC</var> <img src=\"images/symbol_le.gif\"
|
8
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>AB</var>.<br><var>k</var>
|
9
|
+
is the angular bisector of angle <var>ACB</var>.<br><var>m</var> is the tangent
|
10
|
+
at <var>C</var> to the circumscribed circle of <var>ABC</var>.<br><var>n</var> is
|
11
|
+
a line parallel to <var>m</var> through <var>B</var>.<br>\r\nThe intersection of
|
12
|
+
<var>n</var> and <var>k</var> is called <var>E</var>.\r\n</p>\r\n<div align=\"center\"><img
|
13
|
+
src=\"project/images/p296_bisector.gif\"></div>\r\n<p>\r\nHow many triangles <var>ABC</var>
|
14
|
+
with a perimeter not exceeding 100 000 exist such that <var>BE</var> has integral
|
15
|
+
length?\r\n</p>\r\n\r\n\r\n"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
---
|
2
|
+
:id: 297
|
3
|
+
:name: Zeckendorf Representation
|
4
|
+
:url: http://projecteuler.net/problem=297
|
5
|
+
:content: "\r\n<p>Each new term in the Fibonacci sequence is generated by adding the
|
6
|
+
previous two terms.<br>\r\nStarting with 1 and 2, the first 10 terms will be: 1,
|
7
|
+
2, 3, 5, 8, 13, 21, 34, 55, 89.</p>\r\n\r\n<p>Every positive integer can be uniquely
|
8
|
+
written as a sum of nonconsecutive terms of the Fibonacci sequence. For example,
|
9
|
+
100 = 3 + 8 + 89.<br>\r\nSuch a sum is called the <b>Zeckendorf representation</b>
|
10
|
+
of the number.</p>\r\n\r\n<p>For any integer <var>n</var>>0, let <var>z</var>(<var>n</var>)
|
11
|
+
be the number of terms in the Zeckendorf representation of <var>n</var>.<br>\r\nThus,
|
12
|
+
<var>z</var>(5) = 1, <var>z</var>(14) = 2, <var>z</var>(100) = 3 etc.<br>\r\nAlso,
|
13
|
+
for 0<img src=\"images/symbol_lt.gif\" width=\"10\" height=\"10\" alt=\"<\" border=\"0\"
|
14
|
+
style=\"vertical-align:middle;\"><var>n</var><img src=\"images/symbol_lt.gif\" width=\"10\"
|
15
|
+
height=\"10\" alt=\"<\" border=\"0\" style=\"vertical-align:middle;\">10<sup>6</sup>,
|
16
|
+
∑ <var>z</var>(<var>n</var>) = 7894453.</p>\r\n\r\n<p>Find ∑ <var>z</var>(<var>n</var>)
|
17
|
+
for 0<img src=\"images/symbol_lt.gif\" width=\"10\" height=\"10\" alt=\"<\" border=\"0\"
|
18
|
+
style=\"vertical-align:middle;\"><var>n</var><img src=\"images/symbol_lt.gif\" width=\"10\"
|
19
|
+
height=\"10\" alt=\"<\" border=\"0\" style=\"vertical-align:middle;\">10<sup>17</sup>.</p>\r\n"
|
@@ -0,0 +1,46 @@
|
|
1
|
+
---
|
2
|
+
:id: 298
|
3
|
+
:name: Selective Amnesia
|
4
|
+
:url: http://projecteuler.net/problem=298
|
5
|
+
:content: "\r\n<style type=\"text/css\">\r\ntable.p298, table.p298 th, table.p298
|
6
|
+
td {\r\n border-width: 1px 1px 1px 1px;\r\n border-style: solid solid solid solid;\r\n
|
7
|
+
\ border-color: black black black black;\r\n text-align:center;\r\n -moz-border-radius:
|
8
|
+
0px 0px 0px 0px;\r\n}\r\ntable.p298 {\r\n border-spacing: 1px;\r\n border-collapse:
|
9
|
+
separate;\r\n background-color: rgb(255,255,255);\r\n}\r\ntable.p298 th, table.p298
|
10
|
+
td {\r\n padding: 1px 6px 1px 6px;\r\n}\r\ntable.p298 th { background-color: rgb(200,220,250);
|
11
|
+
}\r\ntable.p298 td { background-color: rgb(255,255,255); }\r\n</style>\n<p>Larry
|
12
|
+
and Robin play a memory game involving of a sequence of random numbers between 1
|
13
|
+
and 10, inclusive, that are called out one at a time. Each player can remember up
|
14
|
+
to 5 previous numbers. When the called number is in a player's memory, that player
|
15
|
+
is awarded a point. If it's not, the player adds the called number to his memory,
|
16
|
+
removing another number if his memory is full.</p>\r\n\r\n<p>Both players start
|
17
|
+
with empty memories. Both players always add new missed numbers to their memory
|
18
|
+
but use a different strategy in deciding which number to remove:<br>\r\nLarry's
|
19
|
+
strategy is to remove the number that hasn't been called in the longest time.<br>\r\nRobin's
|
20
|
+
strategy is to remove the number that's been in the memory the longest time.</p>\r\n\r\n<p>Example
|
21
|
+
game:<br></p>\n<center><table class=\"p298\">\n<tr>\n<th>Turn</th>\r\n <th>Called<br>number</th>\r\n
|
22
|
+
\ <th style=\"text-align:right\">Larry's<br>memory</th>\r\n <th>Larry's<br>score</th>\r\n
|
23
|
+
\ <th style=\"text-align:right\">Robin's<br>memory</th>\r\n <th>Robin's<br>score</th>\r\n</tr>\n<tr>\n<td>1</td>\r\n
|
24
|
+
\ <td>1</td>\r\n <td style=\"text-align:right\">1</td>\r\n <td>0</td>\r\n <td
|
25
|
+
style=\"text-align:right\">1</td>\r\n <td>0</td>\r\n</tr>\n<tr>\n<td>2</td>\r\n
|
26
|
+
\ <td>2</td>\r\n <td style=\"text-align:right\">1,2</td>\r\n <td>0</td>\r\n <td
|
27
|
+
style=\"text-align:right\">1,2</td>\r\n <td>0</td>\r\n</tr>\n<tr>\n<td>3</td>\r\n
|
28
|
+
\ <td>4</td>\r\n <td style=\"text-align:right\">1,2,4</td>\r\n <td>0</td>\r\n
|
29
|
+
\ <td style=\"text-align:right\">1,2,4</td>\r\n <td>0</td>\r\n</tr>\n<tr>\n<td>4</td>\r\n
|
30
|
+
\ <td>6</td>\r\n <td style=\"text-align:right\">1,2,4,6</td>\r\n <td>0</td>\r\n
|
31
|
+
\ <td style=\"text-align:right\">1,2,4,6</td>\r\n <td>0</td>\r\n</tr>\n<tr>\n<td>5</td>\r\n
|
32
|
+
\ <td>1</td>\r\n <td style=\"text-align:right\">1,2,4,6</td>\r\n <td>1</td>\r\n
|
33
|
+
\ <td style=\"text-align:right\">1,2,4,6</td>\r\n <td>1</td>\r\n</tr>\n<tr>\n<td>6</td>\r\n
|
34
|
+
\ <td>8</td>\r\n <td style=\"text-align:right\">1,2,4,6,8</td>\r\n <td>1</td>\r\n
|
35
|
+
\ <td style=\"text-align:right\">1,2,4,6,8</td>\r\n <td>1</td>\r\n</tr>\n<tr>\n<td>7</td>\r\n
|
36
|
+
\ <td>10</td>\r\n <td style=\"text-align:right\">1,4,6,8,10</td>\r\n <td>1</td>\r\n
|
37
|
+
\ <td style=\"text-align:right\">2,4,6,8,10</td>\r\n <td>1</td>\r\n</tr>\n<tr>\n<td>8</td>\r\n
|
38
|
+
\ <td>2</td>\r\n <td style=\"text-align:right\">1,2,6,8,10</td>\r\n <td>1</td>\r\n
|
39
|
+
\ <td style=\"text-align:right\">2,4,6,8,10</td>\r\n <td>2</td>\r\n</tr>\n<tr>\n<td>9</td>\r\n
|
40
|
+
\ <td>4</td>\r\n <td style=\"text-align:right\">1,2,4,8,10</td>\r\n <td>1</td>\r\n
|
41
|
+
\ <td style=\"text-align:right\">2,4,6,8,10</td>\r\n <td>3</td>\r\n</tr>\n<tr>\n<td>10</td>\r\n
|
42
|
+
\ <td>1</td>\r\n <td style=\"text-align:right\">1,2,4,8,10</td>\r\n <td>2</td>\r\n
|
43
|
+
\ <td style=\"text-align:right\">1,4,6,8,10</td>\r\n <td>3</td>\r\n</tr>\n</table></center>\r\n\r\n<p>Denoting
|
44
|
+
Larry's score by <var>L</var> and Robin's score by <var>R</var>, what is the expected
|
45
|
+
value of |<var>L</var>-<var>R</var>| after 50 turns? Give your answer rounded to
|
46
|
+
eight decimal places using the format x.xxxxxxxx .</p>\r\n"
|
@@ -0,0 +1,31 @@
|
|
1
|
+
---
|
2
|
+
:id: 299
|
3
|
+
:name: Three similar triangles
|
4
|
+
:url: http://projecteuler.net/problem=299
|
5
|
+
:content: "\r\n<p>Four points with integer coordinates are selected:<br>A(<var>a</var>, 0),
|
6
|
+
B(<var>b</var>, 0), C(0, <var>c</var>) and D(0, <var>d</var>), \r\nwith 0 <img src=\"images/symbol_lt.gif\"
|
7
|
+
width=\"10\" height=\"10\" alt=\"<\" border=\"0\" style=\"vertical-align:middle;\"> <var>a</var> <img
|
8
|
+
src=\"images/symbol_lt.gif\" width=\"10\" height=\"10\" alt=\"<\" border=\"0\"
|
9
|
+
style=\"vertical-align:middle;\"> <var>b</var> and 0 <img src=\"images/symbol_lt.gif\"
|
10
|
+
width=\"10\" height=\"10\" alt=\"<\" border=\"0\" style=\"vertical-align:middle;\"> <var>c</var> <img
|
11
|
+
src=\"images/symbol_lt.gif\" width=\"10\" height=\"10\" alt=\"<\" border=\"0\"
|
12
|
+
style=\"vertical-align:middle;\"> <var>d</var>.<br>\r\nPoint P, also with integer
|
13
|
+
coordinates, is chosen on the line AC so that the three triangles ABP, CDP and BDP
|
14
|
+
are all <dfn title=\"Have equal angles\">similar</dfn>.</p>\r\n<div align=\"center\"><img
|
15
|
+
src=\"project/images/p_299_ThreeSimTri.gif\"></div>\r\n<p>It is easy to prove that
|
16
|
+
the three triangles can be similar, only if <var>a</var>=<var>c</var>.</p>\r\n\r\n<p>So,
|
17
|
+
given that <var>a</var>=<var>c</var>, we are looking for triplets (<var>a</var>,<var>b</var>,<var>d</var>)
|
18
|
+
such that at least one point P (with integer coordinates) exists on AC, making the
|
19
|
+
three triangles ABP, CDP and BDP all similar.</p>\r\n\r\n<p>For example, if (<var>a</var>,<var>b</var>,<var>d</var>)=(2,3,4),
|
20
|
+
it can be easily verified that point P(1,1) satisfies the above condition. \r\nNote
|
21
|
+
that the triplets (2,3,4) and (2,4,3) are considered as distinct, although point
|
22
|
+
P(1,1) is common for both.</p>\r\n\r\n<p>If <var>b</var>+<var>d</var> <img src=\"images/symbol_lt.gif\"
|
23
|
+
width=\"10\" height=\"10\" alt=\"<\" border=\"0\" style=\"vertical-align:middle;\"> 100,
|
24
|
+
there are 92 distinct triplets (<var>a</var>,<var>b</var>,<var>d</var>) such that
|
25
|
+
point P exists.<br>\r\nIf <var>b</var>+<var>d</var> <img src=\"images/symbol_lt.gif\"
|
26
|
+
width=\"10\" height=\"10\" alt=\"<\" border=\"0\" style=\"vertical-align:middle;\"> 100
|
27
|
+
000, there are 320471 distinct triplets (<var>a</var>,<var>b</var>,<var>d</var>)
|
28
|
+
such that point P exists.</p>\r\n<p>If <var>b</var>+<var>d</var> <img src=\"images/symbol_lt.gif\"
|
29
|
+
width=\"10\" height=\"10\" alt=\"<\" border=\"0\" style=\"vertical-align:middle;\"> 100
|
30
|
+
000 000, how many distinct triplets (<var>a</var>,<var>b</var>,<var>d</var>) are
|
31
|
+
there such that point P exists?</p>\r\n"
|
data/data/problems/3.yml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
:id: 3
|
3
|
+
:name: Largest prime factor
|
4
|
+
:url: http://projecteuler.net/problem=3
|
5
|
+
:content: "\r\n<p>The prime factors of 13195 are 5, 7, 13 and 29.</p>\r\n<p>What is
|
6
|
+
the largest prime factor of the number 600851475143 ?</p>\r\n<!--\r\nNote: This
|
7
|
+
problem has been changed recently, please check that you are using the right number.\r\n-->\r\n\r\n"
|
@@ -0,0 +1,12 @@
|
|
1
|
+
---
|
2
|
+
:id: 30
|
3
|
+
:name: Digit fifth powers
|
4
|
+
:url: http://projecteuler.net/problem=30
|
5
|
+
:content: "\r\n\n<p>Surprisingly there are only three numbers that can be written
|
6
|
+
as the sum of fourth powers of their digits:</p>\n<blockquote>1634 = 1<sup>4</sup>
|
7
|
+
+ 6<sup>4</sup> + 3<sup>4</sup> + 4<sup>4</sup><br>\n8208 = 8<sup>4</sup> + 2<sup>4</sup>
|
8
|
+
+ 0<sup>4</sup> + 8<sup>4</sup><br>\n9474 = 9<sup>4</sup> + 4<sup>4</sup> + 7<sup>4</sup>
|
9
|
+
+ 4<sup>4</sup>\n</blockquote>\n<p class=\"info\">As 1 = 1<sup>4</sup> is not a
|
10
|
+
sum it is not included.</p>\n<p>The sum of these numbers is 1634 + 8208 + 9474 =
|
11
|
+
19316.</p>\n<p>Find the sum of all the numbers that can be written as the sum of
|
12
|
+
fifth powers of their digits.</p>\n\r\n"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
:id: 300
|
3
|
+
:name: Protein folding
|
4
|
+
:url: http://projecteuler.net/problem=300
|
5
|
+
:content: "\r\n<p>In a very simplified form, we can consider proteins as strings consisting
|
6
|
+
of hydrophobic (H) and polar (P) elements, e.g. HHPPHHHPHHPH. <br>\r\nFor this problem,
|
7
|
+
the orientation of a protein is important; e.g. HPP is considered distinct from
|
8
|
+
PPH. Thus, there are 2<sup><var>n</var></sup> distinct proteins consisting of <var>n</var>
|
9
|
+
elements.</p>\r\n\r\n<p>When one encounters these strings in nature, they are always
|
10
|
+
folded in such a way that the number of H-H contact points is as large as possible,
|
11
|
+
since this is energetically advantageous.<br>\r\nAs a result, the H-elements tend
|
12
|
+
to accumulate in the inner part, with the P-elements on the outside.<br>\r\nNatural
|
13
|
+
proteins are folded in three dimensions of course, but we will only consider protein
|
14
|
+
folding in <u>two dimensions</u>.</p>\r\n\r\n<p>The figure below shows two possible
|
15
|
+
ways that our example protein could be folded (H-H contact points are shown with
|
16
|
+
red dots).</p>\r\n\r\n<div align=\"center\"><img src=\"project/images/p_300_protein.gif\"></div>\r\n\r\n<p>The
|
17
|
+
folding on the left has only six H-H contact points, thus it would never occur naturally.<br>\r\nOn
|
18
|
+
the other hand, the folding on the right has nine H-H contact points, which is optimal
|
19
|
+
for this string.</p>\r\n\r\n<p>Assuming that H and P elements are equally likely
|
20
|
+
to occur in any position along the string, the average number of H-H contact points
|
21
|
+
in an optimal folding of a random protein string of length 8 turns out to be 850 / 2<sup>8</sup>=3.3203125.</p>\r\n\r\n<p>What
|
22
|
+
is the average number of H-H contact points in an optimal folding of a random protein
|
23
|
+
string of length 15?<br>\r\nGive your answer using as many decimal places as necessary
|
24
|
+
for an exact result.</p>\r\n"
|
@@ -0,0 +1,25 @@
|
|
1
|
+
---
|
2
|
+
:id: 301
|
3
|
+
:name: Nim
|
4
|
+
:url: http://projecteuler.net/problem=301
|
5
|
+
:content: "\r\n<p><i>Nim</i> is a game played with heaps of stones, where two players
|
6
|
+
take it in turn to remove any number of stones from any heap until no stones remain.</p>\r\n\r\n<p>We'll
|
7
|
+
consider the three-heap normal-play version of Nim, which works as follows:<br>\r\n-
|
8
|
+
At the start of the game there are three heaps of stones.<br>\r\n- On his turn the
|
9
|
+
player removes any positive number of stones from any single heap.<br>\r\n- The
|
10
|
+
first player unable to move (because no stones remain) loses.</p>\r\n\r\n<p> If
|
11
|
+
(<var>n</var><sub>1</sub>,<var>n</var><sub>2</sub>,<var>n</var><sub>3</sub>) indicates
|
12
|
+
a Nim position consisting of heaps of size <var>n</var><sub>1</sub>, <var>n</var><sub>2</sub>
|
13
|
+
and <var>n</var><sub>3</sub> then there is a simple function <var>X</var>(<var>n</var><sub>1</sub>,<var>n</var><sub>2</sub>,<var>n</var><sub>3</sub>)
|
14
|
+
— that you may look up or attempt to deduce for yourself — that returns:\r\n</p>\n<ul>\n<li>zero
|
15
|
+
if, with perfect strategy, the player about to move will eventually lose; or</li>\r\n<li>non-zero
|
16
|
+
if, with perfect strategy, the player about to move will eventually win.</li>\n</ul>\n<p>For
|
17
|
+
example <var>X</var>(1,2,3) = 0 because, no matter what the current player does,
|
18
|
+
his opponent can respond with a move that leaves two heaps of equal size, at which
|
19
|
+
point every move by the current player can be mirrored by his opponent until no
|
20
|
+
stones remain; so the current player loses. To illustrate:<br>\r\n- current player
|
21
|
+
moves to (1,2,1)<br>\r\n- opponent moves to (1,0,1)<br>\r\n- current player moves
|
22
|
+
to (0,0,1)<br>\r\n- opponent moves to (0,0,0), and so wins.</p>\r\n\r\n<p>For how
|
23
|
+
many positive integers <var>n</var> <img src=\"images/symbol_le.gif\" width=\"10\"
|
24
|
+
height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"> 2<sup>30</sup>
|
25
|
+
does <var>X</var>(<var>n</var>,2<var>n</var>,3<var>n</var>) = 0 ?\r\n</p>\r\n\r\n"
|
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
:id: 302
|
3
|
+
:name: Strong Achilles Numbers
|
4
|
+
:url: http://projecteuler.net/problem=302
|
5
|
+
:content: "\r\n<p>\r\nA positive integer <var>n</var> is <b>powerful</b> if p<sup>2</sup>
|
6
|
+
is a divisor of <var>n</var> for every prime factor p in <var>n</var>.\r\n</p>\r\n<p>\r\nA
|
7
|
+
positive integer <var>n</var> is a <b>perfect power</b> if <var>n</var> can be expressed
|
8
|
+
as a power of another positive integer.\r\n</p>\r\n<p>\r\nA positive integer <var>n</var>
|
9
|
+
is an <b>Achilles number</b> if <var>n</var> is powerful but not a perfect power.
|
10
|
+
For example, 864 and 1800 are Achilles numbers: 864 = 2<sup>5</sup>·3<sup>3</sup>
|
11
|
+
and 1800 = 2<sup>3</sup>·3<sup>2</sup>·5<sup>2</sup>.\r\n</p>\r\n<p>\r\nWe shall
|
12
|
+
call a positive integer <var>S</var> a <i>Strong Achilles number</i> if both <var>S</var>
|
13
|
+
and φ(<var>S</var>) are Achilles numbers.<sup>1</sup><br>\r\nFor example, 864 is
|
14
|
+
a Strong Achilles number: φ(864) = 288 = 2<sup>5</sup>·3<sup>2</sup>. However, 1800
|
15
|
+
isn't a Strong Achilles number because: φ(1800) = 480 = 2<sup>5</sup>·3<sup>1</sup>·5<sup>1</sup>.\r\n</p>\r\n<p>There
|
16
|
+
are 7 Strong Achilles numbers below 10<sup>4</sup> and 656 below 10<sup>8</sup>.\r\n</p>\r\n<p>\r\nHow
|
17
|
+
many Strong Achilles numbers are there below 10<sup>18</sup>?\r\n</p>\r\n<p>\r\n<sup>1</sup>
|
18
|
+
φ denotes <b>Euler's totient function</b>.\r\n</p>\r\n\r\n\r\n\r\n\r\n\r\n"
|
@@ -0,0 +1,11 @@
|
|
1
|
+
---
|
2
|
+
:id: 303
|
3
|
+
:name: Multiples with small digits
|
4
|
+
:url: http://projecteuler.net/problem=303
|
5
|
+
:content: "\r\n<p>\r\nFor a positive integer <var>n</var>, define <var>f</var>(<var>n</var>)
|
6
|
+
as the least positive multiple of <var>n</var> that, written in base 10, uses only
|
7
|
+
digits <img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
8
|
+
style=\"vertical-align:middle;\"> 2.</p>\r\n<p>Thus <var>f</var>(2)=2, <var>f</var>(3)=12,
|
9
|
+
<var>f</var>(7)=21, <var>f</var>(42)=210, <var>f</var>(89)=1121222.</p>\r\n<p>Also,
|
10
|
+
<img src=\"project/images/p303_formula100.gif\" style=\"vertical-align:middle\">.</p>\r\n<p>\r\nFind
|
11
|
+
<img src=\"project/images/p303_formula10000.gif\" style=\"vertical-align:middle\">.\r\n</p>\r\n\r\n"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
---
|
2
|
+
:id: 304
|
3
|
+
:name: Primonacci
|
4
|
+
:url: http://projecteuler.net/problem=304
|
5
|
+
:content: "\r\n<p>\r\nFor any positive integer <var>n</var> the function next_prime(<var>n</var>)
|
6
|
+
returns the smallest prime p <br> such that p<img src=\"images/symbol_gt.gif\" width=\"10\"
|
7
|
+
height=\"10\" alt=\">\" border=\"0\" style=\"vertical-align:middle;\"><var>n</var>.\r\n</p>\r\n<p>\r\nThe
|
8
|
+
sequence a(<var>n</var>) is defined by:<br>\r\na(1)=next_prime(10<sup>14</sup>)
|
9
|
+
and a(<var>n</var>)=next_prime(a(<var>n</var>-1)) for n<img src=\"images/symbol_gt.gif\"
|
10
|
+
width=\"10\" height=\"10\" alt=\">\" border=\"0\" style=\"vertical-align:middle;\">1.\r\n</p>\n<p></p>\r\n<p>\r\nThe
|
11
|
+
fibonacci sequence f(<var>n</var>) is defined by:\r\nf(0)=0, f(1)=1 and f(<var>n</var>)=f(<var>n</var>-1)+f(<var>n</var>-2)
|
12
|
+
for <var>n</var><img src=\"images/symbol_gt.gif\" width=\"10\" height=\"10\" alt=\">\"
|
13
|
+
border=\"0\" style=\"vertical-align:middle;\">1.\r\n</p>\r\n<p>\r\nThe sequence
|
14
|
+
b(<var>n</var>) is defined as f(a(<var>n</var>)).\r\n</p>\r\n<p>\r\nFind <img src=\"images/symbol_sum.gif\"
|
15
|
+
width=\"11\" height=\"14\" alt=\"∑\" border=\"0\" style=\"vertical-align:middle;\">b(<var>n</var>)
|
16
|
+
for 1<img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
17
|
+
style=\"vertical-align:middle;\"><var>n</var><img src=\"images/symbol_le.gif\" width=\"10\"
|
18
|
+
height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">100 000. \r\nGive
|
19
|
+
your answer mod 1234567891011. \r\n\r\n\r\n\r\n\r\n\r\n</p>"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
---
|
2
|
+
:id: 305
|
3
|
+
:name: Reflexive Position
|
4
|
+
:url: http://projecteuler.net/problem=305
|
5
|
+
:content: "\r\n<p>\r\nLet's call S the (infinite) string that is made by concatenating
|
6
|
+
the consecutive positive integers (starting from 1) written down in base 10.<br>
|
7
|
+
\r\nThus, S = 1234567891011121314151617181920212223242...\r\n</p>\r\n<p>\r\nIt's
|
8
|
+
easy to see that any number will show up an infinite number of times in S.\r\n</p>\r\n<p>\r\nLet's
|
9
|
+
call f(n) the starting position of the n<sup>th</sup> occurrence of n in S.<br>
|
10
|
+
\r\nFor example, f(1)=1, f(5)=81, f(12)=271 and f(7780)=111111365.\r\n</p>\r\n<p>\r\nFind
|
11
|
+
<img src=\"images/symbol_sum.gif\" width=\"11\" height=\"14\" alt=\"∑\" border=\"0\"
|
12
|
+
style=\"vertical-align:middle;\">f(3<sup>k</sup>) for 1<img src=\"images/symbol_le.gif\"
|
13
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">k<img
|
14
|
+
src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">13.\r\n</p>\r\n\r\n"
|
@@ -0,0 +1,29 @@
|
|
1
|
+
---
|
2
|
+
:id: 306
|
3
|
+
:name: Paper-strip Game
|
4
|
+
:url: http://projecteuler.net/problem=306
|
5
|
+
:content: "\r\n<p>The following game is a classic example of Combinatorial Game Theory:</p>\r\n\r\n<p>Two
|
6
|
+
players start with a strip of <var>n</var> white squares and they take alternate
|
7
|
+
turns.<br>\r\nOn each turn, a player picks two contiguous white squares and paints
|
8
|
+
them black.<br>\r\nThe first player who cannot make a move loses.</p>\r\n\r\n<p></p>\n<ul>\n<li>If
|
9
|
+
<var>n</var> = 1, there are no valid moves, so the first player loses automatically.</li>\r\n<li>If
|
10
|
+
<var>n</var> = 2, there is only one valid move, after which the second player loses.</li>\r\n<li>If
|
11
|
+
<var>n</var> = 3, there are two valid moves, but both leave a situation where the
|
12
|
+
second player loses.</li>\r\n<li>If <var>n</var> = 4, there are three valid moves
|
13
|
+
for the first player; she can win the game by painting the two middle squares.</li>\r\n<li>If
|
14
|
+
<var>n</var> = 5, there are four valid moves for the first player (shown below in
|
15
|
+
red); but no matter what she does, the second player (blue) wins.</li>\r\n</ul>\n<div
|
16
|
+
align=\"center\"><img src=\"project/images/p_306_pstrip.gif\"></div>\r\n\r\n\r\n<p>So,
|
17
|
+
for 1 <img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
18
|
+
style=\"vertical-align:middle;\"><var>n</var> <img src=\"images/symbol_le.gif\"
|
19
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">
|
20
|
+
5, there are 3 values of <var>n</var> for which the first player can force a win.<br>\r\nSimilarly,
|
21
|
+
for 1 <img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
22
|
+
style=\"vertical-align:middle;\"><var>n</var> <img src=\"images/symbol_le.gif\"
|
23
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">
|
24
|
+
50, there are 40 values of <var>n</var> for which the first player can force a win.</p>\r\n\r\n<p>For
|
25
|
+
1 <img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
26
|
+
style=\"vertical-align:middle;\"><var>n</var> <img src=\"images/symbol_le.gif\"
|
27
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">
|
28
|
+
1 000 000, how many values of <var>n</var> are there for which the first player
|
29
|
+
can force a win?</p>\r\n"
|
@@ -0,0 +1,12 @@
|
|
1
|
+
---
|
2
|
+
:id: 307
|
3
|
+
:name: Chip Defects
|
4
|
+
:url: http://projecteuler.net/problem=307
|
5
|
+
:content: "\r\n<p>\r\n<var>k</var> defects are randomly distributed amongst <var>n</var>
|
6
|
+
integrated-circuit chips produced by a factory (any number of defects may be found
|
7
|
+
on a chip and each defect is independent of the other defects).\r\n</p>\r\n<p>\r\nLet
|
8
|
+
p(<var>k,n</var>) represent the probability that there is a chip with at least 3
|
9
|
+
defects.<br>\r\nFor instance p(3,7) <img src=\"images/symbol_asymp.gif\" width=\"11\"
|
10
|
+
height=\"9\" alt=\"≈\" border=\"0\" style=\"vertical-align:middle;\"> 0.0204081633.\r\n</p>\r\n<p>\r\nFind
|
11
|
+
p(20 000, 1 000 000) and give your answer rounded to 10 decimal places in the form
|
12
|
+
0.abcdefghij\r\n</p>\r\n"
|
@@ -0,0 +1,34 @@
|
|
1
|
+
---
|
2
|
+
:id: 308
|
3
|
+
:name: An amazing Prime-generating Automaton
|
4
|
+
:url: http://projecteuler.net/problem=308
|
5
|
+
:content: "\r\n<p>A program written in the programming language Fractran consists
|
6
|
+
of a list of fractions.</p>\r\n\r\n<p>The internal state of the Fractran Virtual
|
7
|
+
Machine is a positive integer, which is initially set to a seed value. Each iteration
|
8
|
+
of a Fractran program multiplies the state integer by the first fraction in the
|
9
|
+
list which will leave it an integer.</p>\r\n\r\n<p>For example, one of the Fractran
|
10
|
+
programs that John Horton Conway wrote for prime-generation consists of the following
|
11
|
+
14 fractions:<br></p>\n<table class=\"formula\"><tr>\n<td><table class=\"frac\">\n<tr><td>17</td></tr>\n<tr><td
|
12
|
+
class=\"overline\">91</td></tr>\n</table></td>\r\n<td>,</td>\r\n<td><table class=\"frac\">\n<tr><td>78</td></tr>\n<tr><td
|
13
|
+
class=\"overline\">85</td></tr>\n</table></td>\r\n<td>,</td>\r\n<td><table class=\"frac\">\n<tr><td>19</td></tr>\n<tr><td
|
14
|
+
class=\"overline\">51</td></tr>\n</table></td>\r\n<td>,</td>\r\n<td><table class=\"frac\">\n<tr><td>23</td></tr>\n<tr><td
|
15
|
+
class=\"overline\">38</td></tr>\n</table></td>\r\n<td>,</td>\r\n<td><table class=\"frac\">\n<tr><td>29</td></tr>\n<tr><td
|
16
|
+
class=\"overline\">33</td></tr>\n</table></td>\r\n<td>,</td>\r\n<td><table class=\"frac\">\n<tr><td>77</td></tr>\n<tr><td
|
17
|
+
class=\"overline\">29</td></tr>\n</table></td>\r\n<td>,</td>\r\n<td><table class=\"frac\">\n<tr><td>95</td></tr>\n<tr><td
|
18
|
+
class=\"overline\">23</td></tr>\n</table></td>\r\n<td>,</td>\r\n<td><table class=\"frac\">\n<tr><td>77</td></tr>\n<tr><td
|
19
|
+
class=\"overline\">19</td></tr>\n</table></td>\r\n<td>,</td>\r\n<td><table class=\"frac\">\n<tr><td>1</td></tr>\n<tr><td
|
20
|
+
class=\"overline\">17</td></tr>\n</table></td>\r\n<td>,</td>\r\n<td><table class=\"frac\">\n<tr><td>11</td></tr>\n<tr><td
|
21
|
+
class=\"overline\">13</td></tr>\n</table></td>\r\n<td>,</td>\r\n<td><table class=\"frac\">\n<tr><td>13</td></tr>\n<tr><td
|
22
|
+
class=\"overline\">11</td></tr>\n</table></td>\r\n<td>,</td>\r\n<td><table class=\"frac\">\n<tr><td>15</td></tr>\n<tr><td
|
23
|
+
class=\"overline\">2</td></tr>\n</table></td>\r\n<td>,</td>\r\n<td><table class=\"frac\">\n<tr><td>1</td></tr>\n<tr><td
|
24
|
+
class=\"overline\">7</td></tr>\n</table></td>\r\n<td>,</td>\r\n<td><table class=\"frac\">\n<tr><td>55</td></tr>\n<tr><td
|
25
|
+
class=\"overline\">1</td></tr>\n</table></td>\r\n<td>.</td>\r\n</tr></table>\n<p>Starting
|
26
|
+
with the seed integer 2, successive iterations of the program produce the sequence:<br>\r\n15,
|
27
|
+
825, 725, 1925, 2275, 425, ..., 68, <b>4</b>, 30, ..., 136, <b>8</b>, 60, ..., 544,
|
28
|
+
<b>32</b>, 240, ...</p>\r\n\r\n<p>The powers of 2 that appear in this sequence are
|
29
|
+
2<sup>2</sup>, 2<sup>3</sup>, 2<sup>5</sup>, ...<br>\r\nIt can be shown that <i>all</i>
|
30
|
+
the powers of 2 in this sequence have prime exponents and that <i>all</i> the primes
|
31
|
+
appear as exponents of powers of 2, in proper order!</p>\r\n\r\n<p>If someone uses
|
32
|
+
the above Fractran program to solve Project Euler Problem 7 (find the 10001<sup>st</sup>
|
33
|
+
prime), how many iterations would be needed until the program produces 2<sup>10001st
|
34
|
+
prime</sup> ?\r\n</p>"
|
@@ -0,0 +1,17 @@
|
|
1
|
+
---
|
2
|
+
:id: 309
|
3
|
+
:name: Integer Ladders
|
4
|
+
:url: http://projecteuler.net/problem=309
|
5
|
+
:content: "\r\n<p>In the classic \"Crossing Ladders\" problem, we are given the lengths
|
6
|
+
<var>x</var> and <var>y</var> of two ladders resting on the opposite walls of a
|
7
|
+
narrow, level street. We are also given the height <var>h</var> above the street
|
8
|
+
where the two ladders cross and we are asked to find the width of the street (<var>w</var>).</p>\r\n\r\n<div
|
9
|
+
align=\"center\"><img src=\"project/images/p_309_ladders.gif\"></div>\r\n\r\n<p>Here,
|
10
|
+
we are only concerned with instances where all four variables are positive integers.<br>\r\nFor
|
11
|
+
example, if <var>x</var> = 70, <var>y</var> = 119 and <var>h</var> = 30, we can
|
12
|
+
calculate that <var>w</var> = 56.</p>\r\n\r\n<p>In fact, for integer values <var>x</var>,
|
13
|
+
<var>y</var>, <var>h</var> and 0 x y x,<var>y</var>,<var>h</var>) producing integer
|
14
|
+
solutions for <var>w</var>:<br>\r\n(70, 119, 30), (74, 182, 21), (87, 105, 35),
|
15
|
+
(100, 116, 35) and (119, 175, 40).</p>\r\n\r\n<p>For integer values <var>x</var>,
|
16
|
+
<var>y</var>, <var>h</var> and 0 x y x,<var>y</var>,<var>h</var>) produce integer
|
17
|
+
solutions for <var>w</var>?</p>\r\n\r\n"
|
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
:id: 31
|
3
|
+
:name: Coin sums
|
4
|
+
:url: http://projecteuler.net/problem=31
|
5
|
+
:content: "\r\n\n<p>In England the currency is made up of pound, £, and pence, p,
|
6
|
+
and there are eight coins in general circulation:</p>\n<blockquote>1p, 2p, 5p, 10p,
|
7
|
+
20p, 50p, £1 (100p) and £2 (200p).</blockquote>\n<p>It is possible to make £2 in
|
8
|
+
the following way:</p>\n<blockquote>1<img src=\"images/symbol_times.gif\" width=\"9\"
|
9
|
+
height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">£1 + 1<img
|
10
|
+
src=\"images/symbol_times.gif\" width=\"9\" height=\"9\" alt=\"×\" border=\"0\"
|
11
|
+
style=\"vertical-align:middle;\">50p + 2<img src=\"images/symbol_times.gif\" width=\"9\"
|
12
|
+
height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">20p + 1<img
|
13
|
+
src=\"images/symbol_times.gif\" width=\"9\" height=\"9\" alt=\"×\" border=\"0\"
|
14
|
+
style=\"vertical-align:middle;\">5p + 1<img src=\"images/symbol_times.gif\" width=\"9\"
|
15
|
+
height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">2p + 3<img
|
16
|
+
src=\"images/symbol_times.gif\" width=\"9\" height=\"9\" alt=\"×\" border=\"0\"
|
17
|
+
style=\"vertical-align:middle;\">1p</blockquote>\n<p>How many different ways can
|
18
|
+
£2 be made using any number of coins?</p>\n\r\n"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
---
|
2
|
+
:id: 310
|
3
|
+
:name: Nim Square
|
4
|
+
:url: http://projecteuler.net/problem=310
|
5
|
+
:content: "\r\n<p>\r\nAlice and Bob play the game Nim Square.<br>\r\nNim Square is
|
6
|
+
just like ordinary three-heap normal play Nim, but the players may only remove a
|
7
|
+
square number of stones from a heap.<br>\r\nThe number of stones in the three heaps
|
8
|
+
is represented by the ordered triple (a,b,c).<br>\r\nIf 0<img src=\"images/symbol_le.gif\"
|
9
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">a<img
|
10
|
+
src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">b<img
|
11
|
+
src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">c<img
|
12
|
+
src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">29
|
13
|
+
then the number of losing positions for the next player is 1160.\r\n</p>\r\n<p>\r\nFind
|
14
|
+
the number of losing positions for the next player if 0<img src=\"images/symbol_le.gif\"
|
15
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">a<img
|
16
|
+
src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">b<img
|
17
|
+
src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">c<img
|
18
|
+
src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">100
|
19
|
+
000.\r\n</p>\r\n\r\n\r\n"
|