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,21 @@
|
|
1
|
+
---
|
2
|
+
:id: 344
|
3
|
+
:name: Silver dollar game
|
4
|
+
:url: http://projecteuler.net/problem=344
|
5
|
+
:content: "\r\n<p>One variant of N.G. de Bruijn's <b>silver dollar</b> game can be
|
6
|
+
described as follows:</p>\r\n\r\n<p>On a strip of squares a number of coins are
|
7
|
+
placed, at most one coin per square. Only one coin, called the <b>silver dollar</b>,
|
8
|
+
has any value. Two players take turns making moves. At each turn a player must make
|
9
|
+
either a <i>regular</i> or a <i>special</i> move.</p>\r\n\r\n<p>A <i>regular</i>
|
10
|
+
move consists of selecting one coin and moving it one or more squares to the left.
|
11
|
+
The coin cannot move out of the strip or jump on or over another coin.</p>\r\n\r\n<p>Alternatively,
|
12
|
+
the player can choose to make the <i>special</i> move of pocketing the leftmost
|
13
|
+
coin rather than making a regular move. If no regular moves are possible, the player
|
14
|
+
is forced to pocket the leftmost coin.</p>\r\n\r\n<p>The winner is the player who
|
15
|
+
pockets the silver dollar.</p>\r\n\r\n\r\n<div align=\"center\">\r\n<img src=\"project/images/p_344_silverdollar.gif\"><br>\n</div>\r\n\r\n<p>A
|
16
|
+
<i>winning configuration</i> is an arrangement of coins on the strip where the first
|
17
|
+
player can force a win no matter what the second player does.</p>\r\n\r\n<p>Let
|
18
|
+
W(<var>n</var>,<var>c</var>) be the number of winning configurations for a strip
|
19
|
+
of <var>n</var> squares, <var>c</var> worthless coins and one silver dollar.</p>\r\n\r\n<p>You
|
20
|
+
are given that W(10,2) = 324 and W(100,10) = 1514704946113500.</p>\r\n\r\n<p>Find
|
21
|
+
W(1 000 000, 100) modulo the semiprime 1000 036 000 099 (= 1 000 003 · 1 000 033).\r\n</p>\r\n\r\n"
|
@@ -0,0 +1,26 @@
|
|
1
|
+
---
|
2
|
+
:id: 345
|
3
|
+
:name: Matrix Sum
|
4
|
+
:url: http://projecteuler.net/problem=345
|
5
|
+
:content: "\r\n<p>We define the Matrix Sum of a matrix as the maximum sum of matrix
|
6
|
+
elements with each element being the only one in his row and column. For example,
|
7
|
+
the Matrix Sum of the matrix below equals 3315 ( = 863 + 383 + 343 + 959 + 767):</p>\r\n\r\n<p
|
8
|
+
style=\"text-align:center;font-family:courier new;\">\r\n 7 53 183 439 <span style=\"color:#00ff00;font-family:courier
|
9
|
+
new;\"><b>863</b></span><br>\r\n497 <span style=\"color:#00ff00;font-family:courier
|
10
|
+
new;\"><b>383</b></span> 563 79 973<br>\r\n287 63 <span style=\"color:#00ff00;font-family:courier
|
11
|
+
new;\"><b>343</b></span> 169 583<br>\r\n627 343 773 <span style=\"color:#00ff00;font-family:courier
|
12
|
+
new;\"><b>959</b></span> 943<br><span style=\"color:#00ff00;font-family:courier
|
13
|
+
new;\"><b>767</b></span> 473 103 699 303<br></p>\r\n\r\n<p>\r\nFind the Matrix Sum
|
14
|
+
of:<br></p>\r\n<p style=\"text-align:center;font-family:courier new;\">\r\n 7 53
|
15
|
+
183 439 863 497 383 563 79 973 287 63 343 169 583<br>\r\n627 343 773 959 943 767
|
16
|
+
473 103 699 303 957 703 583 639 913<br>\r\n447 283 463 29 23 487 463 993 119 883
|
17
|
+
327 493 423 159 743<br>\r\n217 623 3 399 853 407 103 983 89 463 290 516 212 462
|
18
|
+
350<br>\r\n960 376 682 962 300 780 486 502 912 800 250 346 172 812 350<br>\r\n870
|
19
|
+
456 192 162 593 473 915 45 989 873 823 965 425 329 803<br>\r\n973 965 905 919 133
|
20
|
+
673 665 235 509 613 673 815 165 992 326<br>\r\n322 148 972 962 286 255 941 541 265
|
21
|
+
323 925 281 601 95 973<br>\r\n445 721 11 525 473 65 511 164 138 672 18 428 154
|
22
|
+
448 848<br>\r\n414 456 310 312 798 104 566 520 302 248 694 976 430 392 198<br>\r\n184
|
23
|
+
829 373 181 631 101 969 613 840 740 778 458 284 760 390<br>\r\n821 461 843 513 17
|
24
|
+
901 711 993 293 157 274 94 192 156 574<br>\r\n 34 124 4 878 450 476 712 914 838
|
25
|
+
669 875 299 823 329 699<br>\r\n815 559 813 459 522 788 168 586 966 232 308 833 251
|
26
|
+
631 107<br>\r\n813 883 451 509 615 77 281 613 459 205 380 274 302 35 805<br></p>\r\n"
|
@@ -0,0 +1,11 @@
|
|
1
|
+
---
|
2
|
+
:id: 346
|
3
|
+
:name: Strong Repunits
|
4
|
+
:url: http://projecteuler.net/problem=346
|
5
|
+
:content: "\r\n<p>\r\nThe number 7 is special, because 7 is 111 written in base 2,
|
6
|
+
and 11 written in base 6 <br>(i.e. 7<sub>10</sub> = 11<sub>6</sub> = 111<sub>2</sub>).
|
7
|
+
In other words, 7 is a repunit in at least two bases b > 1. \r\n</p>\r\n<p>\r\nWe
|
8
|
+
shall call a positive integer with this property a strong repunit. It can be verified
|
9
|
+
that there are 8 strong repunits below 50: {1,7,13,15,21,31,40,43}. <br>Furthermore,
|
10
|
+
the sum of all strong repunits below 1000 equals 15864.\r\n</p>\r\nFind the sum
|
11
|
+
of all strong repunits below 10<sup>12</sup>.\r\n\r\n\r\n\r\n"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
---
|
2
|
+
:id: 347
|
3
|
+
:name: Largest integer divisible by two primes
|
4
|
+
:url: http://projecteuler.net/problem=347
|
5
|
+
:content: "\r\n<p>\r\nThe largest integer <img src=\"images/symbol_le.gif\" width=\"10\"
|
6
|
+
height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"> 100 that
|
7
|
+
is only divisible by both the primes 2 and 3 is 96, as 96=32*3=2<sup>5</sup>*3.\r\nFor
|
8
|
+
two <i>distinct</i> primes p and q let M(p,q,N) be the largest positive integer
|
9
|
+
<img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
10
|
+
style=\"vertical-align:middle;\">N only divisible\r\nby both p and q and M(p,q,N)=0
|
11
|
+
if such a positive integer does not exist.\r\n</p>\r\n<p>\r\nE.g. M(2,3,100)=96.<br>
|
12
|
+
\r\nM(3,5,100)=75 and not 90 because 90 is divisible by 2 ,3 and 5.<br>\r\nAlso
|
13
|
+
M(2,73,100)=0 because there does not exist a positive integer <img src=\"images/symbol_le.gif\"
|
14
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">
|
15
|
+
100 that is divisible by both 2 and 73.\r\n</p>\r\n<p>\r\nLet S(N) be the sum of
|
16
|
+
all distinct M(p,q,N).\r\nS(100)=2262.\r\n</p>\r\n<p>\r\nFind S(10 000 000).\r\n</p>\r\n\r\n\r\n\r\n\r\n\r\n"
|
@@ -0,0 +1,12 @@
|
|
1
|
+
---
|
2
|
+
:id: 348
|
3
|
+
:name: Sum of a square and a cube
|
4
|
+
:url: http://projecteuler.net/problem=348
|
5
|
+
:content: "\r\n<p>Many numbers can be expressed as the sum of a square and a cube.
|
6
|
+
Some of them in more than one way.</p>\r\n\r\n<p>Consider the palindromic numbers
|
7
|
+
that can be expressed as the sum of a square and a cube, both greater than 1, in
|
8
|
+
<b>exactly</b> 4 different ways.<br>\r\nFor example, 5229225 is a palindromic number
|
9
|
+
and it can be expressed in exactly 4 different ways:</p>\r\n<p>2285<sup>2</sup>
|
10
|
+
+ 20<sup>3</sup><br>\r\n2223<sup>2</sup> + 66<sup>3</sup><br>\r\n1810<sup>2</sup>
|
11
|
+
+ 125<sup>3</sup><br>\r\n1197<sup>2</sup> + 156<sup>3</sup></p>\r\n \r\n<p>Find
|
12
|
+
the sum of the five smallest such palindromic numbers.</p>\r\n\r\n"
|
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
:id: 349
|
3
|
+
:name: Langton's ant
|
4
|
+
:url: http://projecteuler.net/problem=349
|
5
|
+
:content: "\r\n<p>\r\nAn ant moves on a regular grid of squares that are coloured
|
6
|
+
either black or white.<br> \r\nThe ant is always oriented in one of the cardinal
|
7
|
+
directions (left, right, up or down) and moves from square to adjacent square according
|
8
|
+
to the following rules:<br>\r\n- if it is on a black square, it flips the color
|
9
|
+
of the square to white, rotates 90 degrees counterclockwise and moves forward one
|
10
|
+
square.<br>\r\n- if it is on a white square, it flips the color of the square to
|
11
|
+
black, rotates 90 degrees clockwise and moves forward one square.<br></p>\r\n<p>\r\nStarting
|
12
|
+
with a grid that is entirely white, how many squares are black after 10<sup>18</sup>
|
13
|
+
moves of the ant?\r\n</p>\r\n\r\n"
|
@@ -0,0 +1,8 @@
|
|
1
|
+
---
|
2
|
+
:id: 35
|
3
|
+
:name: Circular primes
|
4
|
+
:url: http://projecteuler.net/problem=35
|
5
|
+
:content: "\r\n\n<p>The number, 197, is called a circular prime because all rotations
|
6
|
+
of the digits: 197, 971, and 719, are themselves prime.</p>\n<p>There are thirteen
|
7
|
+
such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97.</p>\n<p>How
|
8
|
+
many circular primes are there below one million?</p>\n\r\n"
|
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
:id: 350
|
3
|
+
:name: Constraining the least greatest and the greatest least
|
4
|
+
:url: http://projecteuler.net/problem=350
|
5
|
+
:content: "\r\n<p>A <i>list of size n</i> is a sequence of <var>n</var> natural numbers.<br>
|
6
|
+
Examples are (2,4,6), (2,6,4), (10,6,15,6), and (11).\r\n</p>\n<p>\r\nThe <b>greatest
|
7
|
+
common divisor</b>, or gcd, of a list is the largest natural number that divides
|
8
|
+
all entries of the list. <br>Examples: gcd(2,6,4) = 2, gcd(10,6,15,6) = 1 and gcd(11)
|
9
|
+
= 11.\r\n</p>\n<p>\r\nThe <b>least common multiple</b>, or lcm, of a list is the
|
10
|
+
smallest natural number divisible by each entry of the list. <br>Examples: lcm(2,6,4)
|
11
|
+
= 12, lcm(10,6,15,6) = 30 and lcm(11) = 11.\r\n</p>\n<p>\r\nLet f(<var>G</var>,
|
12
|
+
<var>L</var>, <var>N</var>) be the number of lists of size <var>N</var> with gcd
|
13
|
+
<img src=\"images/symbol_ge.gif\" width=\"10\" height=\"12\" alt=\"≥\" border=\"0\"
|
14
|
+
style=\"vertical-align:middle;\"><var>G</var> and lcm <img src=\"images/symbol_le.gif\"
|
15
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>L</var>.
|
16
|
+
For example:\r\n</p>\n<p>\r\nf(10, 100, 1) = 91.<br>\r\nf(10, 100, 2) = 327.<br>\r\nf(10,
|
17
|
+
100, 3) = 1135.<br>\r\nf(10, 100, 1000) mod 101<sup>4</sup> = 3286053.\r\n</p>\n<p>\r\nFind
|
18
|
+
f(10<sup>6</sup>, 10<sup>12</sup>, 10<sup>18</sup>) mod 101<sup>4</sup>.\r\n</p>\r\n\r\n"
|
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
:id: 351
|
3
|
+
:name: Hexagonal orchards
|
4
|
+
:url: http://projecteuler.net/problem=351
|
5
|
+
:content: "\r\n<p>A <i>hexagonal orchard</i> of order <var>n</var> is a triangular
|
6
|
+
lattice made up of points within a regular hexagon with side <var>n</var>. The following
|
7
|
+
is an example of a hexagonal orchard of order 5:\r\n</p>\r\n\r\n<div align=\"center\">\r\n<img
|
8
|
+
src=\"project/images/p_351_hexorchard.png\"><br>\n</div>\r\n\r\n<p>\r\nHighlighted
|
9
|
+
in green are the points which are hidden from the center by a point closer to it.
|
10
|
+
It can be seen that for a hexagonal orchard of order 5, 30 points are hidden from
|
11
|
+
the center.\r\n</p>\r\n\r\n<p>\r\nLet H(<var>n</var>) be the number of points hidden
|
12
|
+
from the center in a hexagonal orchard of order <var>n</var>.\r\n</p>\r\n\r\n<p>\r\nH(5)
|
13
|
+
= 30. H(10) = 138. H(1 000) = 1177848.\r\n</p>\r\n\r\n<p>\r\nFind H(100 000 000).\r\n</p>\r\n"
|
@@ -0,0 +1,49 @@
|
|
1
|
+
---
|
2
|
+
:id: 352
|
3
|
+
:name: Blood tests
|
4
|
+
:url: http://projecteuler.net/problem=352
|
5
|
+
:content: "\r\n<p>\r\nEach one of the 25 sheep in a flock must be tested for a rare
|
6
|
+
virus, known to affect 2% of the sheep population.\r\nAn accurate and extremely
|
7
|
+
sensitive PCR test exists for blood samples, producing a clear positive / negative
|
8
|
+
result, but it is very time-consuming and expensive.\r\n</p>\r\n\r\n<p>\r\nBecause
|
9
|
+
of the high cost, the vet-in-charge suggests that instead of performing 25 separate
|
10
|
+
tests, the following procedure can be used instead:<br><br>\r\nThe sheep are split
|
11
|
+
into 5 groups of 5 sheep in each group. \r\nFor each group, the 5 samples are mixed
|
12
|
+
together and a single test is performed. Then,\r\n</p>\n<ul>\n<li>If the result
|
13
|
+
is negative, all the sheep in that group are deemed to be virus-free.</li>\r\n<li>If
|
14
|
+
the result is positive, 5 additional tests will be performed (a separate test for
|
15
|
+
each animal) to determine the affected individual(s).</li>\r\n</ul>\n<p>\r\nSince
|
16
|
+
the probability of infection for any specific animal is only 0.02, the first test
|
17
|
+
(on the pooled samples) for each group will be:\r\n</p>\n<ul>\n<li>Negative (and
|
18
|
+
no more tests needed) with probability 0.98<sup>5</sup> = 0.9039207968.</li>\r\n<li>Positive
|
19
|
+
(5 additional tests needed) with probability 1 - 0.9039207968 = 0.0960792032.</li>\r\n</ul>\n<p>\r\nThus,
|
20
|
+
the expected number of tests for each group is 1 + 0.0960792032 <img src=\"images/symbol_times.gif\"
|
21
|
+
width=\"9\" height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">
|
22
|
+
5 = 1.480396016.<br>\r\nConsequently, all 5 groups can be screened using an average
|
23
|
+
of only 1.480396016 <img src=\"images/symbol_times.gif\" width=\"9\" height=\"9\"
|
24
|
+
alt=\"×\" border=\"0\" style=\"vertical-align:middle;\"> 5 = <b>7.40198008</b> tests,
|
25
|
+
which represents a huge saving of more than 70% !\r\n</p>\r\n\r\n<p>\r\nAlthough
|
26
|
+
the scheme we have just described seems to be very efficient, it can still be improved
|
27
|
+
considerably (always assuming that the test is sufficiently sensitive and that there
|
28
|
+
are no adverse effects caused by mixing different samples). E.g.:\r\n</p>\n<ul>\n<li>We
|
29
|
+
may start by running a test on a mixture of all the 25 samples. It can be verified
|
30
|
+
that in about 60.35% of the cases this test will be negative, thus no more tests
|
31
|
+
will be needed. Further testing will only be required for the remaining 39.65% of
|
32
|
+
the cases.</li>\r\n<li>If we know that at least one animal in a group of 5 is infected
|
33
|
+
and the first 4 individual tests come out negative, there is no need to run a test
|
34
|
+
on the fifth animal (we know that it must be infected).</li>\r\n<li>We can try a
|
35
|
+
different number of groups / different number of animals in each group, adjusting
|
36
|
+
those numbers at each level so that the total expected number of tests will be minimised.</li>\r\n</ul>\n<p>\r\nTo
|
37
|
+
simplify the very wide range of possibilities, there is one restriction we place
|
38
|
+
when devising the most cost-efficient testing scheme: whenever we start with a mixed
|
39
|
+
sample, all the sheep contributing to that sample must be fully screened (i.e. a
|
40
|
+
verdict of infected / virus-free must be reached for all of them) before we start
|
41
|
+
examining any other animals.\r\n</p>\r\nFor the current example, it turns out that
|
42
|
+
the most cost-efficient testing scheme (we'll call it the <i>optimal strategy</i>)
|
43
|
+
requires an average of just <b>4.155452</b> tests!\r\n\r\n\r\n<p>\r\nUsing the optimal
|
44
|
+
strategy, let T(<var>s</var>,<var>p</var>) represent the average number of tests
|
45
|
+
needed to screen a flock of <var>s</var> sheep for a virus having probability <var>p</var>
|
46
|
+
to be present in any individual.<br>\r\nThus, rounded to six decimal places, T(25,
|
47
|
+
0.02) = 4.155452 and T(25, 0.10) = 12.702124.\r\n</p>\r\n\r\n<p>\r\nFind ΣT(10000,
|
48
|
+
p) for p=0.01, 0.02, 0.03, ... 0.50.<br>\r\nGive your answer rounded to six decimal
|
49
|
+
places.\r\n</p>\r\n\r\n"
|
@@ -0,0 +1,25 @@
|
|
1
|
+
---
|
2
|
+
:id: 353
|
3
|
+
:name: Risky moon
|
4
|
+
:url: http://projecteuler.net/problem=353
|
5
|
+
:content: "\r\n<p>\r\nA moon could be described by the sphere C(<var>r</var>) with
|
6
|
+
centre (0,0,0) and radius <var>r</var>. \r\n</p>\r\n\r\n<p>\r\nThere are stations
|
7
|
+
on the moon at the points on the surface of C(<var>r</var>) with integer coordinates.
|
8
|
+
The station at (0,0,<var>r</var>) is called North Pole station, the station at (0,0,-<var>r</var>)
|
9
|
+
is called South Pole station.\r\n</p>\r\n\r\n<p>\r\nAll stations are connected with
|
10
|
+
each other via the shortest road on the great arc through the stations. A journey
|
11
|
+
between two stations is risky. If <var>d</var> is the length of the road between
|
12
|
+
two stations, (<var>d</var>/(π <var>r</var>))<sup>2</sup> is a measure for the risk
|
13
|
+
of the journey (let us call it the risk of the road). If the journey includes more
|
14
|
+
than two stations, the risk of the journey is the sum of risks of the used roads.\r\n</p>\r\n\r\n<p>\r\nA
|
15
|
+
direct journey from the North Pole station to the South Pole station has the length
|
16
|
+
π<var>r</var> and risk 1. The journey from the North Pole station to the South Pole
|
17
|
+
station via (0,<var>r</var>,0) has the same length, but a smaller risk: (½π<var>r</var>/(π<var>r</var>))<sup>2</sup>+(½π<var>r</var>/(π<var>r</var>))<sup>2</sup>=0.5.\r\n</p>\r\n\r\n<p>\r\nThe
|
18
|
+
minimal risk of a journey from the North Pole station to the South Pole station
|
19
|
+
on C(<var>r</var>) is M(<var>r</var>).\r\n</p>\r\n\r\n<p>\r\nYou are given that
|
20
|
+
M(7)=0.1784943998 rounded to 10 digits behind the decimal point. \r\n</p>\r\n\r\n<p>\r\nFind
|
21
|
+
<img src=\"images/symbol_sum.gif\" width=\"11\" height=\"14\" alt=\"∑\" border=\"0\"
|
22
|
+
style=\"vertical-align:middle;\">M(2<sup>n</sup>-1) for 1<img src=\"images/symbol_le.gif\"
|
23
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">n<img
|
24
|
+
src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">15.\r\n</p>\r\n\r\n<p>\r\nGive
|
25
|
+
your answer rounded to 10 digits behind the decimal point in the form a.bcdefghijk.\r\n</p>\r\n\r\n\r\n"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
---
|
2
|
+
:id: 354
|
3
|
+
:name: 'Distances in a bee''s honeycomb '
|
4
|
+
:url: http://projecteuler.net/problem=354
|
5
|
+
:content: "\r\n<p>Consider a honey bee's honeycomb where each cell is a perfect regular
|
6
|
+
hexagon with side length 1.</p>\r\n\r\n<div align=\"center\">\r\n<img src=\"project/images/p_354_bee_honeycomb.png\">\n</div>\r\n\r\n\r\n<p>\r\nOne
|
7
|
+
particular cell is occupied by the queen bee.<br>\r\nFor a positive real number
|
8
|
+
<var>L</var>, let B(<var>L</var>) count the cells with distance <var>L</var> from
|
9
|
+
the queen bee cell (all distances are measured from centre to centre); you may assume
|
10
|
+
that the honeycomb is large enough to accommodate for any distance we wish to consider.
|
11
|
+
<br>\r\nFor example, B(<img src=\"images/symbol_radic.gif\" width=\"14\" height=\"16\"
|
12
|
+
alt=\"√\" border=\"0\" style=\"vertical-align:middle;\">3) = 6, B(<img src=\"images/symbol_radic.gif\"
|
13
|
+
width=\"14\" height=\"16\" alt=\"√\" border=\"0\" style=\"vertical-align:middle;\">21)
|
14
|
+
= 12 and B(111 111 111) = 54.</p>\r\n\r\n<p>Find the number of <var>L</var> <img
|
15
|
+
src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">
|
16
|
+
5·10<sup>11</sup> such that B(<var>L</var>) = 450.</p>\r\n"
|
@@ -0,0 +1,8 @@
|
|
1
|
+
---
|
2
|
+
:id: 355
|
3
|
+
:name: Maximal coprime subset
|
4
|
+
:url: http://projecteuler.net/problem=355
|
5
|
+
:content: "\r\n<p>\r\nDefine Co(<var>n</var>) to be the maximal possible sum of a
|
6
|
+
set of mutually co-prime elements from {1, 2, ..., <var>n</var>}.<br> For example
|
7
|
+
Co(10) is 30 and hits that maximum on the subset {1, 5, 7, 8, 9}.\r\n</p>\r\n\r\n<p>\r\nYou
|
8
|
+
are given that Co(30) = 193 and Co(100) = 1356. \r\n</p>\r\n\r\n<p>Find Co(200000).\r\n</p>\r\n\r\n"
|
@@ -0,0 +1,10 @@
|
|
1
|
+
---
|
2
|
+
:id: 356
|
3
|
+
:name: Largest roots of cubic polynomials
|
4
|
+
:url: http://projecteuler.net/problem=356
|
5
|
+
:content: "\r\n<p>\r\nLet <var>a</var><sub><var>n</var></sub> be the largest real
|
6
|
+
root of a polynomial <var>g</var>(x) = x<sup>3</sup> - 2<sup><var>n</var></sup>·x<sup>2</sup>
|
7
|
+
+ <var>n</var>.<br>\r\nFor example, <var>a</var><sub>2</sub> = 3.86619826...</p>\r\n\r\n<p>\r\nFind
|
8
|
+
the last eight digits of<img style=\"vertical-align:middle\" src=\"project/images/p_356_cubicpoly1.gif\">.</p>\r\n\r\n<p>\r\n<u><i>Note</i></u>:
|
9
|
+
<img style=\"vertical-align:middle\" src=\"project/images/p_356_cubicpoly2.gif\">
|
10
|
+
represents the floor function.</p>\r\n\r\n"
|
@@ -0,0 +1,9 @@
|
|
1
|
+
---
|
2
|
+
:id: 357
|
3
|
+
:name: Prime generating integers
|
4
|
+
:url: http://projecteuler.net/problem=357
|
5
|
+
:content: "\r\n<p>\r\nConsider the divisors of 30: 1,2,3,5,6,10,15,30.<br>\r\nIt can
|
6
|
+
be seen that for every divisor <var>d</var> of 30, <var>d</var>+30/<var>d</var>
|
7
|
+
is prime.\r\n</p>\r\n<p>\r\nFind the sum of all positive integers <var>n</var> not
|
8
|
+
exceeding 100 000 000<br>such that\r\nfor every divisor <var>d</var> of <var>n</var>,
|
9
|
+
<var>d</var>+<var>n</var>/<var>d</var> is prime.\r\n</p>\r\n\r\n"
|
@@ -0,0 +1,31 @@
|
|
1
|
+
---
|
2
|
+
:id: 358
|
3
|
+
:name: Cyclic numbers
|
4
|
+
:url: http://projecteuler.net/problem=358
|
5
|
+
:content: "\r\n<p>A <b>cyclic number</b> with <var>n</var> digits has a very interesting
|
6
|
+
property:<br>\r\nWhen it is multiplied by 1, 2, 3, 4, ... <var>n</var>, all the
|
7
|
+
products have exactly the same digits, in the same order, but rotated in a circular
|
8
|
+
fashion!\r\n</p>\r\n\r\n<p>\r\nThe smallest cyclic number is the 6-digit number
|
9
|
+
142857 :<br>\r\n142857 <img src=\"images/symbol_times.gif\" width=\"9\" height=\"9\"
|
10
|
+
alt=\"×\" border=\"0\" style=\"vertical-align:middle;\"> 1 = 142857<br>\r\n142857
|
11
|
+
<img src=\"images/symbol_times.gif\" width=\"9\" height=\"9\" alt=\"×\" border=\"0\"
|
12
|
+
style=\"vertical-align:middle;\"> 2 = 285714<br>\r\n142857 <img src=\"images/symbol_times.gif\"
|
13
|
+
width=\"9\" height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">
|
14
|
+
3 = 428571<br>\r\n142857 <img src=\"images/symbol_times.gif\" width=\"9\" height=\"9\"
|
15
|
+
alt=\"×\" border=\"0\" style=\"vertical-align:middle;\"> 4 = 571428<br>\r\n142857
|
16
|
+
<img src=\"images/symbol_times.gif\" width=\"9\" height=\"9\" alt=\"×\" border=\"0\"
|
17
|
+
style=\"vertical-align:middle;\"> 5 = 714285<br>\r\n142857 <img src=\"images/symbol_times.gif\"
|
18
|
+
width=\"9\" height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">
|
19
|
+
6 = 857142 \r\n</p>\r\n\r\n<p>\r\nThe next cyclic number is 0588235294117647 with
|
20
|
+
16 digits :<br>\r\n0588235294117647 <img src=\"images/symbol_times.gif\" width=\"9\"
|
21
|
+
height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\"> 1 = 0588235294117647<br>\r\n0588235294117647
|
22
|
+
<img src=\"images/symbol_times.gif\" width=\"9\" height=\"9\" alt=\"×\" border=\"0\"
|
23
|
+
style=\"vertical-align:middle;\"> 2 = 1176470588235294<br>\r\n0588235294117647 <img
|
24
|
+
src=\"images/symbol_times.gif\" width=\"9\" height=\"9\" alt=\"×\" border=\"0\"
|
25
|
+
style=\"vertical-align:middle;\"> 3 = 1764705882352941<br>\r\n...<br>\r\n0588235294117647
|
26
|
+
<img src=\"images/symbol_times.gif\" width=\"9\" height=\"9\" alt=\"×\" border=\"0\"
|
27
|
+
style=\"vertical-align:middle;\"> 16 = 9411764705882352\r\n</p>\r\n\r\n<p>\r\nNote
|
28
|
+
that for cyclic numbers, leading zeros are important.\r\n</p>\r\n\r\n<p>\r\nThere
|
29
|
+
is only one cyclic number for which, the eleven leftmost digits are 00000000137
|
30
|
+
and the five rightmost digits are 56789 (i.e., it has the form 00000000137...56789
|
31
|
+
with an unknown number of digits in the middle). Find the sum of all its digits.\r\n</p>\r\n\r\n"
|
@@ -0,0 +1,26 @@
|
|
1
|
+
---
|
2
|
+
:id: 359
|
3
|
+
:name: Hilbert's New Hotel
|
4
|
+
:url: http://projecteuler.net/problem=359
|
5
|
+
:content: "\r\n<p>\r\nAn infinite number of people (numbered 1, 2, 3, etc.) are lined
|
6
|
+
up to get a room at Hilbert's newest infinite hotel. The hotel contains an infinite
|
7
|
+
number of floors (numbered 1, 2, 3, etc.), and each floor contains an infinite number
|
8
|
+
of rooms (numbered 1, 2, 3, etc.). \r\n</p>\r\n\r\n<p>\r\nInitially the hotel is
|
9
|
+
empty. Hilbert declares a rule on how the <var>n</var><sup>th</sup> person is assigned
|
10
|
+
a room: person <var>n</var> gets the first vacant room in the lowest numbered floor
|
11
|
+
satisfying either of the following:\r\n</p>\n<ul>\n<li>the floor is empty</li>\r\n<li>the
|
12
|
+
floor is not empty, and if the latest person taking a room in that floor is person
|
13
|
+
<var>m</var>, then <var>m</var> + <var>n</var> is a perfect square</li>\r\n</ul>\n<p>\r\nPerson
|
14
|
+
1 gets room 1 in floor 1 since floor 1 is empty.\r\n<br>Person 2 does not get room
|
15
|
+
2 in floor 1 since 1 + 2 = 3 is not a perfect square.\r\n<br>Person 2 instead gets
|
16
|
+
room 1 in floor 2 since floor 2 is empty.\r\n<br>Person 3 gets room 2 in floor 1
|
17
|
+
since 1 + 3 = 4 is a perfect square.\r\n</p>\r\n\r\n<p>\r\nEventually, every person
|
18
|
+
in the line gets a room in the hotel.\r\n</p>\r\n\r\n<p>\r\nDefine P(<var>f</var>,
|
19
|
+
<var>r</var>) to be <var>n</var> if person <var>n</var> occupies room <var>r</var>
|
20
|
+
in floor <var>f</var>, and 0 if no person occupies the room. Here are a few examples:\r\n<br>P(1,
|
21
|
+
1) = 1\r\n<br>P(1, 2) = 3\r\n<br>P(2, 1) = 2\r\n<br>P(10, 20) = 440\r\n<br>P(25,
|
22
|
+
75) = 4863\r\n<br>P(99, 100) = 19454\r\n</p>\r\n\r\n<p>\r\nFind the sum of all P(<var>f</var>,
|
23
|
+
<var>r</var>) for all positive <var>f</var> and <var>r</var> such that <var>f</var>
|
24
|
+
<img src=\"images/symbol_times.gif\" width=\"9\" height=\"9\" alt=\"×\" border=\"0\"
|
25
|
+
style=\"vertical-align:middle;\"><var>r</var> = 71328803586048 and give the last
|
26
|
+
8 digits as your answer.\r\n</p>\r\n"
|
@@ -0,0 +1,8 @@
|
|
1
|
+
---
|
2
|
+
:id: 36
|
3
|
+
:name: Double-base palindromes
|
4
|
+
:url: http://projecteuler.net/problem=36
|
5
|
+
:content: "\r\n\n<p>The decimal number, 585 = 1001001001<sub>2</sub> (binary), is
|
6
|
+
palindromic in both bases.</p>\n<p>Find the sum of all numbers, less than one million,
|
7
|
+
which are palindromic in base 10 and base 2.</p>\n<p class=\"info\">(Please note
|
8
|
+
that the palindromic number, in either base, may not include leading zeros.)</p>\n\r\n"
|
@@ -0,0 +1,12 @@
|
|
1
|
+
---
|
2
|
+
:id: 360
|
3
|
+
:name: Scary Sphere
|
4
|
+
:url: http://projecteuler.net/problem=360
|
5
|
+
:content: "\r\n<p>\r\nGiven two points (x<sub>1</sub>,y<sub>1</sub>,z<sub>1</sub>)
|
6
|
+
and (x<sub>2</sub>,y<sub>2</sub>,z<sub>2</sub>) in three dimensional space, the
|
7
|
+
<b>Manhattan distance</b> between those points is defined as <br> |x<sub>1</sub>-x<sub>2</sub>|+|y<sub>1</sub>-y<sub>2</sub>|+|z<sub>1</sub>-z<sub>2</sub>|.\r\n</p>\r\n<p>\r\nLet
|
8
|
+
C(<var>r</var>) be a sphere with radius <var>r</var> and center in the origin O(0,0,0).<br>\r\nLet
|
9
|
+
I(<var>r</var>) be the set of all points with integer coordinates on the surface
|
10
|
+
of C(<var>r</var>).<br>\r\nLet S(<var>r</var>) be the sum of the Manhattan distances
|
11
|
+
of all elements of I(<var>r</var>) to the origin O.\r\n</p>\r\n<p>\r\nE.g. S(45)=34518.\r\n</p>\r\n<p>\r\nFind
|
12
|
+
S(10<sup>10</sup>).\r\n</p>\r\n\r\n\r\n\r\n"
|
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
:id: 361
|
3
|
+
:name: Subsequence of Thue-Morse sequence
|
4
|
+
:url: http://projecteuler.net/problem=361
|
5
|
+
:content: "\r\n<p>The <b>Thue-Morse sequence</b> {T<sub><var>n</var></sub>} is a binary
|
6
|
+
sequence satisfying:</p>\r\n<ul>\n<li>T<sub>0</sub> = 0</li>\r\n<li>T<sub>2<var>n</var></sub>
|
7
|
+
= T<sub><var>n</var></sub>\n</li>\r\n<li>T<sub>2<var>n</var>+1</sub> = 1 - T<sub><var>n</var></sub>\n</li>\r\n</ul>\n<p>\r\nThe
|
8
|
+
first several terms of {T<sub><var>n</var></sub>} are given as follows:<br>\r\n01101001<span
|
9
|
+
style=\"color:red;\">10010</span>1101001011001101001....\r\n</p>\r\n\r\n<p>\r\nWe
|
10
|
+
define {A<sub><var>n</var></sub>} as the sorted sequence of integers such that the
|
11
|
+
binary expression of each element appears as a subsequence in {T<sub><var>n</var></sub>}.<br>\r\nFor
|
12
|
+
example, the decimal number 18 is expressed as 10010 in binary. 10010 appears in
|
13
|
+
{T<sub><var>n</var></sub>} (T<sub>8</sub> to T<sub>12</sub>), so 18 is an element
|
14
|
+
of {A<sub><var>n</var></sub>}.<br>\r\nThe decimal number 14 is expressed as 1110
|
15
|
+
in binary. 1110 never appears in {T<sub><var>n</var></sub>}, so 14 is not an element
|
16
|
+
of {A<sub><var>n</var></sub>}.\r\n</p>\r\n\r\n<p>\r\nThe first several terms of
|
17
|
+
A<sub><var>n</var></sub> are given as follows:<br></p>\n<div align=\"center\">\r\n<table
|
18
|
+
cellspacing=\"1\" cellpadding=\"5\" border=\"0\" align=\"center\">\n<tr>\n<td align=\"left\"><var>n</var></td>\n<td>0</td>\n<td>1</td>\n<td>2</td>\n<td>3</td>\n<td>4</td>\n<td>5</td>\n<td>6</td>\n<td>7</td>\n<td>8</td>\n<td>9</td>\n<td>10</td>\n<td>11</td>\n<td>12</td>\n<td>…</td>\n</tr>\n<tr>\n<td>A<sub><var>n</var></sub>\n</td>\n<td>0</td>\n<td>1</td>\n<td>2</td>\n<td>3</td>\n<td>4</td>\n<td>5</td>\n<td>6</td>\n<td>9</td>\n<td>10</td>\n<td>11</td>\n<td>12</td>\n<td>13</td>\n<td>18</td>\n<td>…</td>\n</tr>\n</table>\n</div>\r\n\r\n\r\n<p>\r\nWe
|
19
|
+
can also verify that A<sub>100</sub> = 3251 and A<sub>1000</sub> = 80852364498.\r\n</p>\r\n\r\n<p>\r\nFind
|
20
|
+
the last 9 digits of <img style=\"vertical-align:middle\" src=\"project/images/p_361_Thue-Morse1.gif\">.\r\n</p>\r\n"
|
@@ -0,0 +1,32 @@
|
|
1
|
+
---
|
2
|
+
:id: 362
|
3
|
+
:name: Squarefree factors
|
4
|
+
:url: http://projecteuler.net/problem=362
|
5
|
+
:content: "\r\n<p>\r\nConsider the number 54.<br>\r\n54 can be factored in 7 distinct
|
6
|
+
ways into one or more factors larger than 1:<br>\r\n54, 2<img src=\"images/symbol_times.gif\"
|
7
|
+
width=\"9\" height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">27,
|
8
|
+
3<img src=\"images/symbol_times.gif\" width=\"9\" height=\"9\" alt=\"×\" border=\"0\"
|
9
|
+
style=\"vertical-align:middle;\">18, 6<img src=\"images/symbol_times.gif\" width=\"9\"
|
10
|
+
height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">9, 3<img src=\"images/symbol_times.gif\"
|
11
|
+
width=\"9\" height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">3<img
|
12
|
+
src=\"images/symbol_times.gif\" width=\"9\" height=\"9\" alt=\"×\" border=\"0\"
|
13
|
+
style=\"vertical-align:middle;\">6, 2<img src=\"images/symbol_times.gif\" width=\"9\"
|
14
|
+
height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">3<img src=\"images/symbol_times.gif\"
|
15
|
+
width=\"9\" height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">9
|
16
|
+
and 2<img src=\"images/symbol_times.gif\" width=\"9\" height=\"9\" alt=\"×\" border=\"0\"
|
17
|
+
style=\"vertical-align:middle;\">3<img src=\"images/symbol_times.gif\" width=\"9\"
|
18
|
+
height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">3<img src=\"images/symbol_times.gif\"
|
19
|
+
width=\"9\" height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">3.<br>\r\nIf
|
20
|
+
we require that the factors are all squarefree only two ways remain: 3<img src=\"images/symbol_times.gif\"
|
21
|
+
width=\"9\" height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">3<img
|
22
|
+
src=\"images/symbol_times.gif\" width=\"9\" height=\"9\" alt=\"×\" border=\"0\"
|
23
|
+
style=\"vertical-align:middle;\">6 and 2<img src=\"images/symbol_times.gif\" width=\"9\"
|
24
|
+
height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">3<img src=\"images/symbol_times.gif\"
|
25
|
+
width=\"9\" height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">3<img
|
26
|
+
src=\"images/symbol_times.gif\" width=\"9\" height=\"9\" alt=\"×\" border=\"0\"
|
27
|
+
style=\"vertical-align:middle;\">3.\r\n</p>\r\n<p>\r\nLet's call Fsf(<var>n</var>)
|
28
|
+
the number of ways <var>n</var> can be factored into one or more squarefree factors
|
29
|
+
larger than 1, so\r\nFsf(54)=2.\r\n</p>\r\n<p>\r\nLet S(<var>n</var>) be <img src=\"images/symbol_sum.gif\"
|
30
|
+
width=\"11\" height=\"14\" alt=\"∑\" border=\"0\" style=\"vertical-align:middle;\">Fsf(<var>k</var>)
|
31
|
+
for <var>k</var>=2 to <var>n</var>.\r\n</p>\r\n<p>\r\nS(100)=193.\r\n</p>\r\n<p>\r\nFind
|
32
|
+
S(10 000 000 000). \r\n</p>\r\n\r\n\r\n"
|
@@ -0,0 +1,33 @@
|
|
1
|
+
---
|
2
|
+
:id: 363
|
3
|
+
:name: Bézier Curves
|
4
|
+
:url: http://projecteuler.net/problem=363
|
5
|
+
:content: "\r\nA cubic Bézier curve is defined by four points: P<sub>0</sub>, P<sub>1</sub>,
|
6
|
+
P<sub>2</sub> and P<sub>3</sub>.\r\n<p>\r\n\r\nThe curve is constructed as follows:<br>\r\nOn
|
7
|
+
the segments P<sub>0</sub>P<sub>1</sub>, P<sub>1</sub>P<sub>2</sub> and P<sub>2</sub>P<sub>3</sub>
|
8
|
+
the points Q<sub>0</sub>,Q<sub>1</sub> and Q<sub>2</sub> are drawn such that P<sub>0</sub>Q<sub>0</sub>/P<sub>0</sub>P<sub>1</sub>=P<sub>1</sub>Q<sub>1</sub>/P<sub>1</sub>P<sub>2</sub>=P<sub>2</sub>Q<sub>2</sub>/P<sub>2</sub>P<sub>3</sub>=t
|
9
|
+
(t in [0,1]).<br>\r\nOn the segments Q<sub>0</sub>Q<sub>1</sub> and Q<sub>1</sub>Q<sub>2</sub>
|
10
|
+
the points R<sub>0</sub> and R<sub>1</sub> are drawn such that\r\nQ<sub>0</sub>R<sub>0</sub>/Q<sub>0</sub>Q<sub>1</sub>=Q<sub>1</sub>R<sub>1</sub>/Q<sub>1</sub>Q<sub>2</sub>=t
|
11
|
+
for the same value of t.<br>\r\nOn the segment R<sub>0</sub>R<sub>1</sub> the point
|
12
|
+
B is drawn such that R<sub>0</sub>B/R<sub>0</sub>R<sub>1</sub>=t for the same value
|
13
|
+
of t.\r\nThe Bézier curve defined by the points P<sub>0</sub>, P<sub>1</sub>, P<sub>2</sub>,
|
14
|
+
P<sub>3</sub> is the locus of B as Q<sub>0</sub> takes all possible positions on
|
15
|
+
the segment P<sub>0</sub>P<sub>1</sub>. (Please note that for all points the value
|
16
|
+
of t is the same.) \r\n<br></p>\r\n<p><applet code=\"CabriJava.class\" width=\"390\"
|
17
|
+
height=\"300\" align=\"right\" hspace=\"20\" archive=\"http://projecteuler.net/project/images/bezier/CabriJava.jar\">\r\n
|
18
|
+
\ <param name=\"lang\" value=\"en\">\n<param name=\"file\" value=\"http://projecteuler.net/project/images/bezier/bezier.fig\">\n<param
|
19
|
+
name=\"loop\" value=\"true\"></applet>\r\n</p>\r\n\r\n<p>\r\nIn the applet to the
|
20
|
+
right you can drag the points P<sub>0</sub>, P<sub>1</sub>, P<sub>2</sub> and P<sub>3</sub>
|
21
|
+
to see what the Bézier curve (green curve) defined by those points looks like.
|
22
|
+
You can also drag the point Q<sub>0</sub> along the segment P<sub>0</sub>P<sub>1</sub>.\r\n</p>\r\n<p>\r\nFrom
|
23
|
+
the construction it is clear that the Bézier curve will be tangent to the segments
|
24
|
+
P<sub>0</sub>P<sub>1</sub> in P<sub>0</sub> and P<sub>2</sub>P<sub>3</sub> in P<sub>3</sub>.\r\n</p>\r\n<p>\r\n<br><br><br></p>\r\n<p>\r\nA
|
25
|
+
cubic Bézier curve with P<sub>0</sub>=(1,0), P<sub>1</sub>=(1,<var>v</var>), P<sub>2</sub>=(<var>v</var>,1)
|
26
|
+
and P<sub>3</sub>=(0,1) is used to approximate a quarter circle.<br>\r\nThe value
|
27
|
+
<var>v</var><img src=\"images/symbol_gt.gif\" width=\"10\" height=\"10\" alt=\">\"
|
28
|
+
border=\"0\" style=\"vertical-align:middle;\">0 is chosen such that the area enclosed
|
29
|
+
by the lines OP<sub>0</sub>, OP<sub>3</sub> and the curve is equal to <sup>π</sup>/<sub>4</sub>
|
30
|
+
(the area of the quarter circle).\r\n</p>\r\n<p>\r\nBy how many percent does the
|
31
|
+
length of the curve differ from the length of the quarter circle?<br>\r\nThat is,
|
32
|
+
if L is the length of the curve, calculate 100*<sup>(L-π/2)</sup>/<sub>(π/2)</sub>.<br>\r\nGive
|
33
|
+
your answer rounded to 10 digits behind the decimal point.\r\n\r\n\r\n\r\n</p>"
|