euler-manager 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +21 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +37 -0
- data/Rakefile +1 -0
- data/bin/euler +145 -0
- data/data/answers.yml +456 -0
- data/data/problems/1.yml +7 -0
- data/data/problems/10.yml +8 -0
- data/data/problems/100.yml +13 -0
- data/data/problems/101.yml +49 -0
- data/data/problems/102.yml +16 -0
- data/data/problems/103.yml +26 -0
- data/data/problems/104.yml +15 -0
- data/data/problems/105.yml +21 -0
- data/data/problems/106.yml +19 -0
- data/data/problems/107.yml +20 -0
- data/data/problems/108.yml +32 -0
- data/data/problems/109.yml +33 -0
- data/data/problems/11.yml +33 -0
- data/data/problems/110.yml +19 -0
- data/data/problems/111.yml +21 -0
- data/data/problems/112.yml +15 -0
- data/data/problems/113.yml +13 -0
- data/data/problems/114.yml +106 -0
- data/data/problems/115.yml +17 -0
- data/data/problems/116.yml +76 -0
- data/data/problems/117.yml +82 -0
- data/data/problems/118.yml +9 -0
- data/data/problems/119.yml +11 -0
- data/data/problems/12.yml +13 -0
- data/data/problems/120.yml +17 -0
- data/data/problems/121.yml +15 -0
- data/data/problems/122.yml +42 -0
- data/data/problems/123.yml +13 -0
- data/data/problems/124.yml +58 -0
- data/data/problems/125.yml +12 -0
- data/data/problems/126.yml +17 -0
- data/data/problems/127.yml +31 -0
- data/data/problems/128.yml +18 -0
- data/data/problems/129.yml +12 -0
- data/data/problems/13.yml +6 -0
- data/data/problems/130.yml +19 -0
- data/data/problems/131.yml +12 -0
- data/data/problems/132.yml +12 -0
- data/data/problems/133.yml +13 -0
- data/data/problems/134.yml +19 -0
- data/data/problems/135.yml +20 -0
- data/data/problems/136.yml +17 -0
- data/data/problems/137.yml +36 -0
- data/data/problems/138.yml +20 -0
- data/data/problems/139.yml +15 -0
- data/data/problems/14.yml +28 -0
- data/data/problems/140.yml +29 -0
- data/data/problems/141.yml +14 -0
- data/data/problems/142.yml +14 -0
- data/data/problems/143.yml +20 -0
- data/data/problems/144.yml +30 -0
- data/data/problems/145.yml +11 -0
- data/data/problems/146.yml +9 -0
- data/data/problems/147.yml +14 -0
- data/data/problems/148.yml +11 -0
- data/data/problems/149.yml +41 -0
- data/data/problems/15.yml +11 -0
- data/data/problems/150.yml +34 -0
- data/data/problems/151.yml +19 -0
- data/data/problems/152.yml +12 -0
- data/data/problems/153.yml +57 -0
- data/data/problems/154.yml +16 -0
- data/data/problems/155.yml +22 -0
- data/data/problems/156.yml +27 -0
- data/data/problems/157.yml +34 -0
- data/data/problems/158.yml +19 -0
- data/data/problems/159.yml +29 -0
- data/data/problems/16.yml +6 -0
- data/data/problems/160.yml +8 -0
- data/data/problems/161.yml +15 -0
- data/data/problems/162.yml +15 -0
- data/data/problems/163.yml +19 -0
- data/data/problems/164.yml +8 -0
- data/data/problems/165.yml +32 -0
- data/data/problems/166.yml +15 -0
- data/data/problems/167.yml +17 -0
- data/data/problems/168.yml +13 -0
- data/data/problems/169.yml +10 -0
- data/data/problems/17.yml +11 -0
- data/data/problems/170.yml +16 -0
- data/data/problems/171.yml +13 -0
- data/data/problems/172.yml +6 -0
- data/data/problems/173.yml +12 -0
- data/data/problems/174.yml +20 -0
- data/data/problems/175.yml +21 -0
- data/data/problems/176.yml +9 -0
- data/data/problems/177.yml +16 -0
- data/data/problems/178.yml +9 -0
- data/data/problems/179.yml +10 -0
- data/data/problems/18.yml +21 -0
- data/data/problems/180.yml +34 -0
- data/data/problems/181.yml +7 -0
- data/data/problems/182.yml +35 -0
- data/data/problems/183.yml +27 -0
- data/data/problems/184.yml +18 -0
- data/data/problems/185.yml +22 -0
- data/data/problems/186.yml +28 -0
- data/data/problems/187.yml +16 -0
- data/data/problems/188.yml +10 -0
- data/data/problems/189.yml +15 -0
- data/data/problems/19.yml +12 -0
- data/data/problems/190.yml +13 -0
- data/data/problems/191.yml +15 -0
- data/data/problems/192.yml +27 -0
- data/data/problems/193.yml +7 -0
- data/data/problems/194.yml +18 -0
- data/data/problems/195.yml +13 -0
- data/data/problems/196.yml +25 -0
- data/data/problems/197.yml +16 -0
- data/data/problems/198.yml +21 -0
- data/data/problems/199.yml +14 -0
- data/data/problems/2.yml +10 -0
- data/data/problems/20.yml +22 -0
- data/data/problems/200.yml +12 -0
- data/data/problems/201.yml +20 -0
- data/data/problems/202.yml +14 -0
- data/data/problems/203.yml +21 -0
- data/data/problems/204.yml +11 -0
- data/data/problems/205.yml +10 -0
- data/data/problems/206.yml +6 -0
- data/data/problems/207.yml +20 -0
- data/data/problems/208.yml +12 -0
- data/data/problems/209.yml +27 -0
- data/data/problems/21.yml +13 -0
- data/data/problems/210.yml +10 -0
- data/data/problems/211.yml +11 -0
- data/data/problems/212.yml +41 -0
- data/data/problems/213.yml +11 -0
- data/data/problems/214.yml +15 -0
- data/data/problems/215.yml +18 -0
- data/data/problems/216.yml +14 -0
- data/data/problems/217.yml +27 -0
- data/data/problems/218.yml +14 -0
- data/data/problems/219.yml +19 -0
- data/data/problems/22.yml +13 -0
- data/data/problems/220.yml +24 -0
- data/data/problems/221.yml +20 -0
- data/data/problems/222.yml +7 -0
- data/data/problems/223.yml +12 -0
- data/data/problems/224.yml +12 -0
- data/data/problems/225.yml +11 -0
- data/data/problems/226.yml +16 -0
- data/data/problems/227.yml +13 -0
- data/data/problems/228.yml +23 -0
- data/data/problems/229.yml +30 -0
- data/data/problems/23.yml +19 -0
- data/data/problems/230.yml +23 -0
- data/data/problems/231.yml +16 -0
- data/data/problems/232.yml +14 -0
- data/data/problems/233.yml +10 -0
- data/data/problems/234.yml +23 -0
- data/data/problems/235.yml +9 -0
- data/data/problems/236.yml +32 -0
- data/data/problems/237.yml +13 -0
- data/data/problems/238.yml +42 -0
- data/data/problems/239.yml +9 -0
- data/data/problems/24.yml +10 -0
- data/data/problems/240.yml +11 -0
- data/data/problems/241.yml +17 -0
- data/data/problems/242.yml +16 -0
- data/data/problems/243.yml +19 -0
- data/data/problems/244.yml +32 -0
- data/data/problems/245.yml +36 -0
- data/data/problems/246.yml +17 -0
- data/data/problems/247.yml +21 -0
- data/data/problems/248.yml +6 -0
- data/data/problems/249.yml +7 -0
- data/data/problems/25.yml +15 -0
- data/data/problems/250.yml +7 -0
- data/data/problems/251.yml +13 -0
- data/data/problems/252.yml +31 -0
- data/data/problems/253.yml +36 -0
- data/data/problems/254.yml +21 -0
- data/data/problems/255.yml +59 -0
- data/data/problems/256.yml +43 -0
- data/data/problems/257.yml +18 -0
- data/data/problems/258.yml +13 -0
- data/data/problems/259.yml +16 -0
- data/data/problems/26.yml +11 -0
- data/data/problems/260.yml +30 -0
- data/data/problems/261.yml +19 -0
- data/data/problems/262.yml +20 -0
- data/data/problems/263.yml +19 -0
- data/data/problems/264.yml +20 -0
- data/data/problems/265.yml +16 -0
- data/data/problems/266.yml +10 -0
- data/data/problems/267.yml +14 -0
- data/data/problems/268.yml +8 -0
- data/data/problems/269.yml +15 -0
- data/data/problems/27.yml +25 -0
- data/data/problems/270.yml +17 -0
- data/data/problems/271.yml +13 -0
- data/data/problems/272.yml +15 -0
- data/data/problems/273.yml +21 -0
- data/data/problems/274.yml +23 -0
- data/data/problems/275.yml +19 -0
- data/data/problems/276.yml +11 -0
- data/data/problems/277.yml +24 -0
- data/data/problems/278.yml +32 -0
- data/data/problems/279.yml +6 -0
- data/data/problems/28.yml +17 -0
- data/data/problems/280.yml +13 -0
- data/data/problems/281.yml +17 -0
- data/data/problems/282.yml +10 -0
- data/data/problems/283.yml +11 -0
- data/data/problems/284.yml +22 -0
- data/data/problems/285.yml +17 -0
- data/data/problems/286.yml +12 -0
- data/data/problems/287.yml +36 -0
- data/data/problems/288.yml +15 -0
- data/data/problems/289.yml +19 -0
- data/data/problems/29.yml +24 -0
- data/data/problems/290.yml +8 -0
- data/data/problems/291.yml +10 -0
- data/data/problems/292.yml +13 -0
- data/data/problems/293.yml +15 -0
- data/data/problems/294.yml +10 -0
- data/data/problems/295.yml +26 -0
- data/data/problems/296.yml +15 -0
- data/data/problems/297.yml +19 -0
- data/data/problems/298.yml +46 -0
- data/data/problems/299.yml +31 -0
- data/data/problems/3.yml +7 -0
- data/data/problems/30.yml +12 -0
- data/data/problems/300.yml +24 -0
- data/data/problems/301.yml +25 -0
- data/data/problems/302.yml +18 -0
- data/data/problems/303.yml +11 -0
- data/data/problems/304.yml +19 -0
- data/data/problems/305.yml +14 -0
- data/data/problems/306.yml +29 -0
- data/data/problems/307.yml +12 -0
- data/data/problems/308.yml +34 -0
- data/data/problems/309.yml +17 -0
- data/data/problems/31.yml +18 -0
- data/data/problems/310.yml +19 -0
- data/data/problems/311.yml +21 -0
- data/data/problems/312.yml +15 -0
- data/data/problems/313.yml +17 -0
- data/data/problems/314.yml +29 -0
- data/data/problems/315.yml +49 -0
- data/data/problems/316.yml +25 -0
- data/data/problems/317.yml +11 -0
- data/data/problems/318.yml +61 -0
- data/data/problems/319.yml +23 -0
- data/data/problems/32.yml +14 -0
- data/data/problems/320.yml +12 -0
- data/data/problems/321.yml +18 -0
- data/data/problems/322.yml +12 -0
- data/data/problems/323.yml +19 -0
- data/data/problems/324.yml +17 -0
- data/data/problems/325.yml +25 -0
- data/data/problems/326.yml +12 -0
- data/data/problems/327.yml +39 -0
- data/data/problems/328.yml +36 -0
- data/data/problems/329.yml +17 -0
- data/data/problems/33.yml +13 -0
- data/data/problems/330.yml +40 -0
- data/data/problems/331.yml +28 -0
- data/data/problems/332.yml +16 -0
- data/data/problems/333.yml +25 -0
- data/data/problems/334.yml +39 -0
- data/data/problems/335.yml +16 -0
- data/data/problems/336.yml +24 -0
- data/data/problems/337.yml +15 -0
- data/data/problems/338.yml +41 -0
- data/data/problems/339.yml +17 -0
- data/data/problems/34.yml +7 -0
- data/data/problems/340.yml +14 -0
- data/data/problems/341.yml +18 -0
- data/data/problems/342.yml +17 -0
- data/data/problems/343.yml +29 -0
- data/data/problems/344.yml +21 -0
- data/data/problems/345.yml +26 -0
- data/data/problems/346.yml +11 -0
- data/data/problems/347.yml +16 -0
- data/data/problems/348.yml +12 -0
- data/data/problems/349.yml +13 -0
- data/data/problems/35.yml +8 -0
- data/data/problems/350.yml +18 -0
- data/data/problems/351.yml +13 -0
- data/data/problems/352.yml +49 -0
- data/data/problems/353.yml +25 -0
- data/data/problems/354.yml +16 -0
- data/data/problems/355.yml +8 -0
- data/data/problems/356.yml +10 -0
- data/data/problems/357.yml +9 -0
- data/data/problems/358.yml +31 -0
- data/data/problems/359.yml +26 -0
- data/data/problems/36.yml +8 -0
- data/data/problems/360.yml +12 -0
- data/data/problems/361.yml +20 -0
- data/data/problems/362.yml +32 -0
- data/data/problems/363.yml +33 -0
- data/data/problems/364.yml +15 -0
- data/data/problems/365.yml +17 -0
- data/data/problems/366.yml +26 -0
- data/data/problems/367.yml +20 -0
- data/data/problems/368.yml +39 -0
- data/data/problems/369.yml +15 -0
- data/data/problems/37.yml +10 -0
- data/data/problems/370.yml +16 -0
- data/data/problems/371.yml +13 -0
- data/data/problems/372.yml +16 -0
- data/data/problems/373.yml +10 -0
- data/data/problems/374.yml +25 -0
- data/data/problems/375.yml +23 -0
- data/data/problems/376.yml +25 -0
- data/data/problems/377.yml +11 -0
- data/data/problems/378.yml +15 -0
- data/data/problems/379.yml +15 -0
- data/data/problems/38.yml +18 -0
- data/data/problems/380.yml +22 -0
- data/data/problems/381.yml +21 -0
- data/data/problems/382.yml +23 -0
- data/data/problems/383.yml +13 -0
- data/data/problems/384.yml +28 -0
- data/data/problems/385.yml +22 -0
- data/data/problems/386.yml +16 -0
- data/data/problems/387.yml +19 -0
- data/data/problems/388.yml +12 -0
- data/data/problems/389.yml +12 -0
- data/data/problems/39.yml +10 -0
- data/data/problems/390.yml +18 -0
- data/data/problems/391.yml +29 -0
- data/data/problems/392.yml +22 -0
- data/data/problems/393.yml +12 -0
- data/data/problems/394.yml +22 -0
- data/data/problems/395.yml +19 -0
- data/data/problems/396.yml +28 -0
- data/data/problems/397.yml +20 -0
- data/data/problems/398.yml +13 -0
- data/data/problems/399.yml +22 -0
- data/data/problems/4.yml +8 -0
- data/data/problems/40.yml +18 -0
- data/data/problems/400.yml +18 -0
- data/data/problems/401.yml +11 -0
- data/data/problems/402.yml +25 -0
- data/data/problems/403.yml +19 -0
- data/data/problems/404.yml +21 -0
- data/data/problems/405.yml +15 -0
- data/data/problems/406.yml +46 -0
- data/data/problems/407.yml +20 -0
- data/data/problems/408.yml +14 -0
- data/data/problems/409.yml +12 -0
- data/data/problems/41.yml +8 -0
- data/data/problems/410.yml +19 -0
- data/data/problems/411.yml +23 -0
- data/data/problems/412.yml +19 -0
- data/data/problems/413.yml +13 -0
- data/data/problems/414.yml +40 -0
- data/data/problems/415.yml +19 -0
- data/data/problems/416.yml +13 -0
- data/data/problems/417.yml +21 -0
- data/data/problems/418.yml +17 -0
- data/data/problems/419.yml +22 -0
- data/data/problems/42.yml +14 -0
- data/data/problems/420.yml +13 -0
- data/data/problems/421.yml +29 -0
- data/data/problems/422.yml +22 -0
- data/data/problems/423.yml +22 -0
- data/data/problems/424.yml +37 -0
- data/data/problems/425.yml +16 -0
- data/data/problems/426.yml +29 -0
- data/data/problems/427.yml +18 -0
- data/data/problems/428.yml +32 -0
- data/data/problems/429.yml +10 -0
- data/data/problems/43.yml +17 -0
- data/data/problems/430.yml +20 -0
- data/data/problems/431.yml +33 -0
- data/data/problems/432.yml +13 -0
- data/data/problems/433.yml +18 -0
- data/data/problems/434.yml +32 -0
- data/data/problems/435.yml +21 -0
- data/data/problems/436.yml +21 -0
- data/data/problems/437.yml +22 -0
- data/data/problems/438.yml +29 -0
- data/data/problems/439.yml +17 -0
- data/data/problems/44.yml +16 -0
- data/data/problems/440.yml +21 -0
- data/data/problems/441.yml +23 -0
- data/data/problems/442.yml +9 -0
- data/data/problems/443.yml +13 -0
- data/data/problems/444.yml +28 -0
- data/data/problems/445.yml +37 -0
- data/data/problems/446.yml +29 -0
- data/data/problems/447.yml +31 -0
- data/data/problems/448.yml +14 -0
- data/data/problems/449.yml +17 -0
- data/data/problems/45.yml +15 -0
- data/data/problems/450.yml +26 -0
- data/data/problems/451.yml +15 -0
- data/data/problems/452.yml +8 -0
- data/data/problems/453.yml +16 -0
- data/data/problems/454.yml +17 -0
- data/data/problems/455.yml +16 -0
- data/data/problems/456.yml +15 -0
- data/data/problems/46.yml +18 -0
- data/data/problems/47.yml +21 -0
- data/data/problems/48.yml +7 -0
- data/data/problems/49.yml +10 -0
- data/data/problems/5.yml +8 -0
- data/data/problems/50.yml +10 -0
- data/data/problems/51.yml +15 -0
- data/data/problems/52.yml +8 -0
- data/data/problems/53.yml +28 -0
- data/data/problems/54.yml +43 -0
- data/data/problems/55.yml +21 -0
- data/data/problems/56.yml +11 -0
- data/data/problems/57.yml +15 -0
- data/data/problems/58.yml +22 -0
- data/data/problems/59.yml +23 -0
- data/data/problems/6.yml +13 -0
- data/data/problems/60.yml +10 -0
- data/data/problems/61.yml +30 -0
- data/data/problems/62.yml +9 -0
- data/data/problems/63.yml +7 -0
- data/data/problems/64.yml +130 -0
- data/data/problems/65.yml +62 -0
- data/data/problems/66.yml +27 -0
- data/data/problems/67.yml +17 -0
- data/data/problems/68.yml +23 -0
- data/data/problems/69.yml +14 -0
- data/data/problems/7.yml +6 -0
- data/data/problems/70.yml +16 -0
- data/data/problems/71.yml +17 -0
- data/data/problems/72.yml +16 -0
- data/data/problems/73.yml +16 -0
- data/data/problems/74.yml +41 -0
- data/data/problems/75.yml +16 -0
- data/data/problems/76.yml +8 -0
- data/data/problems/77.yml +8 -0
- data/data/problems/78.yml +12 -0
- data/data/problems/79.yml +11 -0
- data/data/problems/8.yml +6 -0
- data/data/problems/80.yml +11 -0
- data/data/problems/81.yml +19 -0
- data/data/problems/82.yml +19 -0
- data/data/problems/83.yml +23 -0
- data/data/problems/84.yml +63 -0
- data/data/problems/85.yml +9 -0
- data/data/problems/86.yml +15 -0
- data/data/problems/87.yml +12 -0
- data/data/problems/88.yml +53 -0
- data/data/problems/89.yml +18 -0
- data/data/problems/9.yml +13 -0
- data/data/problems/90.yml +23 -0
- data/data/problems/91.yml +19 -0
- data/data/problems/92.yml +29 -0
- data/data/problems/93.yml +21 -0
- data/data/problems/94.yml +11 -0
- data/data/problems/95.yml +23 -0
- data/data/problems/96.yml +46 -0
- data/data/problems/97.yml +14 -0
- data/data/problems/98.yml +16 -0
- data/data/problems/99.yml +16 -0
- data/euler-manager.gemspec +31 -0
- data/euler-manager.sublime-project +12 -0
- data/example/1/README.md +6 -0
- data/example/1/ruby/1.rb +5 -0
- data/example/1/scala/1.scala +9 -0
- data/example/2/README.md +9 -0
- data/example/2/python/2.py +5 -0
- data/example/2/python/euler.py +0 -0
- data/example/Eulerfile.rb +87 -0
- data/example/README.md +26 -0
- data/example/lib/euler.py +0 -0
- data/example/lib/euler.rb +0 -0
- data/example/lib/euler.scala +5 -0
- data/lib/euler.rb +190 -0
- data/lib/euler/errors.rb +7 -0
- data/lib/euler/languages.rb +12 -0
- data/lib/euler/languages/coffeescript.rb +25 -0
- data/lib/euler/languages/javascript.rb +25 -0
- data/lib/euler/languages/python.rb +27 -0
- data/lib/euler/languages/ruby.rb +25 -0
- data/lib/euler/languages/scala.rb +27 -0
- data/lib/euler/languages/templates/coffeescript.coffee +5 -0
- data/lib/euler/languages/templates/javascript.js +5 -0
- data/lib/euler/languages/templates/python.py +5 -0
- data/lib/euler/languages/templates/ruby.rb +5 -0
- data/lib/euler/languages/templates/scala.scala +9 -0
- data/lib/euler/problem.rb +60 -0
- data/lib/euler/solution.rb +98 -0
- data/lib/euler/version.rb +3 -0
- data/scripts/update_problems +68 -0
- data/spec/euler/problem_spec.rb +5 -0
- data/spec/euler/solution_spec.rb +69 -0
- data/spec/euler_spec.rb +27 -0
- data/spec/spec_helper.rb +3 -0
- metadata +644 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
---
|
2
|
+
:id: 254
|
3
|
+
:name: Sums of Digit Factorials
|
4
|
+
:url: http://projecteuler.net/problem=254
|
5
|
+
:content: "\r\n<p>Define f(<var>n</var>) as the sum of the factorials of the digits
|
6
|
+
of <var>n</var>. For example, f(342) = 3! + 4! + 2! = 32.</p>\r\n\r\n<p>Define sf(<var>n</var>)
|
7
|
+
as the sum of the digits of f(<var>n</var>). So sf(342) = 3 + 2 = 5.</p>\r\n\r\n<p>Define
|
8
|
+
g(<var>i</var>) to be the smallest positive integer <var>n</var> such that sf(<var>n</var>)
|
9
|
+
= <var>i</var>. Though sf(342) is 5, sf(25) is also 5, and it can be verified that
|
10
|
+
g(5) is 25.</p>\r\n\r\n<p>Define sg(<var>i</var>) as the sum of the digits of g(<var>i</var>).
|
11
|
+
So sg(5) = 2 + 5 = 7.</p>\r\n\r\n<p>Further, it can be verified that g(20) is 267
|
12
|
+
and <img src=\"images/symbol_sum.gif\" width=\"11\" height=\"14\" alt=\"∑\" border=\"0\"
|
13
|
+
style=\"vertical-align:middle;\"> sg(<var>i</var>) for 1 <img src=\"images/symbol_le.gif\"
|
14
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>i</var>
|
15
|
+
<img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
16
|
+
style=\"vertical-align:middle;\"> 20 is 156.</p>\r\n\r\n<p>What is <img src=\"images/symbol_sum.gif\"
|
17
|
+
width=\"11\" height=\"14\" alt=\"∑\" border=\"0\" style=\"vertical-align:middle;\"> sg(<var>i</var>)
|
18
|
+
for 1 <img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
19
|
+
style=\"vertical-align:middle;\"><var>i</var> <img src=\"images/symbol_le.gif\"
|
20
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">
|
21
|
+
150?</p>\r\n"
|
@@ -0,0 +1,59 @@
|
|
1
|
+
---
|
2
|
+
:id: 255
|
3
|
+
:name: Rounded Square Roots
|
4
|
+
:url: http://projecteuler.net/problem=255
|
5
|
+
:content: "\r\n<p>We define the <i>rounded-square-root</i> of a positive integer <var>n</var>
|
6
|
+
as the square root of <var>n</var> rounded to the nearest integer.</p>\r\n\r\n<p>The
|
7
|
+
following procedure (essentially Heron's method adapted to integer arithmetic) finds
|
8
|
+
the rounded-square-root of <var>n</var>:</p>\r\n<p>Let <var>d</var> be the number
|
9
|
+
of digits of the number <var>n</var>.<br>\r\nIf <var>d</var> is odd, set <var>x</var><sub>0</sub>
|
10
|
+
= 2<img src=\"images/symbol_times.gif\" width=\"9\" height=\"9\" alt=\"×\" border=\"0\"
|
11
|
+
style=\"vertical-align:middle;\">10<sup>(<var>d</var>-1)⁄2</sup>.<br>\r\nIf <var>d</var>
|
12
|
+
is even, set <var>x</var><sub>0</sub> = 7<img src=\"images/symbol_times.gif\" width=\"9\"
|
13
|
+
height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">10<sup>(<var>d</var>-2)⁄2</sup>.<br>\r\nRepeat:</p>\r\n<p
|
14
|
+
align=\"center\">\r\n<img src=\"project/images/p_255_Heron.gif\"></p>\r\n<!--\r\n<table
|
15
|
+
align='center'>\r\n<tr><td><var>x</var><sub><var>k</var>+1</sub> =</td>\r\n<td style='font-size:220%'>⌊</td>\r\n<td
|
16
|
+
style='text-align:center;'><var>x</var><sub><var>k</var></sub> + <img src='images/symbol_lceil.gif'
|
17
|
+
width='6' height='16' alt='⌈' border='0' style='vertical-align:middle;' /><var>n</var>⁄<var>x</var><sub><var>k</var></sub><img
|
18
|
+
src='images/symbol_rceil.gif' width='6' height='16' alt='⌉' border='0' style='vertical-align:middle;'
|
19
|
+
/><br />\r\n<img src='images/blackdot.gif' width='75' height='1' alt='' /><br />\r\n2</td><td><td
|
20
|
+
style='font-size:220%'>⌋</td></tr>\r\n</table> -->\r\n\r\n<p>until <var>x</var><sub><var>k</var>+1</sub>
|
21
|
+
= <var>x</var><sub><var>k</var></sub>.\r\n</p>\r\n<p>As an example, let us find
|
22
|
+
the rounded-square-root of <var>n</var> = 4321.<br><var>n</var> has 4 digits, so
|
23
|
+
<var>x</var><sub>0</sub> = 7<img src=\"images/symbol_times.gif\" width=\"9\" height=\"9\"
|
24
|
+
alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">10<sup>(4-2)⁄2</sup> = 70.<br><img
|
25
|
+
src=\"project/images/p_255_Example.gif\"><!--<var>x</var><sub>1</sub> = <img src='images/symbol_lfloor.gif'
|
26
|
+
width='6' height='16' alt='⌊' border='0' style='vertical-align:middle;' />(70
|
27
|
+
+ <img src='images/symbol_lceil.gif' width='6' height='16' alt='⌈' border='0'
|
28
|
+
style='vertical-align:middle;' />4321⁄70<img src='images/symbol_rceil.gif'
|
29
|
+
width='6' height='16' alt='⌉' border='0' style='vertical-align:middle;' />)⁄2<img
|
30
|
+
src='images/symbol_rfloor.gif' width='6' height='16' alt='⌋' border='0' style='vertical-align:middle;'
|
31
|
+
/> = 66.<br />\r\n<var>x</var><sub>2</sub> = <img src='images/symbol_lfloor.gif'
|
32
|
+
width='6' height='16' alt='⌊' border='0' style='vertical-align:middle;' />(66
|
33
|
+
+ <img src='images/symbol_lceil.gif' width='6' height='16' alt='⌈' border='0'
|
34
|
+
style='vertical-align:middle;' />4321⁄66<img src='images/symbol_rceil.gif'
|
35
|
+
width='6' height='16' alt='⌉' border='0' style='vertical-align:middle;' />)⁄2<img
|
36
|
+
src='images/symbol_rfloor.gif' width='6' height='16' alt='⌋' border='0' style='vertical-align:middle;'
|
37
|
+
/> = 66.--><br>\r\nSince <var>x</var><sub>2</sub> = <var>x</var><sub>1</sub>, we
|
38
|
+
stop here.<br>\r\nSo, after just two iterations, we have found that the rounded-square-root
|
39
|
+
of 4321 is 66 (the actual square root is 65.7343137…).\r\n</p>\r\n<p>The number
|
40
|
+
of iterations required when using this method is surprisingly low.<br>\r\nFor example,
|
41
|
+
we can find the rounded-square-root of a 5-digit integer (10,000 <img src=\"images/symbol_le.gif\"
|
42
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>n</var>
|
43
|
+
<img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
44
|
+
style=\"vertical-align:middle;\"> 99,999) with an average of 3.2102888889 iterations
|
45
|
+
(the average value was rounded to 10 decimal places).\r\n</p>\r\n<p>Using the procedure
|
46
|
+
described above, what is the average number of iterations required to find the rounded-square-root
|
47
|
+
of a 14-digit number (10<sup>13</sup><img src=\"images/symbol_le.gif\" width=\"10\"
|
48
|
+
height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>n</var>
|
49
|
+
<img src=\"images/symbol_lt.gif\" width=\"10\" height=\"10\" alt=\"<\" border=\"0\"
|
50
|
+
style=\"vertical-align:middle;\"> 10<sup>14</sup>)?<br>\r\nGive your answer rounded
|
51
|
+
to 10 decimal places.\r\n</p>\r\n<p>Note: The symbols <img src=\"images/symbol_lfloor.gif\"
|
52
|
+
width=\"6\" height=\"16\" alt=\"⌊\" border=\"0\" style=\"vertical-align:middle;\"><var>x</var><img
|
53
|
+
src=\"images/symbol_rfloor.gif\" width=\"6\" height=\"16\" alt=\"⌋\" border=\"0\"
|
54
|
+
style=\"vertical-align:middle;\"> and <img src=\"images/symbol_lceil.gif\" width=\"6\"
|
55
|
+
height=\"16\" alt=\"⌈\" border=\"0\" style=\"vertical-align:middle;\"><var>x</var><img
|
56
|
+
src=\"images/symbol_rceil.gif\" width=\"6\" height=\"16\" alt=\"⌉\" border=\"0\"
|
57
|
+
style=\"vertical-align:middle;\"> represent the <dfn title=\"the largest integer
|
58
|
+
not greater than x\">floor function</dfn> and <dfn title=\"the smallest integer
|
59
|
+
not less than x\">ceiling function</dfn> respectively.\r\n</p>\r\n"
|
@@ -0,0 +1,43 @@
|
|
1
|
+
---
|
2
|
+
:id: 256
|
3
|
+
:name: Tatami-Free Rooms
|
4
|
+
:url: http://projecteuler.net/problem=256
|
5
|
+
:content: "\r\n<span style=\"font-size:10pt;\">\r\n<p>Tatami are rectangular mats,
|
6
|
+
used to completely cover the floor of a room, without overlap.</p>\r\n\r\n<p>Assuming
|
7
|
+
that the only type of available tatami has dimensions 1<img src=\"images/symbol_times.gif\"
|
8
|
+
width=\"9\" height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">2,
|
9
|
+
there are obviously some limitations for the shape and size of the rooms that can
|
10
|
+
be covered.</p>\r\n\r\n<p>For this problem, we consider only rectangular rooms with
|
11
|
+
integer dimensions <var>a</var>, <var>b</var> and even size <var>s</var> = <var>a</var>·<var>b</var>.<br>\r\nWe
|
12
|
+
use the term 'size' to denote the floor surface area of the room, and — without
|
13
|
+
loss of generality — we add the condition <var>a</var> <img src=\"images/symbol_le.gif\"
|
14
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>b</var>.</p>\r\n\r\n<p>There
|
15
|
+
is one rule to follow when laying out tatami: there must be no points where corners
|
16
|
+
of four different mats meet.<br>\r\nFor example, consider the two arrangements below
|
17
|
+
for a 4<img src=\"images/symbol_times.gif\" width=\"9\" height=\"9\" alt=\"×\" border=\"0\"
|
18
|
+
style=\"vertical-align:middle;\">4 room:</p>\r\n<div align=\"center\">\r\n<img src=\"project/images/p_256_tatami3.gif\"><br>\n</div>\r\n\r\n<p>The
|
19
|
+
arrangement on the left is acceptable, whereas the one on the right is not: a red
|
20
|
+
\"<span style=\"color:red\"><b>X</b></span>\" in the middle, marks the point where
|
21
|
+
four tatami meet.</p>\r\n\r\n<p>Because of this rule, certain even-sized rooms cannot
|
22
|
+
be covered with tatami: we call them tatami-free rooms.<br>\r\nFurther, we define
|
23
|
+
<var>T</var>(<var>s</var>) as the number of tatami-free rooms of size <var>s</var>.</p>\r\n\r\n<p>The
|
24
|
+
smallest tatami-free room has size <var>s</var> = 70 and dimensions 7<img src=\"images/symbol_times.gif\"
|
25
|
+
width=\"9\" height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">10.<br>\r\nAll
|
26
|
+
the other rooms of size <var>s</var> = 70 can be covered with tatami; they are:
|
27
|
+
1<img src=\"images/symbol_times.gif\" width=\"9\" height=\"9\" alt=\"×\" border=\"0\"
|
28
|
+
style=\"vertical-align:middle;\">70, 2<img src=\"images/symbol_times.gif\" width=\"9\"
|
29
|
+
height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">35 and 5<img
|
30
|
+
src=\"images/symbol_times.gif\" width=\"9\" height=\"9\" alt=\"×\" border=\"0\"
|
31
|
+
style=\"vertical-align:middle;\">14.<br>\r\nHence, <var>T</var>(70) = 1.</p>\r\n\r\n<p>Similarly,
|
32
|
+
we can verify that <var>T</var>(1320) = 5 because there are exactly 5 tatami-free
|
33
|
+
rooms of size <var>s</var> = 1320:<br>\r\n20<img src=\"images/symbol_times.gif\"
|
34
|
+
width=\"9\" height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">66,
|
35
|
+
22<img src=\"images/symbol_times.gif\" width=\"9\" height=\"9\" alt=\"×\" border=\"0\"
|
36
|
+
style=\"vertical-align:middle;\">60, 24<img src=\"images/symbol_times.gif\" width=\"9\"
|
37
|
+
height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">55, 30<img
|
38
|
+
src=\"images/symbol_times.gif\" width=\"9\" height=\"9\" alt=\"×\" border=\"0\"
|
39
|
+
style=\"vertical-align:middle;\">44 and 33<img src=\"images/symbol_times.gif\" width=\"9\"
|
40
|
+
height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">40.<br>\r\nIn
|
41
|
+
fact, <var>s</var> = 1320 is the smallest room-size <var>s</var> for which <var>T</var>(<var>s</var>)
|
42
|
+
= 5.</p>\r\n\r\n<p>Find the smallest room-size <var>s</var> for which <var>T</var>(<var>s</var>)
|
43
|
+
= 200.</p>\r\n</span>\r\n\r\n"
|
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
:id: 257
|
3
|
+
:name: Angular Bisectors
|
4
|
+
:url: http://projecteuler.net/problem=257
|
5
|
+
:content: "\r\n<span style=\"font-size:11pt;\">\r\n<p>Given is an integer sided triangle
|
6
|
+
ABC with sides a <img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\"
|
7
|
+
border=\"0\" style=\"vertical-align:middle;\"> b <img src=\"images/symbol_le.gif\"
|
8
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">
|
9
|
+
c. \r\n(AB = c, BC = a and AC = b).<br>\r\nThe angular bisectors of the triangle
|
10
|
+
intersect the sides at points E, F and G (see picture below).\r\n</p>\r\n<div align=\"center\">\r\n<img
|
11
|
+
src=\"project/images/p_257_bisector.gif\"><br>\n</div>\r\n<p>\r\nThe segments EF,
|
12
|
+
EG and FG partition the triangle ABC into four smaller triangles: AEG, BFE, CGF
|
13
|
+
and EFG.<br>\r\nIt can be proven that for each of these four triangles the ratio
|
14
|
+
area(ABC)/area(subtriangle) is rational.<br>\r\nHowever, there exist triangles for
|
15
|
+
which some or all of these ratios are integral.\r\n</p>\r\n<p>\r\nHow many triangles
|
16
|
+
ABC with perimeter<img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\"
|
17
|
+
border=\"0\" style=\"vertical-align:middle;\">100,000,000 exist so that the ratio
|
18
|
+
area(ABC)/area(AEG) is integral?\r\n</p>\r\n</span>\r\n\r\n\r\n\r\n\r\n"
|
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
:id: 258
|
3
|
+
:name: A lagged Fibonacci sequence
|
4
|
+
:url: http://projecteuler.net/problem=258
|
5
|
+
:content: "\r\n<p>A sequence is defined as:</p>\r\n<p>\r\n</p>\n<ul>\n<li>\n<var>g</var><sub><var>k</var></sub>
|
6
|
+
= 1, for 0 <img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\"
|
7
|
+
border=\"0\" style=\"vertical-align:middle;\"><var>k</var> <img src=\"images/symbol_le.gif\"
|
8
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">
|
9
|
+
1999</li>\r\n<li>\n<var>g</var><sub><var>k</var></sub> = <var>g</var><sub><var>k</var>-2000</sub>
|
10
|
+
+ <var>g</var><sub><var>k</var>-1999</sub>, for <var>k</var> <img src=\"images/symbol_ge.gif\"
|
11
|
+
width=\"10\" height=\"12\" alt=\"≥\" border=\"0\" style=\"vertical-align:middle;\">
|
12
|
+
2000.\r\n</li>\n</ul>\n<p>Find <var>g</var><sub><var>k</var></sub> mod 20092010
|
13
|
+
for <var>k</var> = 10<sup>18</sup>.\r\n</p>"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
---
|
2
|
+
:id: 259
|
3
|
+
:name: Reachable Numbers
|
4
|
+
:url: http://projecteuler.net/problem=259
|
5
|
+
:content: "\r\n<p>A positive integer will be called <i>reachable</i> if it can result
|
6
|
+
from an arithmetic expression obeying the following rules:</p>\r\n\r\n<ul>\n<li>Uses
|
7
|
+
the digits 1 through 9, in that order and exactly once each.</li>\r\n<li>Any successive
|
8
|
+
digits can be concatenated (for example, using the digits 2, 3 and 4 we obtain the
|
9
|
+
number 234).</li>\r\n<li>Only the four usual binary arithmetic operations (addition,
|
10
|
+
subtraction, multiplication and division) are allowed.</li>\r\n<li>Each operation
|
11
|
+
can be used any number of times, or not at all.</li>\r\n<li>\n<dfn title=\"A minus
|
12
|
+
sign applied to a single operand (as opposed to a subtraction operator between two
|
13
|
+
operands)\">Unary minus</dfn> is not allowed.</li>\r\n<li>Any number of (possibly
|
14
|
+
nested) parentheses may be used to define the order of operations.</li>\r\n</ul>\n<p>For
|
15
|
+
example, 42 is reachable, since (1/23) * ((4*5)-6) * (78-9) = 42.</p>\r\n\r\n<p>What
|
16
|
+
is the sum of all positive reachable integers?</p>\r\n"
|
@@ -0,0 +1,11 @@
|
|
1
|
+
---
|
2
|
+
:id: 26
|
3
|
+
:name: Reciprocal cycles
|
4
|
+
:url: http://projecteuler.net/problem=26
|
5
|
+
:content: "\r\n\n<p>A unit fraction contains 1 in the numerator. The decimal representation
|
6
|
+
of the unit fractions with denominators 2 to 10 are given:</p>\n<blockquote>\n<table>\n<tr>\n<td>\n<sup>1</sup>/<sub>2</sub>\n</td>\n<td>= </td>\n<td>0.5</td>\n</tr>\n<tr>\n<td>\n<sup>1</sup>/<sub>3</sub>\n</td>\n<td>= </td>\n<td>0.(3)</td>\n</tr>\n<tr>\n<td>\n<sup>1</sup>/<sub>4</sub>\n</td>\n<td>= </td>\n<td>0.25</td>\n</tr>\n<tr>\n<td>\n<sup>1</sup>/<sub>5</sub>\n</td>\n<td>= </td>\n<td>0.2</td>\n</tr>\n<tr>\n<td>\n<sup>1</sup>/<sub>6</sub>\n</td>\n<td>= </td>\n<td>0.1(6)</td>\n</tr>\n<tr>\n<td>\n<sup>1</sup>/<sub>7</sub>\n</td>\n<td>= </td>\n<td>0.(142857)</td>\n</tr>\n<tr>\n<td>\n<sup>1</sup>/<sub>8</sub>\n</td>\n<td>= </td>\n<td>0.125</td>\n</tr>\n<tr>\n<td>\n<sup>1</sup>/<sub>9</sub>\n</td>\n<td>= </td>\n<td>0.(1)</td>\n</tr>\n<tr>\n<td>\n<sup>1</sup>/<sub>10</sub>\n</td>\n<td>= </td>\n<td>0.1</td>\n</tr>\n</table>\n</blockquote>\n<p>Where
|
7
|
+
0.1(6) means 0.166666..., and has a 1-digit recurring cycle. It can be seen that
|
8
|
+
<sup>1</sup>/<sub>7</sub> has a 6-digit recurring cycle.</p>\n<p>Find the value
|
9
|
+
of <i>d</i> <img src=\"images/symbol_lt.gif\" width=\"10\" height=\"10\" alt=\"<\"
|
10
|
+
border=\"0\" style=\"vertical-align:middle;\"> 1000 for which <sup>1</sup>/<sub><i>d</i></sub>
|
11
|
+
contains the longest recurring cycle in its decimal fraction part.</p>\n\r\n"
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
:id: 260
|
3
|
+
:name: Stone Game
|
4
|
+
:url: http://projecteuler.net/problem=260
|
5
|
+
:content: "\r\n<p>A game is played with three piles of stones and two players.<br>\r\nAt
|
6
|
+
her turn, a player removes one or more stones from the piles. However, if she takes
|
7
|
+
stones from more than one pile, she must remove the same number of stones from each
|
8
|
+
of the selected piles.</p>\r\n\r\n<p>In other words, the player chooses some N>0
|
9
|
+
and removes:\r\n</p>\n<ul>\n<li>N stones from any single pile; or</li>\r\n<li>N
|
10
|
+
stones from each of any two piles (2N total); or</li>\r\n<li>N stones from each
|
11
|
+
of the three piles (3N total).</li>\n</ul>\r\nThe player taking the last stone(s)
|
12
|
+
wins the game.\r\n\r\n<p>A <i>winning configuration</i> is one where the first player
|
13
|
+
can force a win.<br>\r\nFor example, (0,0,13), (0,11,11) and (5,5,5) are winning
|
14
|
+
configurations because the first player can immediately remove all stones.</p>\r\n\r\n<p>A
|
15
|
+
<i>losing configuration</i> is one where the second player can force a win, no matter
|
16
|
+
what the first player does.<br> \r\nFor example, (0,1,2) and (1,3,3) are losing
|
17
|
+
configurations: any legal move leaves a winning configuration for the second player.</p>\r\n\r\n<p>Consider
|
18
|
+
all losing configurations (x<sub>i</sub>,y<sub>i</sub>,z<sub>i</sub>) where x<sub>i</sub><img
|
19
|
+
src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">
|
20
|
+
y<sub>i</sub><img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\"
|
21
|
+
border=\"0\" style=\"vertical-align:middle;\"> z<sub>i</sub><img src=\"images/symbol_le.gif\"
|
22
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">
|
23
|
+
100.<br>\r\nWe can verify that Σ(x<sub>i</sub>+y<sub>i</sub>+z<sub>i</sub>) = 173895
|
24
|
+
for these.</p>\r\n\r\n<p>Find Σ(x<sub>i</sub>+y<sub>i</sub>+z<sub>i</sub>) where
|
25
|
+
(x<sub>i</sub>,y<sub>i</sub>,z<sub>i</sub>) ranges over the losing configurations<br>\r\nwith
|
26
|
+
x<sub>i</sub><img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\"
|
27
|
+
border=\"0\" style=\"vertical-align:middle;\"> y<sub>i</sub><img src=\"images/symbol_le.gif\"
|
28
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">
|
29
|
+
z<sub>i</sub><img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\"
|
30
|
+
border=\"0\" style=\"vertical-align:middle;\"> 1000.</p>\r\n"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
---
|
2
|
+
:id: 261
|
3
|
+
:name: Pivotal Square Sums
|
4
|
+
:url: http://projecteuler.net/problem=261
|
5
|
+
:content: "\r\n<p>Let us call a positive integer <var>k</var> a <var>square-pivot</var>,
|
6
|
+
if there is a pair of integers <var>m</var> <img src=\"images/symbol_gt.gif\" width=\"10\"
|
7
|
+
height=\"10\" alt=\">\" border=\"0\" style=\"vertical-align:middle;\"> 0 and
|
8
|
+
<var>n</var> <img src=\"images/symbol_ge.gif\" width=\"10\" height=\"12\" alt=\"≥\"
|
9
|
+
border=\"0\" style=\"vertical-align:middle;\"><var>k</var>, such that the sum of
|
10
|
+
the (<var>m</var>+1) consecutive squares up to <var>k</var> equals the sum of the
|
11
|
+
<var>m</var> consecutive squares from (<var>n</var>+1) on:</p>\r\n<div align=\"center\">\r\n(<var>k</var>-<var>m</var>)<sup>2</sup>
|
12
|
+
+ ... + <var>k</var><sup>2</sup> = (<var>n</var>+1)<sup>2</sup> + ... + (<var>n</var>+<var>m</var>)<sup>2</sup>.</div>\r\n\r\n<p>Some
|
13
|
+
small square-pivots are\r\n</p>\n<ul>\n<li>\n<b>4</b>: 3<sup>2</sup> + <b>4</b><sup>2</sup>\r\n
|
14
|
+
= 5<sup>2</sup>\n</li>\r\n<li>\n<b>21</b>: 20<sup>2</sup> + <b>21</b><sup>2</sup>
|
15
|
+
= 29<sup>2</sup>\n</li>\r\n<li>\n<b>24</b>: 21<sup>2</sup> + 22<sup>2</sup> + 23<sup>2</sup>
|
16
|
+
+ <b>24</b><sup>2</sup> = 25<sup>2</sup> + 26<sup>2</sup> + 27<sup>2</sup>\n</li>\r\n<li>\n<b>110</b>:
|
17
|
+
108<sup>2</sup> + 109<sup>2</sup> + <b>110</b><sup>2</sup> = 133<sup>2</sup> + 134<sup>2</sup>\n</li>\n</ul>\n<p>Find
|
18
|
+
the sum of all <b>distinct</b> square-pivots <img src=\"images/symbol_le.gif\" width=\"10\"
|
19
|
+
height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"> 10<sup>10</sup>.</p>\r\n"
|
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
:id: 262
|
3
|
+
:name: Mountain Range
|
4
|
+
:url: http://projecteuler.net/problem=262
|
5
|
+
:content: "\r\n<p>The following equation represents the <i>continuous</i> topography
|
6
|
+
of a mountainous region, giving the <dfn title=\"height above sea level\">elevation</dfn>
|
7
|
+
<var>h</var> at any point (<var>x</var>,<var>y</var>):</p>\r\n\r\n<div align=\"center\">\r\n<img
|
8
|
+
src=\"project/images/p_262_formula1.gif\"><br>\n</div>\r\n\r\n<p>A mosquito intends
|
9
|
+
to fly from A(200,200) to B(1400,1400), without leaving the area given by 0 ≤ <var>x</var>, <var>y</var> ≤ 1600.</p>\r\n\r\n<p>Because
|
10
|
+
of the intervening mountains, it first rises straight up to a point A', having elevation
|
11
|
+
<var>f</var>. Then, while remaining at the same elevation <var>f</var>, it flies
|
12
|
+
around any obstacles until it arrives at a point B' directly above B.</p>\r\n\r\n<p>First,
|
13
|
+
determine <var>f<sub>min</sub></var> which is the minimum constant elevation allowing
|
14
|
+
such a trip from A to B, while remaining in the specified area.<br>\r\nThen, find
|
15
|
+
the length of the shortest path between A' and B', while flying at that constant
|
16
|
+
elevation <var>f<sub>min</sub></var>.</p>\r\n\r\n<p>Give that length as your answer,
|
17
|
+
rounded to three decimal places.</p>\r\n\r\n<p><font><u>Note</u>: For convenience,
|
18
|
+
the elevation function shown above is repeated below, in a form suitable for most
|
19
|
+
programming languages:<br>\r\nh=( 5000-0.005*(x*x+y*y+x*y)+12.5*(x+y) ) * exp( -abs(0.000001*(x*x+y*y)-0.0015*(x+y)+0.7)
|
20
|
+
)</font></p>\r\n\r\n"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
---
|
2
|
+
:id: 263
|
3
|
+
:name: An engineers' dream come true
|
4
|
+
:url: http://projecteuler.net/problem=263
|
5
|
+
:content: "\r\n<p>\r\nConsider the number 6. The divisors of 6 are: 1,2,3 and 6.<br>\r\nEvery
|
6
|
+
number from 1 up to and including 6 can be written as a sum of distinct divisors
|
7
|
+
of 6:<br>\r\n1=1, 2=2, 3=1+2, 4=1+3, 5=2+3, 6=6.<br>\r\nA number <var>n</var> is
|
8
|
+
called a practical number if every number from 1 up to and including <var>n</var>
|
9
|
+
can be expressed as a sum of distinct divisors of <var>n</var>.\r\n</p>\r\n<p>\r\nA
|
10
|
+
pair of consecutive prime numbers with a difference of six is called a sexy pair
|
11
|
+
(since \"sex\" is the Latin word for \"six\"). The first sexy pair is (23, 29).\r\n</p>\r\n<p>\r\nWe
|
12
|
+
may occasionally find a triple-pair, which means three consecutive sexy prime pairs,
|
13
|
+
such that the second member of each pair is the first member of the next pair.\r\n</p>\r\n<p>\r\nWe
|
14
|
+
shall call a number <var>n</var> such that :\r\n</p>\n<ul>\n<li>(<var>n</var>-9,
|
15
|
+
<var>n</var>-3), (<var>n</var>-3,<var>n</var>+3), (<var>n</var>+3, <var>n</var>+9)
|
16
|
+
form a triple-pair, and \r\n</li>\n<li>the numbers <var>n</var>-8, <var>n</var>-4,
|
17
|
+
<var>n</var>, <var>n</var>+4 and <var>n</var>+8 are all practical,\r\n</li>\n</ul>
|
18
|
+
\r\nan engineers’ paradise.\r\n\r\n<p>\r\nFind the sum of the first four engineers’
|
19
|
+
paradises.\r\n</p>\r\n\r\n\r\n"
|
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
:id: 264
|
3
|
+
:name: Triangle Centres
|
4
|
+
:url: http://projecteuler.net/problem=264
|
5
|
+
:content: "\r\n<p>Consider all the triangles having:\r\n</p>\n<ul>\n<li>All their
|
6
|
+
vertices on <dfn title=\"Integer coordinates\">lattice points</dfn>.</li>\r\n<li>\n<dfn
|
7
|
+
title=\"Centre of the circumscribed circle\">Circumcentre</dfn> at the origin O.</li>\r\n<li>\n<dfn
|
8
|
+
title=\"Point where the three altitudes meet\">Orthocentre</dfn> at the point H(5,
|
9
|
+
0).</li>\r\n</ul>\n<p>There are nine such triangles having a perimeter <img src=\"images/symbol_le.gif\"
|
10
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">
|
11
|
+
50.<br>\r\nListed and shown in ascending order of their perimeter, they are:</p>\r\n\r\n<p></p>\n<table><tr>\n<td>A(-4,
|
12
|
+
3), B(5, 0), C(4, -3)<br>\r\nA(4, 3), B(5, 0), C(-4, -3)<br>\r\nA(-3, 4), B(5, 0),
|
13
|
+
C(3, -4)<br><br><br>\r\nA(3, 4), B(5, 0), C(-3, -4)<br>\r\nA(0, 5), B(5, 0), C(0,
|
14
|
+
-5)<br>\r\nA(1, 8), B(8, -1), C(-4, -7)<br><br><br>\r\nA(8, 1), B(1, -8), C(-4,
|
15
|
+
7)<br>\r\nA(2, 9), B(9, -2), C(-6, -7)<br>\r\nA(9, 2), B(2, -9), C(-6, 7)<br>\n</td>\r\n<td><img
|
16
|
+
src=\"project/images/p_264_TriangleCentres.gif\"></td>\r\n</tr></table>\n<p>The
|
17
|
+
sum of their perimeters, rounded to four decimal places, is 291.0089.</p>\r\n\r\n<p>Find
|
18
|
+
all such triangles with a perimeter <img src=\"images/symbol_le.gif\" width=\"10\"
|
19
|
+
height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"> 10<sup>5</sup>.<br>\r\nEnter
|
20
|
+
as your answer the sum of their perimeters rounded to four decimal places.</p>\r\n\r\n"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
---
|
2
|
+
:id: 265
|
3
|
+
:name: Binary Circles
|
4
|
+
:url: http://projecteuler.net/problem=265
|
5
|
+
:content: "\r\n<p>2<sup>N</sup> binary digits can be placed in a circle so that all
|
6
|
+
the N-digit clockwise subsequences are distinct.</p>\r\n\r\n<p>For N=3, two such
|
7
|
+
circular arrangements are possible, ignoring rotations:</p>\r\n<div align=\"center\"><img
|
8
|
+
src=\"project/images/p_265_BinaryCircles.gif\"></div>\r\n\r\n<p>For the first arrangement,
|
9
|
+
the 3-digit subsequences, in clockwise order, are:<br> 000, 001, 010, 101, 011,
|
10
|
+
111, 110 and 100.</p>\r\n\r\n<p>Each circular arrangement can be encoded as a number
|
11
|
+
by concatenating the binary digits starting with the subsequence of all zeros as
|
12
|
+
the most significant bits and proceeding clockwise. The two arrangements for N=3
|
13
|
+
are thus represented as 23 and 29:\r\n</p>\n<div align=\"center\">00010111 <sub>2</sub>
|
14
|
+
= 23</div>\r\n<div align=\"center\">00011101 <sub>2</sub> = 29</div>\r\n\r\n<p>Calling
|
15
|
+
S(N) the sum of the unique numeric representations, we can see that S(3) = 23 +
|
16
|
+
29 = 52.</p>\r\n\r\n<p>Find S(5).</p>\r\n\r\n"
|
@@ -0,0 +1,10 @@
|
|
1
|
+
---
|
2
|
+
:id: 266
|
3
|
+
:name: Pseudo Square Root
|
4
|
+
:url: http://projecteuler.net/problem=266
|
5
|
+
:content: "\r\n<p>\r\nThe divisors of 12 are: 1,2,3,4,6 and 12.<br>\r\nThe largest
|
6
|
+
divisor of 12 that does not exceed the square root of 12 is 3.<br>\r\nWe shall call
|
7
|
+
the largest divisor of an integer <var>n</var> that does not exceed the square root
|
8
|
+
of <var>n</var> the pseudo square root (PSR) of <var>n</var>.<br>\r\nIt can be seen
|
9
|
+
that PSR(3102)=47.\r\n</p>\r\n<p>\r\nLet <var>p</var> be the product of the primes
|
10
|
+
below 190.<br>\r\nFind PSR(<var>p</var>) mod 10<sup>16</sup>.\r\n</p>\r\n\r\n\r\n\r\n\r\n"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
---
|
2
|
+
:id: 267
|
3
|
+
:name: Billionaire
|
4
|
+
:url: http://projecteuler.net/problem=267
|
5
|
+
:content: "\r\n<p>You are given a unique investment opportunity.</p>\r\n<p>Starting
|
6
|
+
with £1 of capital, you can choose a fixed proportion, <var>f</var>, of your capital
|
7
|
+
to bet on a fair coin toss repeatedly for 1000 tosses.</p>\r\n<p>Your return is
|
8
|
+
double your bet for heads and you lose your bet for tails.</p>\r\n<p>For example,
|
9
|
+
if <var>f</var> = 1/4, for the first toss you bet £0.25, and if heads comes up
|
10
|
+
you win £0.5 and so then have £1.5. You then bet £0.375 and if the second toss is
|
11
|
+
tails, you have £1.125.</p>\r\n<p>Choosing <var>f</var> to maximize your chances
|
12
|
+
of having at least £1,000,000,000 after 1,000 flips, what is the chance that you
|
13
|
+
become a billionaire?</p>\r\n<p>All computations are assumed to be exact (no rounding),
|
14
|
+
but give your answer rounded to 12 digits behind the decimal point in the form 0.abcdefghijkl.</p>\r\n\r\n"
|
@@ -0,0 +1,8 @@
|
|
1
|
+
---
|
2
|
+
:id: 268
|
3
|
+
:name: Counting numbers with at least four distinct prime factors less than 100
|
4
|
+
:url: http://projecteuler.net/problem=268
|
5
|
+
:content: "\r\n<p>It can be verified that there are 23 positive integers less than
|
6
|
+
1000 that are divisible by at least four distinct primes less than 100.</p>\r\n\r\n<p>Find
|
7
|
+
how many positive integers less than 10<sup>16</sup> are divisible by at least four
|
8
|
+
distinct primes less than 100.</p>\r\n\r\n\r\n"
|
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
:id: 269
|
3
|
+
:name: Polynomials with at least one integer root
|
4
|
+
:url: http://projecteuler.net/problem=269
|
5
|
+
:content: "\r\n<p>A root or zero of a polynomial P(<var>x</var>) is a solution to
|
6
|
+
the equation P(<var>x</var>) = 0. <br>\r\nDefine P<sub><var>n</var></sub> as the
|
7
|
+
polynomial whose coefficients are the digits of <var>n</var>.<br>\r\nFor example,
|
8
|
+
P<sub>5703</sub>(<var>x</var>) = 5<var>x</var><sup>3</sup> + 7<var>x</var><sup>2</sup>
|
9
|
+
+ 3.</p>\r\n\r\n<p>We can see that:</p>\n<ul>\n<li>P<sub><var>n</var></sub>(0) is
|
10
|
+
the last digit of <var>n</var>,</li>\r\n<li>P<sub><var>n</var></sub>(1) is the sum
|
11
|
+
of the digits of <var>n</var>,</li>\r\n<li>P<sub><var>n</var></sub>(10) is <var>n</var>
|
12
|
+
itself.</li>\n</ul>\n<p>Define Z(<var>k</var>) as the number of positive integers,
|
13
|
+
<var>n</var>, not exceeding <var>k</var> for which the polynomial P<sub><var>n</var></sub>
|
14
|
+
has at least one integer root.</p>\r\n\r\n<p>It can be verified that Z(100 000)
|
15
|
+
is 14696.</p>\r\n\r\n<p>What is Z(10<sup>16</sup>)?</p>\r\n\r\n"
|
@@ -0,0 +1,25 @@
|
|
1
|
+
---
|
2
|
+
:id: 27
|
3
|
+
:name: Quadratic primes
|
4
|
+
:url: http://projecteuler.net/problem=27
|
5
|
+
:content: "\r\n<p>Euler discovered the remarkable quadratic formula:</p>\r\n<p style=\"text-align:center;\"><i>n</i>²
|
6
|
+
+ <i>n</i> + 41</p>\r\n<p>It turns out that the formula will produce 40 primes for
|
7
|
+
the consecutive values <i>n</i> = 0 to 39. However, when <i>n</i> = 40, 40<sup>2</sup>
|
8
|
+
+ 40 + 41 = 40(40 + 1) + 41 is divisible by 41, and certainly when <i>n</i> = 41,
|
9
|
+
41² + 41 + 41 is clearly divisible by 41.</p>\r\n<p>The incredible formula <i>n</i>²
|
10
|
+
<img src=\"images/symbol_minus.gif\" width=\"9\" height=\"3\" alt=\"−\" border=\"0\"
|
11
|
+
style=\"vertical-align:middle;\"> 79<i>n</i> + 1601 was discovered, which produces
|
12
|
+
80 primes for the consecutive values <i>n</i> = 0 to 79. The product of the coefficients,
|
13
|
+
<img src=\"images/symbol_minus.gif\" width=\"9\" height=\"3\" alt=\"−\" border=\"0\"
|
14
|
+
style=\"vertical-align:middle;\">79 and 1601, is <img src=\"images/symbol_minus.gif\"
|
15
|
+
width=\"9\" height=\"3\" alt=\"−\" border=\"0\" style=\"vertical-align:middle;\">126479.</p>\r\n<p>Considering
|
16
|
+
quadratics of the form:</p>\r\n<blockquote>\r\n<i>n</i>² + <i>an</i> + <i>b</i>,
|
17
|
+
where |<i>a</i>| <img src=\"images/symbol_lt.gif\" width=\"10\" height=\"10\" alt=\"<\"
|
18
|
+
border=\"0\" style=\"vertical-align:middle;\"> 1000 and |<i>b</i>| <img src=\"images/symbol_lt.gif\"
|
19
|
+
width=\"10\" height=\"10\" alt=\"<\" border=\"0\" style=\"vertical-align:middle;\">
|
20
|
+
1000<br><br><div class=\"info\" style=\"text-align:left;\">where |<i>n</i>| is the
|
21
|
+
modulus/absolute value of <i>n</i><br>e.g. |11| = 11 and |<img src=\"images/symbol_minus.gif\"
|
22
|
+
width=\"9\" height=\"3\" alt=\"−\" border=\"0\" style=\"vertical-align:middle;\">4|
|
23
|
+
= 4</div>\r\n</blockquote>\r\n<p>Find the product of the coefficients, <i>a</i>
|
24
|
+
and <i>b</i>, for the quadratic expression that produces the maximum number of primes
|
25
|
+
for consecutive values of <i>n</i>, starting with <i>n</i> = 0.</p>\r\n\r\n"
|
@@ -0,0 +1,17 @@
|
|
1
|
+
---
|
2
|
+
:id: 270
|
3
|
+
:name: Cutting Squares
|
4
|
+
:url: http://projecteuler.net/problem=270
|
5
|
+
:content: "\r\n<p>A square piece of paper with integer dimensions N<img src=\"images/symbol_times.gif\"
|
6
|
+
width=\"9\" height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">N
|
7
|
+
is placed with a corner at the origin and two of its sides along the <var>x</var>-
|
8
|
+
and <var>y</var>-axes. Then, we cut it up respecting the following rules:\r\n</p>\n<ul>\n<li>We
|
9
|
+
only make straight cuts between two points lying on different sides of the square,
|
10
|
+
and having integer coordinates.</li>\r\n<li>Two cuts cannot cross, but several cuts
|
11
|
+
can meet at the same border point.</li>\r\n<li>Proceed until no more legal cuts
|
12
|
+
can be made.</li>\r\n</ul>\n<p>Counting any reflections or rotations as distinct,
|
13
|
+
we call C(N) the number of ways to cut an N<img src=\"images/symbol_times.gif\"
|
14
|
+
width=\"9\" height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">N
|
15
|
+
square. For example, C(1) = 2 and C(2) = 30 (shown below).</p>\r\n<div align=\"center\"><img
|
16
|
+
src=\"project/images/p_270_CutSquare.gif\"></div>\r\n\r\n<p>What is C(30) mod 10<sup>8</sup>
|
17
|
+
?</p>\r\n"
|
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
:id: 271
|
3
|
+
:name: Modular Cubes, part 1
|
4
|
+
:url: http://projecteuler.net/problem=271
|
5
|
+
:content: "\r\n<p>\r\nFor a positive number <var>n</var>, define S(<var>n</var>) as
|
6
|
+
the sum of the integers <var>x,</var> for which 1<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_lt.gif\" width=\"10\" height=\"10\" alt=\"<\" border=\"0\"
|
9
|
+
style=\"vertical-align:middle;\"><var>n</var> and<br><var>x</var><sup>3</sup><img
|
10
|
+
src=\"images/symbol_cong.gif\" width=\"9\" height=\"11\" alt=\"≡\" border=\"0\"
|
11
|
+
style=\"vertical-align:middle;\">1 mod <var>n</var>.\r\n</p>\r\n<p>\r\nWhen <var>n</var>=91,
|
12
|
+
there are 8 possible values for <var>x</var>, namely : 9, 16, 22, 29, 53, 74, 79,
|
13
|
+
81.<br>\r\nThus, S(91)=9+16+22+29+53+74+79+81=363.</p>\r\n<p>\r\nFind S(13082761331670030).\r\n</p>\r\n\r\n"
|