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,11 @@
|
|
1
|
+
---
|
2
|
+
:id: 15
|
3
|
+
:name: Lattice paths
|
4
|
+
:url: http://projecteuler.net/problem=15
|
5
|
+
:content: "\r\n<p>Starting in the top left corner of a 2<img src=\"images/symbol_times.gif\"
|
6
|
+
width=\"9\" height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">2
|
7
|
+
grid, and only being able to move to the right and down, there are exactly 6 routes
|
8
|
+
to the bottom right corner.</p>\r\n<div style=\"text-align:center;\">\r\n<img src=\"project/images/p_015.gif\"
|
9
|
+
alt=\"\">\n</div>\r\n<p>How many such routes are there through a 20<img src=\"images/symbol_times.gif\"
|
10
|
+
width=\"9\" height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">20
|
11
|
+
grid?</p>\r\n\r\n"
|
@@ -0,0 +1,34 @@
|
|
1
|
+
---
|
2
|
+
:id: 150
|
3
|
+
:name: Searching a triangular array for a sub-triangle having minimum-sum
|
4
|
+
:url: http://projecteuler.net/problem=150
|
5
|
+
:content: "\r\n<p>In a triangular array of positive and negative integers, we wish
|
6
|
+
to find a sub-triangle such that the sum of the numbers it contains is the smallest
|
7
|
+
possible.</p>\r\n<p>In the example below, it can be easily verified that the marked
|
8
|
+
triangle satisfies this condition having a sum of <img src=\"images/symbol_minus.gif\"
|
9
|
+
width=\"9\" height=\"3\" alt=\"−\" border=\"0\" style=\"vertical-align:middle;\">42.</p>\r\n<div
|
10
|
+
style=\"text-align:center;\">\r\n<img src=\"http://projecteuler.net/project/images/p_150.gif\"
|
11
|
+
border=\"0\" alt=\"\">\n</div>\r\n<p>We wish to make such a triangular array with
|
12
|
+
one thousand rows, so we generate 500500 pseudo-random numbers <span style=\"font-style:
|
13
|
+
italic\">s<sub>k</sub></span> in the range <img src=\"images/symbol_plusmn.gif\"
|
14
|
+
width=\"11\" height=\"11\" alt=\"±\" border=\"0\" style=\"vertical-align:middle;\">2<sup>19</sup>,
|
15
|
+
using a type of random number generator (known as a Linear Congruential Generator)
|
16
|
+
as follows:</p>\r\n<p style=\"margin-left:50px;\"><span style=\"font-style: italic\">t</span>
|
17
|
+
:= 0\r\n<br>\r\nfor k = 1 up to k = 500500:\r\n<br>\r\n <span style=\"font-style:
|
18
|
+
italic\">t</span> := (615949*<span style=\"font-style: italic\">t</span> + 797807)
|
19
|
+
modulo 2<sup>20</sup><br>\r\n <span style=\"font-style: italic\">s<sub>k</sub></span>
|
20
|
+
:= <span style=\"font-style: italic\">t</span><img src=\"images/symbol_minus.gif\"
|
21
|
+
width=\"9\" height=\"3\" alt=\"−\" border=\"0\" style=\"vertical-align:middle;\">2<sup>19</sup></p>\r\n<p>Thus:
|
22
|
+
<span style=\"font-style: italic\">s<sub>1</sub></span> = 273519, <span style=\"font-style:
|
23
|
+
italic\">s<sub>2</sub></span> = <img src=\"images/symbol_minus.gif\" width=\"9\"
|
24
|
+
height=\"3\" alt=\"−\" border=\"0\" style=\"vertical-align:middle;\">153582, <span
|
25
|
+
style=\"font-style: italic\">s<sub>3</sub></span> = 450905 etc</p>\r\n<p>Our triangular
|
26
|
+
array is then formed using the pseudo-random numbers thus:</p>\r\n<div style=\"text-align:center;font-style:
|
27
|
+
italic;\">\r\ns<sub>1</sub><br>\r\ns<sub>2</sub> s<sub>3</sub><br>\r\ns<sub>4</sub>
|
28
|
+
s<sub>5</sub> s<sub>6</sub> \r\n<br>\r\ns<sub>7</sub> s<sub>8</sub> s<sub>9</sub>
|
29
|
+
s<sub>10</sub><br>\r\n...\r\n</div>\r\n<p>Sub-triangles can start at any element
|
30
|
+
of the array and extend down as far as we like (taking-in the two elements directly
|
31
|
+
below it from the next row, the three elements directly below from the row after
|
32
|
+
that, and so on).\r\n<br>\r\nThe \"sum of a sub-triangle\" is defined as the sum
|
33
|
+
of all the elements it contains.\r\n<br>\r\nFind the smallest possible sub-triangle
|
34
|
+
sum.</p>\r\n"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
---
|
2
|
+
:id: 151
|
3
|
+
:name: 'Paper sheets of standard sizes: an expected-value problem'
|
4
|
+
:url: http://projecteuler.net/problem=151
|
5
|
+
:content: "\r\n<p>A printing shop runs 16 batches (jobs) every week and each batch
|
6
|
+
requires a sheet of special colour-proofing paper of size A5.</p>\r\n<p>Every Monday
|
7
|
+
morning, the foreman opens a new envelope, containing a large sheet of the special
|
8
|
+
paper with size A1.</p>\r\n<p>He proceeds to cut it in half, thus getting two sheets
|
9
|
+
of size A2. Then he cuts one of them in half to get two sheets of size A3 and so
|
10
|
+
on until he obtains the A5-size sheet needed for the first batch of the week.</p>\r\n<p>All
|
11
|
+
the unused sheets are placed back in the envelope.</p>\r\n<div style=\"text-align:center;\"><img
|
12
|
+
src=\"project/images/p_151.gif\" width=\"314\" height=\"227\" alt=\"\"></div>\r\n<p>At
|
13
|
+
the beginning of each subsequent batch, he takes from the envelope one sheet of
|
14
|
+
paper at random. If it is of size A5, he uses it. If it is larger, he repeats the
|
15
|
+
'cut-in-half' procedure until he has what he needs and any remaining sheets are
|
16
|
+
always placed back in the envelope.</p>\r\n<p>Excluding the first and last batch
|
17
|
+
of the week, find the expected number of times (during each week) that the foreman
|
18
|
+
finds a single sheet of paper in the envelope.</p>\r\n<p>Give your answer rounded
|
19
|
+
to six decimal places using the format x.xxxxxx .</p>\r\n"
|
@@ -0,0 +1,12 @@
|
|
1
|
+
---
|
2
|
+
:id: 152
|
3
|
+
:name: Writing 1/2 as a sum of inverse squares
|
4
|
+
:url: http://projecteuler.net/problem=152
|
5
|
+
:content: "\r\n<p>There are several ways to write the number 1/2 as a sum of inverse
|
6
|
+
squares using <i>distinct</i> integers.</p>\r\n<p>For instance, the numbers {2,3,4,5,7,12,15,20,28,35}
|
7
|
+
can be used:</p>\r\n<p style=\"margin-left:50px;\"><img src=\"http://projecteuler.net/project/images/p_152_sum.gif\"
|
8
|
+
border=\"0\" alt=\"\"></p>\r\n<p>In fact, only using integers between 2 and 45 inclusive,
|
9
|
+
there are exactly three ways to do it, the remaining two being: {2,3,4,6,7,9,10,20,28,35,36,45}
|
10
|
+
and {2,3,4,6,7,9,12,15,28,30,35,36,45}.</p>\r\n<p>How many ways are there to write
|
11
|
+
the number 1/2 as a sum of inverse squares using distinct integers between 2 and
|
12
|
+
80 inclusive?</p>\r\n"
|
@@ -0,0 +1,57 @@
|
|
1
|
+
---
|
2
|
+
:id: 153
|
3
|
+
:name: Investigating Gaussian Integers
|
4
|
+
:url: http://projecteuler.net/problem=153
|
5
|
+
:content: "\r\n<p>As we all know the equation <var>x</var><sup>2</sup>=-1 has no solutions
|
6
|
+
for real <var>x</var>.\r\n<br>\r\nIf we however introduce the imaginary number <var>i</var>
|
7
|
+
this equation has two solutions: <var>x=i</var> and <var>x=-i</var>.\r\n<br>\r\nIf
|
8
|
+
we go a step further the equation (<var>x</var>-3)<sup>2</sup>=-4 has two complex
|
9
|
+
solutions: <var>x</var>=3+2<var>i</var> and <var>x</var>=3-2<var>i</var>.\r\n<br><var>x</var>=3+2<var>i</var>
|
10
|
+
and <var>x</var>=3-2<var>i</var> are called each others' complex conjugate.\r\n<br>\r\nNumbers
|
11
|
+
of the form <var>a</var>+<var>bi</var> are called complex numbers.\r\n<br>\r\nIn
|
12
|
+
general <var>a</var>+<var>bi</var> and <var>a</var><img src=\"images/symbol_minus.gif\"
|
13
|
+
width=\"9\" height=\"3\" alt=\"−\" border=\"0\" style=\"vertical-align:middle;\"><var>bi</var>
|
14
|
+
are each other's complex conjugate.</p>\r\n<p>A Gaussian Integer is a complex number
|
15
|
+
<var>a</var>+<var>bi</var> such that both <var>a</var> and <var>b</var> are integers.\r\n<br>\r\nThe
|
16
|
+
regular integers are also Gaussian integers (with <var>b</var>=0).\r\n<br>\r\nTo
|
17
|
+
distinguish them from Gaussian integers with <var>b</var> <img src=\"images/symbol_ne.gif\"
|
18
|
+
width=\"11\" height=\"10\" alt=\"≠\" border=\"0\" style=\"vertical-align:middle;\">
|
19
|
+
0 we call such integers \"rational integers.\"\r\n<br>\r\nA Gaussian integer is
|
20
|
+
called a divisor of a rational integer <var>n</var> if the result is also a Gaussian
|
21
|
+
integer.\r\n<br>\r\nIf for example we divide 5 by 1+2<var>i</var> we can simplify
|
22
|
+
<img src=\"project/images/p_153_formule1.gif\" border=\"0\" style=\"vertical-align:middle\"
|
23
|
+
alt=\"\"> in the following manner:\r\n<br>\r\nMultiply numerator and denominator
|
24
|
+
by the complex conjugate of 1+2<var>i</var>: 1<img src=\"images/symbol_minus.gif\"
|
25
|
+
width=\"9\" height=\"3\" alt=\"−\" border=\"0\" style=\"vertical-align:middle;\">2<var>i</var>.\r\n<br>\r\nThe
|
26
|
+
result is \r\n<img src=\"project/images/p_153_formule2.gif\" border=\"0\" alt=\"\"
|
27
|
+
style=\"vertical-align:middle;\">.\r\n<br>\r\nSo 1+2<var>i</var> is a divisor of
|
28
|
+
5.\r\n<br>\r\nNote that 1+<var>i</var> is not a divisor of 5 because <img src=\"project/images/p_153_formule5.gif\"
|
29
|
+
border=\"0\" style=\"vertical-align:middle;\" alt=\"\">.\r\n<br>\r\nNote also that
|
30
|
+
if the Gaussian Integer (<var>a</var>+<var>bi</var>) is a divisor of a rational
|
31
|
+
integer <var>n</var>, then its complex conjugate (<var>a</var><img src=\"images/symbol_minus.gif\"
|
32
|
+
width=\"9\" height=\"3\" alt=\"−\" border=\"0\" style=\"vertical-align:middle;\"><var>bi</var>)
|
33
|
+
is also a divisor of <var>n</var>.</p>\r\n<p>In fact, 5 has six divisors such that
|
34
|
+
the real part is positive: {1, 1 + 2<var>i</var>, 1 <img src=\"images/symbol_minus.gif\"
|
35
|
+
width=\"9\" height=\"3\" alt=\"−\" border=\"0\" style=\"vertical-align:middle;\">
|
36
|
+
2<var>i</var>, 2 + <var>i</var>, 2 <img src=\"images/symbol_minus.gif\" width=\"9\"
|
37
|
+
height=\"3\" alt=\"−\" border=\"0\" style=\"vertical-align:middle;\"><var>i</var>,
|
38
|
+
5}.\r\n<br>\r\nThe following is a table of all of the divisors for the first five
|
39
|
+
positive rational integers:</p>\r\n<table align=\"center\" border=\"1\">\n<tr>\n<td
|
40
|
+
width=\"20\">\r\n<var>n</var>\n</td>\n<td> Gaussian integer divisors<br>\r\nwith
|
41
|
+
positive real part</td>\n<td>Sum s(<var>n</var>) of <br>these\r\n\r\ndivisors</td>\n</tr>\n<tr>\n<td>1</td>\n<td>1</td>\n<td>1</td>\r\n</tr>\n<tr>\n<td>2</td>\n<td>1,
|
42
|
+
1+<var>i</var>, 1-<var>i</var>, 2</td>\n<td>5</td>\r\n</tr>\n<tr>\n<td>3</td>\n<td>1,
|
43
|
+
3</td>\n<td>4</td>\r\n</tr>\n<tr>\n<td>4</td>\n<td>1, 1+<var>i</var>, 1-<var>i</var>,
|
44
|
+
2, 2+2<var>i</var>, 2-2<var>i</var>,4</td>\n<td>13</td>\r\n</tr>\n<tr>\n<td>5</td>\n<td>1,
|
45
|
+
1+2<var>i</var>, 1-2<var>i</var>, 2+<var>i</var>, 2-<var>i</var>, 5</td>\n<td>12</td>\r\n</tr>\n</table>\n<p>For
|
46
|
+
divisors with positive real parts, then, we have: <img src=\"project/images/p_153_formule6.gif\"
|
47
|
+
border=\"0\" style=\"vertical-align:middle\" alt=\"\">.</p>\r\n<p>For 1 <img src=\"images/symbol_le.gif\"
|
48
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>n</var>
|
49
|
+
<img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
50
|
+
style=\"vertical-align:middle;\"> 10<sup>5</sup>, <img src=\"images/symbol_sum.gif\"
|
51
|
+
width=\"11\" height=\"14\" alt=\"∑\" border=\"0\" style=\"vertical-align:middle;\">
|
52
|
+
s(<var>n</var>)=17924657155.</p>\r\n<p>What is <img src=\"images/symbol_sum.gif\"
|
53
|
+
width=\"11\" height=\"14\" alt=\"∑\" border=\"0\" style=\"vertical-align:middle;\">
|
54
|
+
s(<var>n</var>) for 1 <img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\"
|
55
|
+
alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>n</var> <img src=\"images/symbol_le.gif\"
|
56
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">
|
57
|
+
10<sup>8</sup>?</p>\r\n"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
---
|
2
|
+
:id: 154
|
3
|
+
:name: Exploring Pascal's pyramid
|
4
|
+
:url: http://projecteuler.net/problem=154
|
5
|
+
:content: "\r\n<p>A triangular pyramid is constructed using spherical balls so that
|
6
|
+
each ball rests on exactly three balls of the next lower level.</p>\r\n<div style=\"text-align:center;\"><img
|
7
|
+
src=\"project/images/p_154_pyramid.gif\" width=\"488\" height=\"379\" alt=\"\"></div>\r\n<p>Then,
|
8
|
+
we calculate the number of paths leading from the apex to each position:</p>\r\n<p>A
|
9
|
+
path starts at the apex and progresses downwards to any of the three spheres directly
|
10
|
+
below the current position.</p>\r\n<p>Consequently, the number of paths to reach
|
11
|
+
a certain position is the sum of the numbers immediately above it (depending on
|
12
|
+
the position, there are up to three numbers above it).</p>\r\n<p>The result is <i>Pascal's
|
13
|
+
pyramid</i> and the numbers at each level <var>n</var> are the coefficients of the
|
14
|
+
trinomial expansion \r\n(<var>x + y + z</var>)<sup><var>n</var></sup>.</p>\r\n<p>How
|
15
|
+
many coefficients in the expansion of (<var>x + y + z</var>)<sup>200000</sup> are
|
16
|
+
multiples of 10<sup>12</sup>?</p>\r\n"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
:id: 155
|
3
|
+
:name: Counting Capacitor Circuits
|
4
|
+
:url: http://projecteuler.net/problem=155
|
5
|
+
:content: "\r\n<p>An electric circuit uses exclusively identical capacitors of the
|
6
|
+
same value C.\r\n<br>\r\nThe capacitors can be connected in series or in parallel
|
7
|
+
to form sub-units, which can then be connected in series or in parallel with other
|
8
|
+
capacitors or other sub-units to form larger sub-units, and so on up to a final
|
9
|
+
circuit.</p>\r\n<p>Using this simple procedure and up to <var>n</var> identical
|
10
|
+
capacitors, we can make circuits having a range of different total capacitances.
|
11
|
+
For example, using up to <var>n</var>=3 capacitors of 60 <img src=\"project/images/p_155_capsmu.gif\"
|
12
|
+
width=\"12\" height=\"21\" alt=\"\" style=\"vertical-align:middle;\">F each, we
|
13
|
+
can obtain the following 7 distinct total capacitance values: </p>\r\n<div style=\"text-align:center;\"><img
|
14
|
+
src=\"project/images/p_155_capacitors1.gif\" width=\"387\" height=\"557\" alt=\"\"></div>\r\n<p>If
|
15
|
+
we denote by <var>D</var>(<var>n</var>) the number of distinct total capacitance
|
16
|
+
values we can obtain when using up to <var>n</var> equal-valued capacitors and the
|
17
|
+
simple procedure described above, we have: <var>D</var>(1)=1, <var>D</var>(2)=3,
|
18
|
+
<var>D</var>(3)=7 ...</p>\r\n<p>Find <var>D</var>(18).</p>\r\n<p><i>Reminder :</i>
|
19
|
+
When connecting capacitors C<sub>1</sub>, C<sub>2</sub> etc in parallel, the total
|
20
|
+
capacitance is C<sub>T</sub> = C<sub>1</sub> + C<sub>2</sub> +...,\r\n<br>\r\nwhereas
|
21
|
+
when connecting them in series, the overall capacitance is given by:\r\n<img src=\"project/images/p_155_capsform.gif\"
|
22
|
+
width=\"127\" height=\"38\" alt=\"\" style=\"vertical-align:middle;\"></p>\r\n\r\n"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
---
|
2
|
+
:id: 156
|
3
|
+
:name: Counting Digits
|
4
|
+
:url: http://projecteuler.net/problem=156
|
5
|
+
:content: "\r\n<p>Starting from zero the natural numbers are written down in base
|
6
|
+
10 like this:\r\n<br>\r\n0 1 2 3 4 5 6 7 8 9 10 11 12....\r\n</p>\r\n<p>Consider
|
7
|
+
the digit <var>d</var>=1. After we write down each number <var>n</var>, we will
|
8
|
+
update the number of ones that have occurred and call this number <var>f</var>(<var>n</var>,1).
|
9
|
+
The first values for <var>f</var>(<var>n</var>,1), then, are as follows:</p>\r\n<div
|
10
|
+
style=\"text-align:center;\">\r\n<table style=\"text-align:center;\" align=\"center\">\n<tr>\n<td><var>n</var></td>\n<td>\n<var>f</var>(<var>n</var>,1)</td>\r\n</tr>\n<tr>\n<td>0</td>\n<td>0</td>\r\n</tr>\n<tr>\n<td>1</td>\n<td>1</td>\r\n</tr>\n<tr>\n<td>2</td>\n<td>1</td>\r\n</tr>\n<tr>\n<td>3</td>\n<td>1</td>\r\n</tr>\n<tr>\n<td>4</td>\n<td>1</td>\r\n</tr>\n<tr>\n<td>5</td>\n<td>1</td>\r\n</tr>\n<tr>\n<td>6</td>\n<td>1</td>\r\n</tr>\n<tr>\n<td>7</td>\n<td>1</td>\r\n</tr>\n<tr>\n<td>8</td>\n<td>1</td>\r\n</tr>\n<tr>\n<td>9</td>\n<td>1</td>\r\n</tr>\n<tr>\n<td>10</td>\n<td>2</td>\r\n</tr>\n<tr>\n<td>11</td>\n<td>4</td>\r\n</tr>\n<tr>\n<td>12</td>\n<td>5</td>\r\n</tr>\n</table>\n</div>\r\n<p>Note
|
11
|
+
that <var>f</var>(<var>n</var>,1) never equals 3.\r\n<br>\r\nSo the first two solutions
|
12
|
+
of the equation <var>f</var>(<var>n</var>,1)=<var>n</var> are <var>n</var>=0 and
|
13
|
+
<var>n</var>=1. The next solution is <var>n</var>=199981.</p>\r\n<p>In the same
|
14
|
+
manner the function <var>f</var>(<var>n,d</var>) gives the total number of digits
|
15
|
+
<var>d</var> that have been written down after the number <var>n</var> has been
|
16
|
+
written.\r\n<br>\r\nIn fact, for every digit <var>d</var> <img src=\"images/symbol_ne.gif\"
|
17
|
+
width=\"11\" height=\"10\" alt=\"≠\" border=\"0\" style=\"vertical-align:middle;\">
|
18
|
+
0, 0 is the first solution of the equation <var>f</var>(<var>n,d</var>)=<var>n</var>.</p>\r\n<p>Let
|
19
|
+
<var>s</var>(<var>d</var>) be the sum of all the solutions for which <var>f</var>(<var>n,d</var>)=<var>n</var>.\r\n<br>\r\nYou
|
20
|
+
are given that <var>s</var>(1)=22786974071.</p>\r\n<p>Find <img src=\"images/symbol_sum.gif\"
|
21
|
+
width=\"11\" height=\"14\" alt=\"∑\" border=\"0\" style=\"vertical-align:middle;\"><var>s</var>(<var>d</var>)
|
22
|
+
for 1 <img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
23
|
+
style=\"vertical-align:middle;\"> d <img src=\"images/symbol_le.gif\" width=\"10\"
|
24
|
+
height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"> 9.</p>\r\n<p>Note:
|
25
|
+
if, for some <var>n</var>, <var>f</var>(<var>n,d</var>)=<var>n</var>\r\n for more
|
26
|
+
than one value of <var>d</var> this value of <var>n</var> is counted again for every
|
27
|
+
value of <var>d</var> for which <var>f</var>(<var>n,d</var>)=<var>n</var>.</p>\r\n"
|
@@ -0,0 +1,34 @@
|
|
1
|
+
---
|
2
|
+
:id: 157
|
3
|
+
:name: Solving the diophantine equation <sup>1</sup>/<sub><var>a</var></sub>+<sup>1</sup>/<sub><var>b</var></sub>=
|
4
|
+
<sup><var>p</var></sup>/<sub>10<sup><var>n</var></sup></sub>
|
5
|
+
:url: http://projecteuler.net/problem=157
|
6
|
+
:content: "\r\n<p>Consider the diophantine equation <sup>1</sup>/<sub><var>a</var></sub>+<sup>1</sup>/<sub><var>b</var></sub>=
|
7
|
+
<sup><var>p</var></sup>/<sub>10<sup><var>n</var></sup></sub> with <var>a, b, p,
|
8
|
+
n</var> positive integers and <var>a</var> <img src=\"images/symbol_le.gif\" width=\"10\"
|
9
|
+
height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>b</var>.<br>\r\nFor
|
10
|
+
<var>n</var>=1 this equation has 20 solutions that are listed below:</p>\r\n<table>\n<tr>\n<td
|
11
|
+
width=\"120\">\n<sup>1</sup>/<sub>1</sub>+<sup>1</sup>/<sub>1</sub>=<sup>20</sup>/<sub>10</sub>\n</td>\r\n<td
|
12
|
+
width=\"120\">\n<sup>1</sup>/<sub>1</sub>+<sup>1</sup>/<sub>2</sub>=<sup>15</sup>/<sub>10</sub>\n</td>\r\n<td
|
13
|
+
width=\"120\">\n<sup>1</sup>/<sub>1</sub>+<sup>1</sup>/<sub>5</sub>=<sup>12</sup>/<sub>10</sub>\n</td>\r\n<td
|
14
|
+
width=\"120\">\n<sup>1</sup>/<sub>1</sub>+<sup>1</sup>/<sub>10</sub>=<sup>11</sup>/<sub>10</sub>\n</td>\r\n<td
|
15
|
+
width=\"120\">\n<sup>1</sup>/<sub>2</sub>+<sup>1</sup>/<sub>2</sub>=<sup>10</sup>/<sub>10</sub>\n</td>\r\n</tr>\n<tr>\n<td
|
16
|
+
width=\"120\">\n<sup>1</sup>/<sub>2</sub>+<sup>1</sup>/<sub>5</sub>=<sup>7</sup>/<sub>10</sub>\n</td>\r\n<td
|
17
|
+
width=\"120\">\n<sup>1</sup>/<sub>2</sub>+<sup>1</sup>/<sub>10</sub>=<sup>6</sup>/<sub>10</sub>\n</td>\r\n<td
|
18
|
+
width=\"120\">\n<sup>1</sup>/<sub>3</sub>+<sup>1</sup>/<sub>6</sub>=<sup>5</sup>/<sub>10</sub>\n</td>\r\n<td
|
19
|
+
width=\"120\">\n<sup>1</sup>/<sub>3</sub>+<sup>1</sup>/<sub>15</sub>=<sup>4</sup>/<sub>10</sub>\n</td>\r\n<td
|
20
|
+
width=\"120\">\n<sup>1</sup>/<sub>4</sub>+<sup>1</sup>/<sub>4</sub>=<sup>5</sup>/<sub>10</sub>\n</td>\r\n</tr>\n<tr>\n<td
|
21
|
+
width=\"120\">\n<sup>1</sup>/<sub>4</sub>+<sup>1</sup>/<sub>20</sub>=<sup>3</sup>/<sub>10</sub>\n</td>\r\n<td
|
22
|
+
width=\"120\">\n<sup>1</sup>/<sub>5</sub>+<sup>1</sup>/<sub>5</sub>=<sup>4</sup>/<sub>10</sub>\n</td>\r\n<td
|
23
|
+
width=\"120\">\n<sup>1</sup>/<sub>5</sub>+<sup>1</sup>/<sub>10</sub>=<sup>3</sup>/<sub>10</sub>\n</td>\r\n<td
|
24
|
+
width=\"120\">\n<sup>1</sup>/<sub>6</sub>+<sup>1</sup>/<sub>30</sub>=<sup>2</sup>/<sub>10</sub>\n</td>\r\n<td
|
25
|
+
width=\"120\">\n<sup>1</sup>/<sub>10</sub>+<sup>1</sup>/<sub>10</sub>=<sup>2</sup>/<sub>10</sub>\n</td>\r\n</tr>\n<tr>\n<td
|
26
|
+
width=\"120\">\n<sup>1</sup>/<sub>11</sub>+<sup>1</sup>/<sub>110</sub>=<sup>1</sup>/<sub>10</sub>\n</td>\r\n<td
|
27
|
+
width=\"120\">\n<sup>1</sup>/<sub>12</sub>+<sup>1</sup>/<sub>60</sub>=<sup>1</sup>/<sub>10</sub>\n</td>\r\n<td
|
28
|
+
width=\"120\">\n<sup>1</sup>/<sub>14</sub>+<sup>1</sup>/<sub>35</sub>=<sup>1</sup>/<sub>10</sub>\n</td>\r\n<td
|
29
|
+
width=\"120\">\n<sup>1</sup>/<sub>15</sub>+<sup>1</sup>/<sub>30</sub>=<sup>1</sup>/<sub>10</sub>\n</td>\r\n<td
|
30
|
+
width=\"120\">\n<sup>1</sup>/<sub>20</sub>+<sup>1</sup>/<sub>20</sub>=<sup>1</sup>/<sub>10</sub>\n</td>\r\n</tr>\n</table>\n<p>How
|
31
|
+
many solutions has this equation for 1 <img src=\"images/symbol_le.gif\" width=\"10\"
|
32
|
+
height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>n</var>
|
33
|
+
<img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
34
|
+
style=\"vertical-align:middle;\"> 9?</p>\r\n"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
---
|
2
|
+
:id: 158
|
3
|
+
:name: Exploring strings for which only one character comes lexicographically after
|
4
|
+
its neighbour to the left
|
5
|
+
:url: http://projecteuler.net/problem=158
|
6
|
+
:content: "\r\n<p>Taking three different letters from the 26 letters of the alphabet,
|
7
|
+
character strings of length three can be formed.<br>\r\nExamples are 'abc', 'hat'
|
8
|
+
and 'zyx'.<br>\r\nWhen we study these three examples we see that for 'abc' two characters
|
9
|
+
come lexicographically after its neighbour to the left.<br> \r\nFor 'hat' there
|
10
|
+
is exactly one character that comes lexicographically after its neighbour to the
|
11
|
+
left. For 'zyx' there are zero characters that come lexicographically after its
|
12
|
+
neighbour to the left.<br>\r\nIn all there are 10400 strings of length 3 for which
|
13
|
+
exactly one character comes lexicographically after its neighbour to the left.</p>\r\n<p>We
|
14
|
+
now consider strings of <var>n</var> <img src=\"images/symbol_le.gif\" width=\"10\"
|
15
|
+
height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"> 26 different
|
16
|
+
characters from the alphabet.<br> \r\nFor every <var>n</var>, p(<var>n</var>) is
|
17
|
+
the number of strings of length <var>n</var> for which exactly one character comes
|
18
|
+
lexicographically after its neighbour to the left.</p> \r\n<p>What is the maximum
|
19
|
+
value of p(<var>n</var>)?</p>\r\n"
|
@@ -0,0 +1,29 @@
|
|
1
|
+
---
|
2
|
+
:id: 159
|
3
|
+
:name: "Digital root sums of factorisations\r\n"
|
4
|
+
:url: http://projecteuler.net/problem=159
|
5
|
+
:content: "\r\n<p>A composite number can be factored many different ways. \r\nFor
|
6
|
+
instance, not including multiplication by one, 24 can be factored in 7 distinct
|
7
|
+
ways:</p>\r\n<div style=\"margin-left:50px;\">\r\n24 = 2x2x2x3<br>\r\n24 = 2x3x4<br>\r\n24
|
8
|
+
= 2x2x6<br>\r\n24 = 4x6<br>\r\n24 = 3x8<br>\r\n24 = 2x12<br>\r\n24 = 24\r\n</div>\r\n<p>Recall
|
9
|
+
that the digital root of a number, in base 10, is found by adding together the digits
|
10
|
+
of that number, \r\nand repeating that process until a number is arrived at that
|
11
|
+
is less than 10. \r\nThus the digital root of 467 is 8.</p>\r\n<p>We shall call
|
12
|
+
a Digital Root Sum (DRS) the sum of the digital roots of the individual factors
|
13
|
+
of our number.<br>\r\n The chart below demonstrates all of the DRS values for 24.</p>\r\n<table
|
14
|
+
align=\"center\" border=\"1\" cellpadding=\"2\" cellspacing=\"0\">\n<tr>\n<th>Factorisation</th>\n<th>Digital
|
15
|
+
Root Sum</th>\n</tr>\n<tr>\n<td><div style=\"margin-left:20px;\">2x2x2x3</div></td>\r\n<td><div
|
16
|
+
style=\"text-align:center;\">9</div></td>\n</tr>\n<tr>\n<td><div style=\"margin-left:20px;\">2x3x4</div></td>\r\n<td><div
|
17
|
+
style=\"text-align:center;\">9</div></td>\n</tr>\n<tr>\n<td><div style=\"margin-left:20px;\">2x2x6</div></td>\r\n<td><div
|
18
|
+
style=\"text-align:center;\">10</div></td>\n</tr>\n<tr>\n<td><div style=\"margin-left:20px;\">4x6</div></td>\r\n<td><div
|
19
|
+
style=\"text-align:center;\">10</div></td>\n</tr>\n<tr>\n<td><div style=\"margin-left:20px;\">3x8</div></td>\r\n<td><div
|
20
|
+
style=\"text-align:center;\">11</div></td>\n</tr>\n<tr>\n<td><div style=\"margin-left:20px;\">2x12</div></td>\r\n<td><div
|
21
|
+
style=\"text-align:center;\">5</div></td>\n</tr>\n<tr>\n<td><div style=\"margin-left:20px;\">24</div></td>\r\n<td><div
|
22
|
+
style=\"text-align:center;\">6</div></td>\n</tr>\n</table>\n<p>The maximum Digital
|
23
|
+
Root Sum of 24 is 11.<br>\r\nThe function mdrs(<var>n</var>) gives the maximum
|
24
|
+
Digital Root Sum of <var>n</var>. So mdrs(24)=11.<br>\r\nFind <img src=\"images/symbol_sum.gif\"
|
25
|
+
width=\"11\" height=\"14\" alt=\"∑\" border=\"0\" style=\"vertical-align:middle;\">mdrs(<var>n</var>)
|
26
|
+
for 1 <img src=\"images/symbol_lt.gif\" width=\"10\" height=\"10\" alt=\"<\"
|
27
|
+
border=\"0\" style=\"vertical-align:middle;\"><var>n</var> <img src=\"images/symbol_lt.gif\"
|
28
|
+
width=\"10\" height=\"10\" alt=\"<\" border=\"0\" style=\"vertical-align:middle;\">
|
29
|
+
1,000,000.</p>\r\n"
|
@@ -0,0 +1,8 @@
|
|
1
|
+
---
|
2
|
+
:id: 160
|
3
|
+
:name: Factorial trailing digits
|
4
|
+
:url: http://projecteuler.net/problem=160
|
5
|
+
:content: "\r\n<p>For any N, let f(N) be the last five digits before the trailing
|
6
|
+
zeroes in N!.<br>\r\nFor example,</p>\r\n<p style=\"margin-left:50px;\">9! = 362880
|
7
|
+
so f(9)=36288<br>\r\n10! = 3628800 so f(10)=36288<br>\r\n20! = 2432902008176640000
|
8
|
+
so f(20)=17664</p>\r\n<p>Find f(1,000,000,000,000)</p>\r\n"
|
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
:id: 161
|
3
|
+
:name: Triominoes
|
4
|
+
:url: http://projecteuler.net/problem=161
|
5
|
+
:content: "\r\n<p>A triomino is a shape consisting of three squares joined via the
|
6
|
+
edges.\r\nThere are two basic forms:</p>\r\n\r\n<p style=\"text-align:center;\"><img
|
7
|
+
src=\"http://projecteuler.net/project/images/p_161_trio1.gif\" alt=\"\"></p>\r\n\r\n<p>If
|
8
|
+
all possible orientations are taken into account there are six:</p>\r\n\r\n<p style=\"text-align:center;\"><img
|
9
|
+
src=\"http://projecteuler.net/project/images/p_161_trio3.gif\" alt=\"\"></p>\r\n\r\n<p>Any
|
10
|
+
n by m grid for which nxm is divisible by 3 can be tiled with triominoes.<br>\r\nIf
|
11
|
+
we consider tilings that can be obtained by reflection or rotation from another
|
12
|
+
tiling as different there are 41 ways a 2 by 9 grid can be tiled with triominoes:</p>\r\n\r\n<p
|
13
|
+
style=\"text-align:center;\"><img src=\"http://projecteuler.net/project/images/p_161_k9.gif\"
|
14
|
+
alt=\"\"></p>\r\n\r\n<p>In how many ways can a 9 by 12 grid be tiled in this way
|
15
|
+
by triominoes?</p>\r\n"
|
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
:id: 162
|
3
|
+
:name: Hexadecimal numbers
|
4
|
+
:url: http://projecteuler.net/problem=162
|
5
|
+
:content: "\r\n<p>In the hexadecimal number system numbers are represented using
|
6
|
+
16 different digits:</p>\r\n<div style=\"text-align:center;\">0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F</div>\r\n<p>The
|
7
|
+
hexadecimal number AF when written in the decimal number system equals 10x16+15=175.</p>\r\n<p>In
|
8
|
+
the 3-digit hexadecimal numbers 10A, 1A0, A10, and A01 the digits 0,1 and A are
|
9
|
+
all present.<br>\r\nLike numbers written in base ten we write hexadecimal numbers
|
10
|
+
without leading zeroes.</p>\r\n<p>How many hexadecimal numbers containing at most
|
11
|
+
sixteen hexadecimal digits exist with all of the digits 0,1, and A present at least
|
12
|
+
once?<br>\r\nGive your answer as a hexadecimal number.</p>\r\n<p>(A,B,C,D,E and
|
13
|
+
F in upper case, without any leading or trailing code that marks the number as hexadecimal
|
14
|
+
and without leading zeroes , e.g. 1A3F and not: 1a3f and not 0x1a3f and not $1A3F
|
15
|
+
and not #1A3F and not 0000001A3F)</p>\r\n"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
---
|
2
|
+
:id: 163
|
3
|
+
:name: Cross-hatched triangles
|
4
|
+
:url: http://projecteuler.net/problem=163
|
5
|
+
:content: "\r\n<p>Consider an equilateral triangle in which straight lines are drawn
|
6
|
+
from each vertex to the middle of the opposite side, such as in the <i>size 1</i>
|
7
|
+
triangle in the sketch below.</p>\r\n<div style=\"text-align:center;\"><img src=\"project/images/p_163.gif\"
|
8
|
+
width=\"300\" height=\"200\" alt=\"\"></div>\r\n<p>Sixteen triangles of either different
|
9
|
+
shape or size or orientation or location can now be observed in that triangle. Using
|
10
|
+
<i>size 1</i> triangles as building blocks, larger triangles can be formed, such
|
11
|
+
as the <i>size 2</i> triangle in the above sketch. One-hundred and four triangles
|
12
|
+
of either different shape or size or orientation or location can now be observed
|
13
|
+
in that <i>size 2</i> triangle.</p>\r\n<p>It can be observed that the <i>size 2</i>
|
14
|
+
triangle contains 4 <i>size 1</i> triangle building blocks. A <i>size 3</i> triangle
|
15
|
+
would contain 9 <i>size 1</i> triangle building blocks and a <i>size n</i> triangle
|
16
|
+
would thus contain <i>n<sup>2</sup> size 1</i> triangle building blocks.</p>\r\n<p>If
|
17
|
+
we denote T(<var>n</var>) as the number of triangles present in a triangle of <i>size
|
18
|
+
<var>n</var></i>, then</p>\r\n<p style=\"margin-left:50px;\">T(1) = 16<br>\r\nT(2)
|
19
|
+
= 104</p>\r\n<p>Find T(36).</p>\r\n\r\n"
|
@@ -0,0 +1,8 @@
|
|
1
|
+
---
|
2
|
+
:id: 164
|
3
|
+
:name: Numbers for which no three consecutive digits have a sum greater than a given
|
4
|
+
value
|
5
|
+
:url: http://projecteuler.net/problem=164
|
6
|
+
:content: "\r\n<p>How many 20 digit numbers <var>n</var> (without any leading zero)
|
7
|
+
exist such that no three consecutive digits of <var>n</var> have a sum greater than
|
8
|
+
9?</p>\r\n"
|
@@ -0,0 +1,32 @@
|
|
1
|
+
---
|
2
|
+
:id: 165
|
3
|
+
:name: Intersections
|
4
|
+
:url: http://projecteuler.net/problem=165
|
5
|
+
:content: "\r\n<p>A segment is uniquely defined by its two endpoints.<br> By considering
|
6
|
+
two line segments in plane geometry there are three possibilities:<br> \r\nthe segments
|
7
|
+
have zero points, one point, or infinitely many points in common.</p>\r\n<p>Moreover
|
8
|
+
when two segments have exactly one point in common it might be the case that that
|
9
|
+
common point is an endpoint of either one of the segments or of both. If a common
|
10
|
+
point of two segments is not an endpoint of either of the segments it is an interior
|
11
|
+
point of both segments.<br>\r\nWe will call a common point T of two segments L<sub>1</sub>
|
12
|
+
and L<sub>2</sub> a true intersection point of L<sub>1</sub> and L<sub>2</sub> if
|
13
|
+
T is the only common point of L<sub>1</sub> and L<sub>2</sub> and T is an interior
|
14
|
+
point of both segments.\r\n</p>\r\n<p>Consider the three segments L<sub>1</sub>,
|
15
|
+
L<sub>2</sub>, and L<sub>3</sub>:</p>\r\n<p style=\"margin-left:20px;\">L<sub>1</sub>:
|
16
|
+
(27, 44) to (12, 32)<br>\r\nL<sub>2</sub>: (46, 53) to (17, 62)<br>\r\nL<sub>3</sub>:
|
17
|
+
(46, 70) to (22, 40)</p>\r\n<p>It can be verified that line segments L<sub>2</sub>
|
18
|
+
and L<sub>3</sub> have a true intersection point. We note that as the one of the
|
19
|
+
end points of L<sub>3</sub>: (22,40) lies on L<sub>1</sub> this is not considered
|
20
|
+
to be a true point of intersection. L<sub>1</sub> and L<sub>2</sub> have no common
|
21
|
+
point. So among the three line segments, we find one true intersection point.</p>\r\n<p>Now
|
22
|
+
let us do the same for 5000 line segments. To this end, we generate 20000 numbers
|
23
|
+
using the so-called \"Blum Blum Shub\" pseudo-random number generator.</p>\r\n<p
|
24
|
+
style=\"margin-left:50px;\">s<sub>0</sub> = 290797<br><br>\r\ns<sub>n+1</sub> =
|
25
|
+
s<sub>n</sub><img src=\"images/symbol_times.gif\" width=\"9\" height=\"9\" alt=\"×\"
|
26
|
+
border=\"0\" style=\"vertical-align:middle;\">s<sub>n</sub> (modulo 50515093)<br><br>\r\nt<sub>n</sub>
|
27
|
+
= s<sub>n</sub> (modulo 500)</p>\r\n<p>To create each line segment, we use four
|
28
|
+
consecutive numbers t<sub>n</sub>. That is, the first line segment is given by:</p>\r\n<p>(t<sub>1</sub>,
|
29
|
+
t<sub>2</sub>) to (t<sub>3</sub>, t<sub>4</sub>)</p>\r\n<p>The first four numbers
|
30
|
+
computed according to the above generator should be: 27, 144, 12 and 232. The first
|
31
|
+
segment would thus be (27,144) to (12,232).</p>\r\n<p>How many distinct true intersection
|
32
|
+
points are found among the 5000 line segments?</p>\r\n\r\n"
|
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
:id: 166
|
3
|
+
:name: Criss Cross
|
4
|
+
:url: http://projecteuler.net/problem=166
|
5
|
+
:content: "\r\n<p>A 4x4 grid is filled with digits d, 0 <img src=\"images/symbol_le.gif\"
|
6
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">
|
7
|
+
d <img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
8
|
+
style=\"vertical-align:middle;\"> 9.</p>\r\n\r\n<p>It can be seen that in the grid</p>\r\n\r\n<p
|
9
|
+
style=\"text-align:center;\">\r\n6 3 3 0<br>\r\n5 0 4 3<br>\r\n0 7 1 4<br>\r\n1
|
10
|
+
2 4 5</p>\r\n\r\n<p>the sum of each row and each column has the value 12. Moreover
|
11
|
+
the sum of each diagonal is also 12.</p>\r\n\r\n<p>In how many ways can you fill
|
12
|
+
a 4x4 grid with the digits d, 0 <img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\"
|
13
|
+
alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"> d <img src=\"images/symbol_le.gif\"
|
14
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">
|
15
|
+
9 so that each row, each column, and both diagonals have the same sum?</p>\r\n"
|
@@ -0,0 +1,17 @@
|
|
1
|
+
---
|
2
|
+
:id: 167
|
3
|
+
:name: Investigating Ulam sequences
|
4
|
+
:url: http://projecteuler.net/problem=167
|
5
|
+
:content: "\r\n<p>For two positive integers a and b, the Ulam sequence U(a,b) is defined
|
6
|
+
by U(a,b)<sub>1</sub> = a, U(a,b)<sub>2</sub> = b and for k > 2,\r\nU(a,b)<sub>k</sub>
|
7
|
+
is the smallest integer greater than U(a,b)<sub>(k-1)</sub> which can be written
|
8
|
+
in exactly one way as the sum of two distinct previous members of U(a,b).</p>\r\n<p>For
|
9
|
+
example, the sequence U(1,2) begins with<br>\r\n1, 2, 3 = 1 + 2, 4 = 1 + 3, 6 =
|
10
|
+
2 + 4, 8 = 2 + 6, 11 = 3 + 8;<br>\r\n5 does not belong to it because 5 = 1 + 4 =
|
11
|
+
2 + 3 has two representations as the sum of two previous members, likewise 7 = 1
|
12
|
+
+ 6 = 3 + 4.</p>\r\n<p>Find <img src=\"images/symbol_sum.gif\" width=\"11\" height=\"14\"
|
13
|
+
alt=\"∑\" border=\"0\" style=\"vertical-align:middle;\">U(2,2<var>n</var>+1)<sub><var>k</var></sub>
|
14
|
+
for 2 <img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
15
|
+
style=\"vertical-align:middle;\"><var>n</var> <img src=\"images/symbol_le.gif\"
|
16
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">10,
|
17
|
+
where <var>k</var> = 10<sup>11</sup>.</p>\r\n"
|