euler-manager 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,15 @@
|
|
1
|
+
---
|
2
|
+
:id: 364
|
3
|
+
:name: Comfortable distance
|
4
|
+
:url: http://projecteuler.net/problem=364
|
5
|
+
:content: "\r\n<p>\r\nThere are <var>N</var> seats in a row. <var>N</var> people come
|
6
|
+
after each other to fill the seats according to the following rules:\r\n</p>\n<ol
|
7
|
+
type=\"1\">\n<li>If there is any seat whose adjacent seat(s) are not occupied take
|
8
|
+
such a seat.</li>\r\n<li>If there is no such seat and there is any seat for which
|
9
|
+
only one adjacent seat is occupied take such a seat.</li>\r\n<li>Otherwise take
|
10
|
+
one of the remaining available seats. </li>\r\n</ol>\r\nLet T(<var>N</var>) be the
|
11
|
+
number of possibilities that <var>N</var> seats are occupied by <var>N</var> people
|
12
|
+
with the given rules.<br> The following figure shows T(4)=8.\r\n\r\n\r\n<div align=\"center\">\r\n<img
|
13
|
+
src=\"project/images/p_364_comf_dist.gif\">\n</div>\r\n\r\n<p>We can verify that
|
14
|
+
T(10) = 61632 and T(1 000) mod 100 000 007 = 47255094.</p>\r\n<p>Find T(1 000 000)
|
15
|
+
mod 100 000 007.</p>\r\n"
|
@@ -0,0 +1,17 @@
|
|
1
|
+
---
|
2
|
+
:id: 365
|
3
|
+
:name: A huge binomial coefficient
|
4
|
+
:url: http://projecteuler.net/problem=365
|
5
|
+
:content: "\r\n<p>\r\nThe binomial coeffient C(10<sup>18</sup>,10<sup>9</sup>) is
|
6
|
+
a number with more than 9 billion (9<img src=\"images/symbol_times.gif\" width=\"9\"
|
7
|
+
height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">10<sup>9</sup>)
|
8
|
+
digits.\r\n</p>\r\n<p>\r\nLet M(n,k,m) denote the binomial coefficient C(n,k) modulo
|
9
|
+
m.\r\n</p>\r\n<p>\r\nCalculate <img src=\"images/symbol_sum.gif\" width=\"11\" height=\"14\"
|
10
|
+
alt=\"∑\" border=\"0\" style=\"vertical-align:middle;\">M(10<sup>18</sup>,10<sup>9</sup>,p*q*r)
|
11
|
+
for 1000<img src=\"images/symbol_lt.gif\" width=\"10\" height=\"10\" alt=\"<\"
|
12
|
+
border=\"0\" style=\"vertical-align:middle;\">p<img src=\"images/symbol_lt.gif\"
|
13
|
+
width=\"10\" height=\"10\" alt=\"<\" border=\"0\" style=\"vertical-align:middle;\">q<img
|
14
|
+
src=\"images/symbol_lt.gif\" width=\"10\" height=\"10\" alt=\"<\" border=\"0\"
|
15
|
+
style=\"vertical-align:middle;\">r<img src=\"images/symbol_lt.gif\" width=\"10\"
|
16
|
+
height=\"10\" alt=\"<\" border=\"0\" style=\"vertical-align:middle;\">5000 and
|
17
|
+
p,q,r prime.\r\n</p>\r\n\r\n\r\n\r\n\r\n"
|
@@ -0,0 +1,26 @@
|
|
1
|
+
---
|
2
|
+
:id: 366
|
3
|
+
:name: Stone Game III
|
4
|
+
:url: http://projecteuler.net/problem=366
|
5
|
+
:content: "\r\n<p>\r\nTwo players, Anton and Bernhard, are playing the following game.<br>\r\nThere
|
6
|
+
is one pile of n stones.<br>\r\nThe first player may remove any positive number
|
7
|
+
of stones, but not the whole pile.<br>\r\nThereafter, each player may remove at
|
8
|
+
most twice the number of stones his opponent took on the previous move.<br>\r\nThe
|
9
|
+
player who removes the last stone wins.\r\n</p>\r\n<p>\r\nE.g. n=5<br>\r\nIf the
|
10
|
+
first player takes anything more than one stone the next player will be able to
|
11
|
+
take all remaining stones.<br>\r\nIf the first player takes one stone, leaving four,
|
12
|
+
his opponent will take also one stone, leaving three stones.<br>\r\nThe first player
|
13
|
+
cannot take all three because he may take at most 2x1=2 stones. So let's say he
|
14
|
+
takes also one stone, leaving 2. The second player can take the two remaining stones
|
15
|
+
and wins.<br>\r\nSo 5 is a losing position for the first player.<br>\r\nFor some
|
16
|
+
winning positions there is more than one possible move for the first player.<br>\r\nE.g.
|
17
|
+
when n=17 the first player can remove one or four stones.\r\n</p>\r\n<p>\r\nLet
|
18
|
+
M(n) be the maximum number of stones the first player can take from a winning position
|
19
|
+
<i>at his first turn</i> and M(n)=0 for any other position.\r\n</p>\r\n<p>\r\n<img
|
20
|
+
src=\"images/symbol_sum.gif\" width=\"11\" height=\"14\" alt=\"∑\" border=\"0\"
|
21
|
+
style=\"vertical-align:middle;\">M(n) for n<img src=\"images/symbol_le.gif\" width=\"10\"
|
22
|
+
height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">100 is 728.\r\n</p>\r\n<p>\r\nFind
|
23
|
+
\ <img src=\"images/symbol_sum.gif\" width=\"11\" height=\"14\" alt=\"∑\" border=\"0\"
|
24
|
+
style=\"vertical-align:middle;\">M(n) for n<img src=\"images/symbol_le.gif\" width=\"10\"
|
25
|
+
height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">10<sup>18</sup>.\r\nGive
|
26
|
+
your answer modulo 10<sup>8</sup>.\r\n</p>\r\n"
|
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
:id: 367
|
3
|
+
:name: Bozo sort
|
4
|
+
:url: http://projecteuler.net/problem=367
|
5
|
+
:content: "\r\n<p>\r\n<b>Bozo sort</b>, not to be confused with the slightly less
|
6
|
+
efficient <b>bogo sort</b>, consists out of checking if the input sequence is sorted
|
7
|
+
and if not swapping randomly two elements. This is repeated until eventually the
|
8
|
+
sequence is sorted.\r\n</p>\r\n<p>\r\nIf we consider all permutations of the first
|
9
|
+
4 natural numbers as input the expectation value of the number of swaps, averaged
|
10
|
+
over all 4! input sequences is 24.75.<br>\r\nThe already sorted sequence takes 0
|
11
|
+
steps. \r\n</p>\r\n<p>\r\nIn this problem we consider the following variant on bozo
|
12
|
+
sort.<br>\r\nIf the sequence is not in order we pick three elements at random and
|
13
|
+
shuffle these three elements randomly.<br>\r\nAll 3!=6 permutations of those three
|
14
|
+
elements are equally likely. <br>\r\nThe already sorted sequence will take 0 steps.<br>\r\nIf
|
15
|
+
we consider all permutations of the first 4 natural numbers as input the expectation
|
16
|
+
value of the number of shuffles, averaged over all 4! input sequences is 27.5. <br>\r\nConsider
|
17
|
+
as input sequences the permutations of the first 11 natural numbers.<br>\r\nAveraged
|
18
|
+
over all 11! input sequences, what is the expected number of shuffles this sorting
|
19
|
+
algorithm will perform?\r\n</p>\r\n<p>\r\nGive your answer rounded to the nearest
|
20
|
+
integer.\r\n</p>\r\n"
|
@@ -0,0 +1,39 @@
|
|
1
|
+
---
|
2
|
+
:id: 368
|
3
|
+
:name: A Kempner-like series
|
4
|
+
:url: http://projecteuler.net/problem=368
|
5
|
+
:content: "\r\n<p>\r\n</p>\n<table><tr>\n<td>The <b> harmonic series </b> 1</td>\r\n
|
6
|
+
\ <td>+</td>\n<td><table class=\"frac\">\n<tr><td>1</td></tr>\n<tr><td class=\"overline\">2</td></tr>\n</table></td>\r\n
|
7
|
+
\ <td>+</td>\r\n <td><table class=\"frac\">\n<tr><td>1</td></tr>\n<tr><td class=\"overline\">3</td></tr>\n</table></td>\r\n
|
8
|
+
\ <td>+</td>\r\n <td><table class=\"frac\">\n<tr><td>1</td></tr>\n<tr><td class=\"overline\">4</td></tr>\n</table></td>\r\n
|
9
|
+
\ <td>+ ... is well known to be divergent. </td>\r\n</tr></table>\n<p>\r\nIf we
|
10
|
+
however omit from this series every term where the denominator has a 9 in it, the
|
11
|
+
series remarkably enough converges to approximately 22.9206766193.<br>\r\nThis modified
|
12
|
+
harmonic series is called the <b>Kempner</b> series.\r\n</p>\r\n<p>\r\nLet us now
|
13
|
+
consider another modified harmonic series by omitting from the harmonic series every
|
14
|
+
term where the denominator has 3 or more equal consecutive digits.\r\nOne can verify
|
15
|
+
that out of the first 1200 terms of the harmonic series, only 20 terms will be omitted.<br>\r\nThese
|
16
|
+
20 omitted terms are:\r\n</p>\r\n<table>\n<td><table class=\"frac\" style=\"text-align:center;\">\n<tr><td>1</td></tr>\n<tr><td
|
17
|
+
class=\"overline\">111</td></tr>\n</table></td>\r\n<td>,</td>\r\n<td><table class=\"frac\"
|
18
|
+
style=\"text-align:center;\">\n<tr><td>1</td></tr>\n<tr><td class=\"overline\">222</td></tr>\n</table></td>\r\n<td>,</td>\r\n<td><table
|
19
|
+
class=\"frac\" style=\"text-align:center;\">\n<tr><td>1</td></tr>\n<tr><td class=\"overline\">333</td></tr>\n</table></td>\r\n<td>,</td>\r\n<td><table
|
20
|
+
class=\"frac\" style=\"text-align:center;\">\n<tr><td>1</td></tr>\n<tr><td class=\"overline\">444</td></tr>\n</table></td>\r\n<td>,</td>\r\n<td><table
|
21
|
+
class=\"frac\" style=\"text-align:center;\">\n<tr><td>1</td></tr>\n<tr><td class=\"overline\">555</td></tr>\n</table></td>\r\n<td>,</td>\r\n<td><table
|
22
|
+
class=\"frac\" style=\"text-align:center;\">\n<tr><td>1</td></tr>\n<tr><td class=\"overline\">666</td></tr>\n</table></td>\r\n<td>,</td>\r\n<td><table
|
23
|
+
class=\"frac\" style=\"text-align:center;\">\n<tr><td>1</td></tr>\n<tr><td class=\"overline\">777</td></tr>\n</table></td>\r\n<td>,</td>\r\n<td><table
|
24
|
+
class=\"frac\" style=\"text-align:center;\">\n<tr><td>1</td></tr>\n<tr><td class=\"overline\">888</td></tr>\n</table></td>\r\n<td>,</td>\r\n<td><table
|
25
|
+
class=\"frac\" style=\"text-align:center;\">\n<tr><td>1</td></tr>\n<tr><td class=\"overline\">999</td></tr>\n</table></td>\r\n<td>,</td>\r\n<td><table
|
26
|
+
class=\"frac\" style=\"text-align:center;\">\n<tr><td>1</td></tr>\n<tr><td class=\"overline\">1000</td></tr>\n</table></td>\r\n<td>,</td>\r\n<td><table
|
27
|
+
class=\"frac\" style=\"text-align:center;\">\n<tr><td>1</td></tr>\n<tr><td class=\"overline\">1110</td></tr>\n</table></td>\r\n<td>,</td>\r\n</table>\n<table>\n<td><table
|
28
|
+
class=\"frac\" style=\"text-align:center;\">\n<tr><td>1</td></tr>\n<tr><td class=\"overline\">1111</td></tr>\n</table></td>\r\n<td>,</td>\r\n<td><table
|
29
|
+
class=\"frac\" style=\"text-align:center;\">\n<tr><td>1</td></tr>\n<tr><td class=\"overline\">1112</td></tr>\n</table></td>\r\n<td>,</td>\r\n<td><table
|
30
|
+
class=\"frac\" style=\"text-align:center;\">\n<tr><td>1</td></tr>\n<tr><td class=\"overline\">1113</td></tr>\n</table></td>\r\n<td>,</td>\r\n<td><table
|
31
|
+
class=\"frac\" style=\"text-align:center;\">\n<tr><td>1</td></tr>\n<tr><td class=\"overline\">1114</td></tr>\n</table></td>\r\n<td>,</td>\r\n<td><table
|
32
|
+
class=\"frac\" style=\"text-align:center;\">\n<tr><td>1</td></tr>\n<tr><td class=\"overline\">1115</td></tr>\n</table></td>\r\n<td>,</td>\r\n<td><table
|
33
|
+
class=\"frac\" style=\"text-align:center;\">\n<tr><td>1</td></tr>\n<tr><td class=\"overline\">1116</td></tr>\n</table></td>\r\n<td>,</td>\r\n<td><table
|
34
|
+
class=\"frac\" style=\"text-align:center;\">\n<tr><td>1</td></tr>\n<tr><td class=\"overline\">1117</td></tr>\n</table></td>\r\n<td>,</td>\r\n<td><table
|
35
|
+
class=\"frac\" style=\"text-align:center;\">\n<tr><td>1</td></tr>\n<tr><td class=\"overline\">1118</td></tr>\n</table></td>\r\n<td>
|
36
|
+
and </td>\r\n<td><table class=\"frac\" style=\"text-align:center;\">\n<tr><td>1</td></tr>\n<tr><td
|
37
|
+
class=\"overline\">1119</td></tr>\n</table></td>\r\n<td>.</td>\r\n\r\n</table>\n<p>\r\nThis
|
38
|
+
series converges as well.\r\n</p>\r\n<p> \r\nFind the value the series converges
|
39
|
+
to.<br>\r\nGive your answer rounded to 10 digits behind the decimal point.\r\n</p>\r\n\r\n\r\n"
|
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
:id: 369
|
3
|
+
:name: "Badugi\r\n"
|
4
|
+
:url: http://projecteuler.net/problem=369
|
5
|
+
:content: "\r\n<p>In a standard 52 card deck of playing cards, a set of 4 cards is
|
6
|
+
a <b>Badugi</b> if it contains 4 cards with no pairs and no two cards of the same
|
7
|
+
suit.</p>\r\n\r\n<p>Let f(<var>n</var>) be the number of ways to choose <var>n</var>
|
8
|
+
cards with a 4 card subset that is a Badugi. For example, there are 2598960 ways
|
9
|
+
to choose five cards from a standard 52 card deck, of which 514800 contain a 4 card
|
10
|
+
subset that is a Badugi, so f(5) = 514800.</p>\r\n\r\n<p>Find <img src=\"images/symbol_sum.gif\"
|
11
|
+
width=\"11\" height=\"14\" alt=\"∑\" border=\"0\" style=\"vertical-align:middle;\">f(<var>n</var>)
|
12
|
+
\ for 4 <img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
13
|
+
style=\"vertical-align:middle;\"><var>n</var> <img src=\"images/symbol_le.gif\"
|
14
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">
|
15
|
+
13.</p>\r\n\r\n"
|
@@ -0,0 +1,10 @@
|
|
1
|
+
---
|
2
|
+
:id: 37
|
3
|
+
:name: Truncatable primes
|
4
|
+
:url: http://projecteuler.net/problem=37
|
5
|
+
:content: "\r\n\n<p>The number 3797 has an interesting property. Being prime itself,
|
6
|
+
it is possible to continuously remove digits from left to right, and remain prime
|
7
|
+
at each stage: 3797, 797, 97, and 7. Similarly we can work from right to left: 3797,
|
8
|
+
379, 37, and 3.</p>\n<p>Find the sum of the only eleven primes that are both truncatable
|
9
|
+
from left to right and right to left.</p>\n<p class=\"info\">NOTE: 2, 3, 5, and
|
10
|
+
7 are not considered to be truncatable primes.</p>\n\r\n"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
---
|
2
|
+
:id: 370
|
3
|
+
:name: "Geometric triangles\r\n"
|
4
|
+
:url: http://projecteuler.net/problem=370
|
5
|
+
:content: "\r\n<p>Let us define a <i>geometric triangle</i> as an integer sided triangle
|
6
|
+
with sides <var>a</var> <img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\"
|
7
|
+
alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>b</var> <img src=\"images/symbol_le.gif\"
|
8
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>c</var>
|
9
|
+
so that its sides form a <b>geometric progression</b>, i.e. <var>b<sup>2</sup></var> = <var>a</var> · <var>c</var> . </p>
|
10
|
+
\r\n\r\n<p>An example of such a geometric triangle is the triangle with sides <var>a</var>
|
11
|
+
= 144, <var>b</var> = 156 and <var>c</var> = 169.</p>\r\n\r\n<p>There are 861805
|
12
|
+
geometric triangles with perimeter <img src=\"images/symbol_le.gif\" width=\"10\"
|
13
|
+
height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"> 10<sup>6</sup>
|
14
|
+
.</p>\r\n\r\n<p>How many geometric triangles exist with perimeter <img src=\"images/symbol_le.gif\"
|
15
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">
|
16
|
+
2.5·10<sup>13</sup> ?</p>\r\n\r\n"
|
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
:id: 371
|
3
|
+
:name: Licence plates
|
4
|
+
:url: http://projecteuler.net/problem=371
|
5
|
+
:content: "\r\n<p>\r\nOregon licence plates consist of three letters followed by a
|
6
|
+
three digit number (each digit can be from [0..9]).<br>\r\nWhile driving to work
|
7
|
+
Seth plays the following game:<br>\r\nWhenever the numbers of two licence plates
|
8
|
+
seen on his trip add to 1000 that's a win.\r\n</p>\r\n<p>\r\nE.g. MIC-012 and HAN-988
|
9
|
+
is a win and RYU-500 and SET-500 too. (as long as he sees them in the same trip).
|
10
|
+
\r\n</p>\n<p>\r\n</p>\n<p>\r\nFind the expected number of plates he needs to see
|
11
|
+
for a win.<br>\r\nGive your answer rounded to 8 decimal places behind the decimal
|
12
|
+
point.\r\n</p>\r\n<p style=\"font-size:88%\">\r\n<b>Note:</b> We assume that each
|
13
|
+
licence plate seen is equally likely to have any three digit number on it.\r\n</p>\r\n\r\n\r\n\r\n\r\n"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
---
|
2
|
+
:id: 372
|
3
|
+
:name: Pencils of rays
|
4
|
+
:url: http://projecteuler.net/problem=372
|
5
|
+
:content: "\r\n<p>\r\nLet R(<var>M</var>, <var>N</var>) be the number of lattice points
|
6
|
+
(<var>x</var>, <var>y</var>) which satisfy <var>M</var><img src=\"images/symbol_lt.gif\"
|
7
|
+
width=\"10\" height=\"10\" alt=\"<\" border=\"0\" style=\"vertical-align:middle;\"><var>x</var><img
|
8
|
+
src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>N</var>,
|
9
|
+
<var>M</var><img src=\"images/symbol_lt.gif\" width=\"10\" height=\"10\" alt=\"<\"
|
10
|
+
border=\"0\" style=\"vertical-align:middle;\"><var>y</var><img src=\"images/symbol_le.gif\"
|
11
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>N</var>
|
12
|
+
and <img style=\"vertical-align:middle\" src=\"project/images/p_372_pencilray1.jpg\">
|
13
|
+
is odd.<br>\r\nWe can verify that R(0, 100) = 3019 and R(100, 10000) = 29750422.<br>\r\nFind
|
14
|
+
R(2·10<sup>6</sup>, 10<sup>9</sup>).\r\n</p>\r\n\r\n<p>\r\n<u><i>Note</i></u>: <img
|
15
|
+
style=\"vertical-align:middle\" src=\"project/images/p_372_pencilray2.gif\"> represents
|
16
|
+
the floor function.</p>\r\n\r\n"
|
@@ -0,0 +1,10 @@
|
|
1
|
+
---
|
2
|
+
:id: 373
|
3
|
+
:name: Circumscribed Circles
|
4
|
+
:url: http://projecteuler.net/problem=373
|
5
|
+
:content: "\r\n<p>\r\nEvery triangle has a circumscribed circle that goes through
|
6
|
+
the three vertices.\r\nConsider all integer sided triangles for which the radius
|
7
|
+
of the circumscribed circle is integral as well.\r\n</p>\r\n<p>\r\nLet S(<var>n</var>)
|
8
|
+
be the sum of the radii of the circumscribed circles of all such triangles for which
|
9
|
+
the radius does not exceed <var>n</var>.\r\n</p>\r\n<p>S(100)=4950 and S(1200)=1653605.\r\n</p>\r\n<p>\r\nFind
|
10
|
+
S(10<sup>7</sup>).\r\n</p>\r\n\r\n"
|
@@ -0,0 +1,25 @@
|
|
1
|
+
---
|
2
|
+
:id: 374
|
3
|
+
:name: "Maximum Integer Partition Product\r\n"
|
4
|
+
:url: http://projecteuler.net/problem=374
|
5
|
+
:content: "\r\n<p>An integer partition of a number <var>n</var> is a way of writing
|
6
|
+
<var>n</var> as a sum of positive integers.</p>\r\n\r\n<p>Partitions that differ
|
7
|
+
only in the order of their summands are considered the same.\r\nA partition of <var>n</var>
|
8
|
+
into <b>distinct parts</b> is a partition of <var>n</var> in which every part occurs
|
9
|
+
at most once.</p>\r\n\r\n<p>The partitions of 5 into distinct parts are:\r\n<br>5,
|
10
|
+
4+1 and 3+2.</p>\r\n\r\n<p>Let f(<var>n</var>) be the maximum product of the parts
|
11
|
+
of any such partition of <var>n</var> into distinct parts and let m(<var>n</var>)
|
12
|
+
be the number of elements of any such partition of <var>n</var> with that product.</p>\r\n\r\n<p>So
|
13
|
+
f(5)=6 and m(5)=2.</p>\r\n\r\n<p>For <var>n</var>=10 the partition with the largest
|
14
|
+
product is 10=2+3+5, which gives f(10)=30 and m(10)=3.\r\n<br>And their product,
|
15
|
+
f(10)·m(10) = 30·3 = 90</p>\r\n\r\n<p>It can be verified that\r\n<br><img src=\"images/symbol_sum.gif\"
|
16
|
+
width=\"11\" height=\"14\" alt=\"∑\" border=\"0\" style=\"vertical-align:middle;\">f(<var>n</var>)·m(<var>n</var>)
|
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
|
+
100 = 1683550844462.</p>\r\n\r\n<p>Find <img src=\"images/symbol_sum.gif\" width=\"11\"
|
21
|
+
height=\"14\" alt=\"∑\" border=\"0\" style=\"vertical-align:middle;\">f(<var>n</var>)·m(<var>n</var>)
|
22
|
+
for 1 <img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
23
|
+
style=\"vertical-align:middle;\"><var>n</var> <img src=\"images/symbol_le.gif\"
|
24
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">
|
25
|
+
10<sup>14</sup>.\r\n<br>Give your answer modulo 982451653, the 50 millionth prime.</p>\r\n\r\n"
|
@@ -0,0 +1,23 @@
|
|
1
|
+
---
|
2
|
+
:id: 375
|
3
|
+
:name: Minimum of subsequences
|
4
|
+
:url: http://projecteuler.net/problem=375
|
5
|
+
:content: "\r\n<style type=\"text/css\">\r\ntable.p375 td {\r\n padding: 0px 3px
|
6
|
+
0px 3px;\r\n vertical-align: bottom;\r\n text-align: left;\r\n}\r\n</style>\n<p>Let
|
7
|
+
<var>S</var><sub><var>n</var></sub> be an integer sequence produced with the following
|
8
|
+
pseudo-random number generator:</p>\r\n<center><table class=\"p375\">\n<tr>\n<td
|
9
|
+
style=\"text-align:right\">\n<var>S</var><sub>0</sub>\n</td>\r\n <td>=<sub> </sub>\n</td>\r\n
|
10
|
+
\ <td>290797<sub> </sub>\n</td>\r\n </tr>\n<tr>\n<td>\n<var>S</var><sub><var>n</var>+1</sub>\n</td>\r\n
|
11
|
+
\ <td>=<sub> </sub>\n</td>\r\n <td>\n<var>S</var><sub><var>n</var></sub><sup>2</sup>
|
12
|
+
mod 50515093</td>\r\n </tr>\n</table></center>\r\n\r\n<p>\r\nLet A(<var>i</var>,
|
13
|
+
<var>j</var>) be the minimum of the numbers <var>S</var><sub><var>i</var></sub>,
|
14
|
+
<var>S</var><sub><var>i</var>+1</sub>, ... , <var>S</var><sub><var>j</var></sub>
|
15
|
+
for <var>i</var> <img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\"
|
16
|
+
border=\"0\" style=\"vertical-align:middle;\"><var>j</var>.<br>\r\nLet M(<var>N</var>)
|
17
|
+
= ΣA(<var>i</var>, <var>j</var>) for 1 <img src=\"images/symbol_le.gif\" width=\"10\"
|
18
|
+
height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>i</var>
|
19
|
+
<img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
20
|
+
style=\"vertical-align:middle;\"><var>j</var> <img src=\"images/symbol_le.gif\"
|
21
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>N</var>.<br>\r\nWe
|
22
|
+
can verify that M(10) = 432256955 and M(10 000) = 3264567774119.</p>\r\n\r\n<p>\r\nFind
|
23
|
+
M(2 000 000 000).\r\n</p>\r\n"
|
@@ -0,0 +1,25 @@
|
|
1
|
+
---
|
2
|
+
:id: 376
|
3
|
+
:name: Nontransitive sets of dice
|
4
|
+
:url: http://projecteuler.net/problem=376
|
5
|
+
:content: "\r\n<p>\r\nConsider the following set of dice with nonstandard pips:\r\n</p>\r\n\r\n<p>\r\nDie
|
6
|
+
A: 1 4 4 4 4 4<br>\r\nDie B: 2 2 2 5 5 5<br>\r\nDie C: 3 3 3 3 3 6<br></p>\r\n\r\n<p>\r\nA
|
7
|
+
game is played by two players picking a die in turn and rolling it. The player who
|
8
|
+
rolls the highest value wins.\r\n</p>\r\n\r\n<p>\r\nIf the first player picks die
|
9
|
+
A and the second player picks die B we get<br>\r\nP(second player wins) = <sup>7</sup>/<sub>12</sub>
|
10
|
+
> <sup>1</sup>/<sub>2</sub></p>\r\n\r\n<p>\r\nIf the first player picks die B
|
11
|
+
and the second player picks die C we get<br>\r\nP(second player wins) = <sup>7</sup>/<sub>12</sub>
|
12
|
+
> <sup>1</sup>/<sub>2</sub></p>\r\n\r\n<p>\r\nIf the first player picks die C
|
13
|
+
and the second player picks die A we get<br>\r\nP(second player wins) = <sup>25</sup>/<sub>36</sub>
|
14
|
+
> <sup>1</sup>/<sub>2</sub></p>\r\n\r\n<p>\r\nSo whatever die the first player
|
15
|
+
picks, the second player can pick another die and have a larger than 50% chance
|
16
|
+
of winning.<br>\r\nA set of dice having this property is called a <b>nontransitive
|
17
|
+
set of dice</b>.\r\n</p>\r\n\r\n<p>\r\nWe wish to investigate how many sets of nontransitive
|
18
|
+
dice exist. We will assume the following conditions:</p>\n<ul>\n<li>There are three
|
19
|
+
six-sided dice with each side having between 1 and <var>N</var> pips, inclusive.</li>\r\n<li>Dice
|
20
|
+
with the same set of pips are equal, regardless of which side on the die the pips
|
21
|
+
are located.</li>\r\n<li>The same pip value may appear on multiple dice; if both
|
22
|
+
players roll the same value neither player wins.</li>\r\n<li>The sets of dice {A,B,C},
|
23
|
+
{B,C,A} and {C,A,B} are the same set.</li>\r\n</ul>\n<p>\r\nFor <var>N</var> = 7
|
24
|
+
we find there are 9780 such sets.<br>\r\nHow many are there for <var>N</var> = 30
|
25
|
+
?\r\n</p>\r\n"
|
@@ -0,0 +1,11 @@
|
|
1
|
+
---
|
2
|
+
:id: 377
|
3
|
+
:name: Sum of digits, experience 13
|
4
|
+
:url: http://projecteuler.net/problem=377
|
5
|
+
:content: "\r\n<p>\r\nThere are 16 positive integers that do not have a zero in their
|
6
|
+
digits and that have a digital sum equal to 5, namely: <br>\r\n5, 14, 23, 32, 41,
|
7
|
+
113, 122, 131, 212, 221, 311, 1112, 1121, 1211, 2111 and 11111.<br>\r\nTheir sum
|
8
|
+
is 17891.\r\n</p>\r\n<p>\r\nLet <var>f</var>(<var>n</var>) be the sum of all positive
|
9
|
+
integers that do not have a zero in their digits and have a digital sum equal to
|
10
|
+
<var>n</var>.\r\n</p>\r\n<p>\r\nFind <img src=\"project/images/sod_13.gif\" style=\"margin-top:-8px;\">.<br>\r\nGive
|
11
|
+
the last 9 digits as your answer.\r\n</p>\r\n\r\n"
|
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
:id: 378
|
3
|
+
:name: Triangle Triples
|
4
|
+
:url: http://projecteuler.net/problem=378
|
5
|
+
:content: "\r\n<p>\r\n</p>\n<table class=\"formula\"><tr>\n<td>\r\nLet T(<var>n</var>)
|
6
|
+
be the <var>n</var><sup>th</sup> triangle number, so T(<var>n</var>) =\r\n</td>\r\n<td>\r\n<table
|
7
|
+
class=\"frac\" style=\"font-size: smaller\">\n<tr><td>\n<var>n</var> (<var>n</var>+1)</td></tr>\n<tr><td
|
8
|
+
class=\"overline\" text-align:center>2</td></tr>\n</table>\n</td>\r\n<td>\r\n.\r\n</td>\r\n</tr></table>\n<p>\r\nLet
|
9
|
+
dT(<var>n</var>) be the number of divisors of T(<var>n</var>).<br>\r\nE.g.:\r\nT(7)
|
10
|
+
= 28 and dT(7) = 6.\r\n</p>\r\n<p>\r\nLet Tr(<var>n</var>) be the number of triples
|
11
|
+
(<var>i</var>, <var>j</var>, <var>k</var>) such that 1 <img src=\"images/symbol_le.gif\"
|
12
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>i
|
13
|
+
\ n</var> and dT(<var>i</var>) > dT(<var>j</var>) > dT(<var>k</var>).<br>\r\nTr(20)
|
14
|
+
= 14, Tr(100) = 5772 and Tr(1000) = 11174776.\r\n</p>\r\n<p>\r\nFind Tr(60 000 000).
|
15
|
+
<br>\r\nGive the last 18 digits of your answer.\r\n</p>\r\n\r\n"
|
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
:id: 379
|
3
|
+
:name: Least common multiple count
|
4
|
+
:url: http://projecteuler.net/problem=379
|
5
|
+
:content: "\r\n<p>\r\nLet <var>f</var>(<var>n</var>) be the number of couples (<var>x</var>,<var>y</var>)
|
6
|
+
with <var>x</var> and <var>y</var> positive integers, <var>x</var> <img src=\"images/symbol_le.gif\"
|
7
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>y</var>
|
8
|
+
and the least common multiple of <var>x</var> and <var>y</var> equal to <var>n</var>.\r\n</p>\r\n<p>\r\nLet
|
9
|
+
<var>g</var> be the <b>summatory function</b> of <var>f</var>, i.e.: \r\n<var>g</var>(<var>n</var>)
|
10
|
+
= <img src=\"images/symbol_sum.gif\" width=\"11\" height=\"14\" alt=\"∑\" border=\"0\"
|
11
|
+
style=\"vertical-align:middle;\"><var>f</var>(<var>i</var>) for 1 <img src=\"images/symbol_le.gif\"
|
12
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>i</var>
|
13
|
+
<img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
14
|
+
style=\"vertical-align:middle;\"><var>n</var>.\r\n</p>\n<p>\r\n</p>\n<p>\r\nYou
|
15
|
+
are given that <var>g</var>(10<sup>6</sup>) = 37429395.\r\n</p>\r\n<p>\r\nFind <var>g</var>(10<sup>12</sup>).\r\n</p>\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
|
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
:id: 38
|
3
|
+
:name: Pandigital multiples
|
4
|
+
:url: http://projecteuler.net/problem=38
|
5
|
+
:content: "\r\n<p>Take the number 192 and multiply it by each of 1, 2, and 3:</p>\r\n<blockquote>192
|
6
|
+
<img src=\"images/symbol_times.gif\" width=\"9\" height=\"9\" alt=\"×\" border=\"0\"
|
7
|
+
style=\"vertical-align:middle;\"> 1 = 192<br>\r\n192 <img src=\"images/symbol_times.gif\"
|
8
|
+
width=\"9\" height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">
|
9
|
+
2 = 384<br>\r\n192 <img src=\"images/symbol_times.gif\" width=\"9\" height=\"9\"
|
10
|
+
alt=\"×\" border=\"0\" style=\"vertical-align:middle;\"> 3 = 576</blockquote>\r\n<p>By
|
11
|
+
concatenating each product we get the 1 to 9 pandigital, 192384576. We will call
|
12
|
+
192384576 the concatenated product of 192 and (1,2,3)</p>\r\n<p>The same can be
|
13
|
+
achieved by starting with 9 and multiplying by 1, 2, 3, 4, and 5, giving the pandigital,
|
14
|
+
918273645, which is the concatenated product of 9 and (1,2,3,4,5).</p>\r\n<p>What
|
15
|
+
is the largest 1 to 9 pandigital 9-digit number that can be formed as the concatenated
|
16
|
+
product of an integer with (1,2, ... , <var>n</var>) where <var>n</var> <img src=\"images/symbol_gt.gif\"
|
17
|
+
width=\"10\" height=\"10\" alt=\">\" border=\"0\" style=\"vertical-align:middle;\">
|
18
|
+
1?</p>\r\n\r\n"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
:id: 380
|
3
|
+
:name: Amazing Mazes!
|
4
|
+
:url: http://projecteuler.net/problem=380
|
5
|
+
:content: "\r\n<p>\r\nAn m<img src=\"images/symbol_times.gif\" width=\"9\" height=\"9\"
|
6
|
+
alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">n maze is an m<img src=\"images/symbol_times.gif\"
|
7
|
+
width=\"9\" height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">n
|
8
|
+
rectangular grid with walls placed between grid cells such that there is exactly
|
9
|
+
one path from the top-left square to any other square. <br>The following are examples
|
10
|
+
of a 9<img src=\"images/symbol_times.gif\" width=\"9\" height=\"9\" alt=\"×\" border=\"0\"
|
11
|
+
style=\"vertical-align:middle;\">12 maze and a 15<img src=\"images/symbol_times.gif\"
|
12
|
+
width=\"9\" height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">20
|
13
|
+
maze:\r\n</p>\r\n<p>\r\n<img src=\"project/images/p_380_mazes.gif\"></p>\r\n<p>\r\nLet
|
14
|
+
C(m,n) be the number of distinct m<img src=\"images/symbol_times.gif\" width=\"9\"
|
15
|
+
height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">n mazes. Mazes
|
16
|
+
which can be formed by rotation and reflection from another maze are considered
|
17
|
+
distinct.\r\n</p>\r\n<p>\r\nIt can be verified that C(1,1) = 1, C(2,2) = 4, C(3,4)
|
18
|
+
= 2415, and C(9,12) = 2.5720e46 (in scientific notation rounded to 5 significant
|
19
|
+
digits).<br>\r\nFind C(100,500) and write your answer in scientific notation rounded
|
20
|
+
to 5 significant digits.\r\n</p>\r\n<p>\r\nWhen giving your answer, use a lowercase
|
21
|
+
e to separate mantissa and exponent.\r\nE.g. if the answer is 1234567891011 then
|
22
|
+
the answer format would be 1.2346e12.\r\n\r\n</p> \r\n\r\n\r\n\r\n\r\n"
|
@@ -0,0 +1,21 @@
|
|
1
|
+
---
|
2
|
+
:id: 381
|
3
|
+
:name: "(prime-k) factorial"
|
4
|
+
:url: http://projecteuler.net/problem=381
|
5
|
+
:content: "\r\n<p>\r\nFor a prime p let S(p) = (<img src=\"images/symbol_sum.gif\"
|
6
|
+
width=\"11\" height=\"14\" alt=\"∑\" border=\"0\" style=\"vertical-align:middle;\">(p-k)!)
|
7
|
+
mod(p) for 1 <img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\"
|
8
|
+
border=\"0\" style=\"vertical-align:middle;\"> k <img src=\"images/symbol_le.gif\"
|
9
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">
|
10
|
+
5.\r\n</p>\r\n<p>\r\nFor example, if p=7,<br>\r\n(7-1)! + (7-2)! + (7-3)! + (7-4)!
|
11
|
+
+ (7-5)! = 6! + 5! + 4! + 3! + 2! = 720+120+24+6+2 = 872.<br> \r\nAs 872 mod(7)
|
12
|
+
= 4, S(7) = 4.\r\n</p>\r\n<p>\r\nIt can be verified that <img src=\"images/symbol_sum.gif\"
|
13
|
+
width=\"11\" height=\"14\" alt=\"∑\" border=\"0\" style=\"vertical-align:middle;\">S(p)
|
14
|
+
= 480 for 5 <img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\"
|
15
|
+
border=\"0\" style=\"vertical-align:middle;\"> p <img src=\"images/symbol_lt.gif\"
|
16
|
+
width=\"10\" height=\"10\" alt=\"<\" border=\"0\" style=\"vertical-align:middle;\">
|
17
|
+
100.\r\n</p>\r\n<p>\r\nFind <img src=\"images/symbol_sum.gif\" width=\"11\" height=\"14\"
|
18
|
+
alt=\"∑\" border=\"0\" style=\"vertical-align:middle;\">S(p) for 5 <img src=\"images/symbol_le.gif\"
|
19
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">
|
20
|
+
p <img src=\"images/symbol_lt.gif\" width=\"10\" height=\"10\" alt=\"<\" border=\"0\"
|
21
|
+
style=\"vertical-align:middle;\"> 10<sup>8</sup>.\r\n</p>\r\n\r\n\r\n\r\n"
|
@@ -0,0 +1,23 @@
|
|
1
|
+
---
|
2
|
+
:id: 382
|
3
|
+
:name: Generating polygons
|
4
|
+
:url: http://projecteuler.net/problem=382
|
5
|
+
:content: "\r\n<p>\r\nA <b>polygon</b> is a flat shape consisting of straight line
|
6
|
+
segments that are joined to form a closed chain or circuit. A polygon consists of
|
7
|
+
at least three sides and does not self-intersect.\r\n</p>\r\n\r\n<p>\r\nA set S
|
8
|
+
of positive numbers is said to <i>generate a polygon</i> P if:</p>\n<ul>\n<li> no
|
9
|
+
two sides of P are the same length,\r\n</li>\n<li> the length of every side of P
|
10
|
+
is in S, and\r\n</li>\n<li> S contains no other value.\r\n</li>\n</ul>\n<p>\r\nFor
|
11
|
+
example:<br>\r\nThe set {3, 4, 5} generates a polygon with sides 3, 4, and 5 (a
|
12
|
+
triangle).<br>\r\nThe set {6, 9, 11, 24} generates a polygon with sides 6, 9, 11,
|
13
|
+
and 24 (a quadrilateral).<br>\r\nThe sets {1, 2, 3} and {2, 3, 4, 9} do not generate
|
14
|
+
any polygon at all.<br></p>\r\n\r\n<p>\r\nConsider the sequence s, defined as follows:</p>\n<ul>\n<li>s<sub>1</sub>
|
15
|
+
= 1, s<sub>2</sub> = 2, s<sub>3</sub> = 3\r\n</li>\n<li>s<sub><var>n</var></sub>
|
16
|
+
= s<sub><var>n</var>-1</sub> + s<sub><var>n</var>-3</sub> for <var>n</var> <img
|
17
|
+
src=\"images/symbol_gt.gif\" width=\"10\" height=\"10\" alt=\">\" border=\"0\"
|
18
|
+
style=\"vertical-align:middle;\"> 3.\r\n</li>\n</ul>\n<p>\r\nLet U<sub><var>n</var></sub>
|
19
|
+
be the set {s<sub>1</sub>, s<sub>2</sub>, ..., s<sub><var>n</var></sub>}. For example,
|
20
|
+
U<sub>10</sub> = {1, 2, 3, 4, 6, 9, 13, 19, 28, 41}.<br>\r\nLet f(<var>n</var>)
|
21
|
+
be the number of subsets of U<sub><var>n</var></sub> which generate at least one
|
22
|
+
polygon.<br>\r\nFor example, f(5) = 7, f(10) = 501 and f(25) = 18635853.\r\n</p>\r\n\r\n<p>\r\nFind
|
23
|
+
the last 9 digits of f(10<sup>18</sup>).\r\n</p>\r\n"
|
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
:id: 383
|
3
|
+
:name: Divisibility comparison between factorials
|
4
|
+
:url: http://projecteuler.net/problem=383
|
5
|
+
:content: "\r\n<p>\r\nLet f<sub>5</sub>(<var>n</var>) be the largest integer <var>x</var>
|
6
|
+
for which 5<sup><var>x</var></sup> divides <var>n</var>.<br>\r\nFor example, f<sub>5</sub>(625000)
|
7
|
+
= 7.\r\n</p>\r\n\r\n<p>\r\nLet T<sub>5</sub>(<var>n</var>) be the number of integers
|
8
|
+
<var>i</var> which satisfy f<sub>5</sub>((2·<var>i</var>-1)!) 5(<var>i</var>!) and
|
9
|
+
1 <img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
10
|
+
style=\"vertical-align:middle;\"><var>i</var> <img src=\"images/symbol_le.gif\"
|
11
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>n</var>.<br>\r\nIt
|
12
|
+
can be verified that T<sub>5</sub>(10<sup>3</sup>) = 68 and T<sub>5</sub>(10<sup>9</sup>)
|
13
|
+
= 2408210.\r\n</p>\r\n\r\n<p>\r\nFind T<sub>5</sub>(10<sup>18</sup>).\r\n</p>\r\n"
|