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,22 @@
|
|
1
|
+
---
|
2
|
+
:id: 422
|
3
|
+
:name: Sequence of points on a hyperbola
|
4
|
+
:url: http://projecteuler.net/problem=422
|
5
|
+
:content: "\r\n<p>Let H be the hyperbola defined by the equation 12<var>x</var><sup>2</sup>
|
6
|
+
+ 7<var>x</var><var>y</var> - 12<var>y</var><sup>2</sup> = 625.</p>\r\n\r\n<p>Next,
|
7
|
+
define X as the point (7, 1). It can be seen that X is in H.</p>\r\n\r\n<p>Now we
|
8
|
+
define a sequence of points in H, {P<sub><var>i</var></sub> : <var>i</var> <img
|
9
|
+
src=\"images/symbol_ge.gif\" width=\"10\" height=\"12\" alt=\"≥\" border=\"0\" style=\"vertical-align:middle;\">
|
10
|
+
1}, as:\r\n</p>\n<ul>\n<li> P<sub>1</sub> = (13, 61/4).\r\n</li>\n<li> P<sub>2</sub>
|
11
|
+
= (-43/6, -4).\r\n</li>\n<li> For <var>i</var> > 2, P<sub><var>i</var></sub>
|
12
|
+
is the unique point in H that is different from P<sub><var>i</var>-1</sub> and such
|
13
|
+
that line P<sub><var>i</var></sub>P<sub><var>i</var>-1</sub> is parallel to line
|
14
|
+
P<sub><var>i</var>-2</sub>X. It can be shown that P<sub><var>i</var></sub> is well-defined,
|
15
|
+
and that its coordinates are always rational.\r\n</li>\n</ul>\n<img src=\"project/images/p422_hyperbola.gif\"><p>You
|
16
|
+
are given that P<sub>3</sub> = (-19/2, -229/24), P<sub>4</sub> = (1267/144, -37/12)
|
17
|
+
and P<sub>7</sub> = (17194218091/143327232, 274748766781/1719926784).</p>\r\n\r\n<p>Find
|
18
|
+
P<sub><var>n</var></sub> for <var>n</var> = 11<sup>14</sup> in the following format:<br>If
|
19
|
+
P<sub><var>n</var></sub> = (<var>a</var>/<var>b</var>, <var>c</var>/<var>d</var>)
|
20
|
+
where the fractions are in lowest terms and the denominators are positive, then
|
21
|
+
the answer is (<var>a</var> + <var>b</var> + <var>c</var> + <var>d</var>) mod 1 000 000 007.</p>\r\n\r\n<p>For
|
22
|
+
<var>n</var> = 7, the answer would have been: 806236837.</p>\r\n"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
:id: 423
|
3
|
+
:name: Consecutive die throws
|
4
|
+
:url: http://projecteuler.net/problem=423
|
5
|
+
:content: "\r\n<p>Let <var>n</var> be a positive integer.<br>\r\nA 6-sided die is
|
6
|
+
thrown <var>n</var> times. Let <var>c</var> be the number of pairs of consecutive
|
7
|
+
throws that give the same value.</p>\r\n\r\n<p>For example, if <var>n</var> = 7
|
8
|
+
and the values of the die throws are (1,1,5,6,6,6,3), then the following pairs of
|
9
|
+
consecutive throws give the same value:<br>\r\n(<u>1,1</u>,5,6,6,6,3)<br>\r\n(1,1,5,<u>6,6</u>,6,3)<br>\r\n(1,1,5,6,<u>6,6</u>,3)<br>\r\nTherefore,
|
10
|
+
<var>c</var> = 3 for (1,1,5,6,6,6,3).</p>\r\n\r\n<p>Define C(<var>n</var>) as the
|
11
|
+
number of outcomes of throwing a 6-sided die <var>n</var> times such that <var>c</var>
|
12
|
+
does not exceed π(<var>n</var>).<sup>1</sup><br>\r\nFor example, C(3) = 216, C(4)
|
13
|
+
= 1290, C(11) = 361912500 and C(24) = 4727547363281250000.</p>\r\n\r\n<p>Define
|
14
|
+
S(<var>L</var>) as <img src=\"images/symbol_sum.gif\" width=\"11\" height=\"14\"
|
15
|
+
alt=\"∑\" border=\"0\" style=\"vertical-align:middle;\"> C(<var>n</var>) for 1 <img
|
16
|
+
src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>n</var>
|
17
|
+
<img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
18
|
+
style=\"vertical-align:middle;\"><var>L</var>.<br>\r\nFor example, S(50) mod 1 000 000 007
|
19
|
+
= 832833871.</p>\r\n\r\n<p>Find S(50 000 000) mod 1 000 000 007.</p>\r\n\r\n<p><sup>1</sup>
|
20
|
+
π denotes the <b>prime-counting function</b>, i.e. π(<var>n</var>) is the number
|
21
|
+
of primes <img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\"
|
22
|
+
border=\"0\" style=\"vertical-align:middle;\"><var>n</var>.</p>\r\n"
|
@@ -0,0 +1,37 @@
|
|
1
|
+
---
|
2
|
+
:id: 424
|
3
|
+
:name: Kakuro
|
4
|
+
:url: http://projecteuler.net/problem=424
|
5
|
+
:content: "\r\n<p align=\"center\">\r\n<img src=\"project/images/p_424_kakuro1.gif\"></p>\r\n<p>\r\nThe
|
6
|
+
above is an example of a cryptic kakuro (also known as cross sums, or even sums
|
7
|
+
cross) puzzle, with its final solution on the right. (The common rules of kakuro
|
8
|
+
puzzles can be found easily on numerous internet sites. Other related information
|
9
|
+
can also be currently found at <a href=\"http://krazydad.com/\">krazydad.com</a>
|
10
|
+
whose author has provided the puzzle data for this challenge.)\r\n</p>\n<p>\r\n</p>\n<p>\r\nThe
|
11
|
+
downloadable text file (<a href=\"project/kakuro200.txt\">kakuro200.txt</a>) contains
|
12
|
+
the description of 200 such puzzles, a mix of 5x5 and 6x6 types. The first puzzle
|
13
|
+
in the file is the above example which is coded as follows:\r\n</p>\r\n<p>\r\n6,X,X,(vCC),(vI),X,X,X,(hH),B,O,(vCA),(vJE),X,(hFE,vD),O,O,O,O,(hA),O,I,(hJC,vB),O,O,(hJC),H,O,O,O,X,X,X,(hJE),O,O,X\r\n</p>\r\n<p>\r\nThe
|
14
|
+
first character is a numerical digit indicating the size of the information grid.
|
15
|
+
It would be either a 6 (for a 5x5 kakuro puzzle) or a 7 (for a 6x6 puzzle) followed
|
16
|
+
by a comma (,). The extra top line and left column are needed to insert information.\r\n</p>\r\n<p>\r\nThe
|
17
|
+
content of each cell is then described and followed by a comma, going left to right
|
18
|
+
and starting with the top line.<br>\r\nX = Gray cell, not required to be filled
|
19
|
+
by a digit.<br>\r\nO (upper case letter)= White empty cell to be filled by a digit.<br>\r\nA
|
20
|
+
= Or any one of the upper case letters from A to J to be replaced by its equivalent
|
21
|
+
digit in the solved puzzle.<br>\r\n( ) = Location of the encrypted sums. Horizontal
|
22
|
+
sums are preceded by a lower case \"h\" and vertical sums are preceded by a lower
|
23
|
+
case \"v\". Those are followed by one or two upper case letters depending if the
|
24
|
+
sum is a single digit or double digit one. For double digit sums, the first letter
|
25
|
+
would be for the \"tens\" and the second one for the \"units\". When the cell must
|
26
|
+
contain information for both a horizontal and a vertical sum, the first one is always
|
27
|
+
for the horizontal sum and the two are separated by a comma within the same set
|
28
|
+
of brackets, ex.: (hFE,vD). Each set of brackets is also immediately followed by
|
29
|
+
a comma.\r\n</p>\r\n<p>\r\nThe description of the last cell is followed by a Carriage
|
30
|
+
Return/Line Feed (CRLF) instead of a comma.\r\n</p>\r\n<p>\r\nThe required answer
|
31
|
+
to each puzzle is based on the value of each letter necessary to arrive at the solution
|
32
|
+
and according to the alphabetical order. As indicated under the example puzzle,
|
33
|
+
its answer would be 8426039571. At least 9 out of the 10 encrypting letters are
|
34
|
+
always part of the problem description. When only 9 are given, the missing one must
|
35
|
+
be assigned the remaining digit.\r\n</p>\r\n<p>\r\nYou are given that the sum of
|
36
|
+
the answers for the first 10 puzzles in the file is 64414157580.\r\n</p>\r\n<p>\r\nFind
|
37
|
+
the sum of the answers for the 200 puzzles.\r\n</p>\r\n\r\n\r\n\r\n"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
---
|
2
|
+
:id: 425
|
3
|
+
:name: Prime connection
|
4
|
+
:url: http://projecteuler.net/problem=425
|
5
|
+
:content: "\r\n<p>\r\nTwo positive numbers A and B are said to be <i>connected</i>
|
6
|
+
(denoted by \"A ↔ B\") if one of these conditions holds:<br>\r\n(1) A and B have
|
7
|
+
the same length and differ in exactly one digit; for example, 123 ↔ 173.<br>\r\n(2)
|
8
|
+
Adding one digit to the left of A (or B) makes B (or A); for example, 23 ↔ 223 and
|
9
|
+
123 ↔ 23.\r\n</p>\r\n<p>\r\nWe call a prime P a <i>2's relative</i> if there exists
|
10
|
+
a chain of connected primes between 2 and P and no prime in the chain exceeds P.\r\n</p>\r\n<p>\r\nFor
|
11
|
+
example, 127 is a 2's relative. One of the possible chains is shown below:<br>\r\n2
|
12
|
+
↔ 3 ↔ 13 ↔ 113 ↔ 103 ↔ 107 ↔ 127<br>\r\nHowever, 11 and 103 are not 2's relatives.\r\n</p>\r\n<p>\r\nLet
|
13
|
+
F(N) be the sum of the primes <img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\"
|
14
|
+
alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"> N which are not 2's relatives.<br>\r\nWe
|
15
|
+
can verify that F(10<sup>3</sup>) = 431 and F(10<sup>4</sup>) = 78728.\r\n</p>\r\n<p>\r\nFind
|
16
|
+
F(10<sup>7</sup>).\r\n</p>\r\n"
|
@@ -0,0 +1,29 @@
|
|
1
|
+
---
|
2
|
+
:id: 426
|
3
|
+
:name: Box-ball system
|
4
|
+
:url: http://projecteuler.net/problem=426
|
5
|
+
:content: "\r\n<p>\r\nConsider an infinite row of boxes. Some of the boxes contain
|
6
|
+
a ball. For example, an initial configuration of 2 consecutive occupied boxes followed
|
7
|
+
by 2 empty boxes, 2 occupied boxes, 1 empty box, and 2 occupied boxes can be denoted
|
8
|
+
by the sequence (2, 2, 2, 1, 2), in which the number of consecutive occupied and
|
9
|
+
empty boxes appear alternately.\r\n</p>\r\n<p>\r\nA turn consists of moving each
|
10
|
+
ball exactly once according to the following rule: Transfer the leftmost ball which
|
11
|
+
has not been moved to the nearest empty box to its right.\r\n</p>\r\n<p>\r\nAfter
|
12
|
+
one turn the sequence (2, 2, 2, 1, 2) becomes (2, 2, 1, 2, 3) as can be seen below;
|
13
|
+
note that we begin the new sequence starting at the first occupied box.\r\n</p>\r\n\r\n<div
|
14
|
+
align=\"center\">\r\n<img src=\"project/images/p_426_baxball1.gif\">\n</div>\r\n\r\n<p>\r\nA
|
15
|
+
system like this is called a <b>Box-Ball System</b> or <b>BBS</b> for short.\r\n</p>\r\n<p>\r\nIt
|
16
|
+
can be shown that after a sufficient number of turns, the system evolves to a state
|
17
|
+
where the consecutive numbers of occupied boxes is invariant. In the example below,
|
18
|
+
the consecutive numbers of <b>occupied boxes</b> evolves to [1, 2, 3]; we shall
|
19
|
+
call this the final state.\r\n</p>\r\n\r\n<div align=\"center\">\r\n<img src=\"project/images/p_426_baxball2.gif\">\n</div>\r\n\r\n<p>\r\nWe
|
20
|
+
define the sequence {<var>t</var><sub><var>i</var></sub>}:<br></p>\n<ul>\n<li>\n<var>s</var><sub>0</sub>
|
21
|
+
= 290797\r\n</li>\n<li>\n<var>s</var><sub><var>k</var>+1</sub> = <var>s</var><sub><var>k</var></sub><sup>2</sup>
|
22
|
+
mod 50515093\r\n</li>\n<li>\n<var>t</var><sub><var>k</var></sub> = (<var>s</var><sub><var>k</var></sub>
|
23
|
+
mod 64) + 1\r\n</li>\n</ul>\n<p>\r\nStarting from the initial configuration (<var>t</var><sub>0</sub>,
|
24
|
+
<var>t</var><sub>1</sub>, …, <var>t</var><sub>10</sub>), the final state becomes
|
25
|
+
[1, 3, 10, 24, 51, 75].<br>\r\nStarting from the initial configuration (<var>t</var><sub>0</sub>,
|
26
|
+
<var>t</var><sub>1</sub>, …, <var>t</var><sub>10 000 000</sub>), find the final
|
27
|
+
state.<br>\r\nGive as your answer the sum of the squares of the elements of the
|
28
|
+
final state. For example, if the final state is [1, 2, 3] then 14 ( = 1<sup>2</sup>
|
29
|
+
+ 2<sup>2</sup> + 3<sup>2</sup>) is your answer.\r\n</p>\r\n"
|
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
:id: 427
|
3
|
+
:name: n-sequences
|
4
|
+
:url: http://projecteuler.net/problem=427
|
5
|
+
:content: "\r\n<p>A sequence of integers S = {s<sub><var>i</var></sub>} is called
|
6
|
+
an <var>n-sequence</var> if it has <var>n</var> elements and each element s<sub><var>i</var></sub>
|
7
|
+
satisfies 1 <img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\"
|
8
|
+
border=\"0\" style=\"vertical-align:middle;\"> s<sub><var>i</var></sub><img src=\"images/symbol_le.gif\"
|
9
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>n</var>.
|
10
|
+
Thus there are <var>n</var><sup><var>n</var></sup> distinct <var>n</var>-sequences
|
11
|
+
in total.\r\nFor example, the sequence S = {1, 5, 5, 10, 7, 7, 7, 2, 3, 7} is a
|
12
|
+
10-sequence.</p>\r\n\r\n<p>For any sequence S, let L(S) be the length of the longest
|
13
|
+
contiguous subsequence of S with the same value.\r\nFor example, for the given sequence
|
14
|
+
S above, L(S) = 3, because of the three consecutive 7's.</p>\r\n\r\n<p>Let <var>f</var>(<var>n</var>)
|
15
|
+
= <img src=\"images/symbol_sum.gif\" width=\"11\" height=\"14\" alt=\"∑\" border=\"0\"
|
16
|
+
style=\"vertical-align:middle;\"> L(S) for all <var>n</var>-sequences S.</p>\r\n\r\n<p>For
|
17
|
+
example, <var>f</var>(3) = 45, <var>f</var>(7) = 1403689 and <var>f</var>(11) =
|
18
|
+
481496895121.</p>\r\n\r\n<p>Find <var>f</var>(7 500 000) mod 1 000 000 009.</p>\r\n\r\n\r\n"
|
@@ -0,0 +1,32 @@
|
|
1
|
+
---
|
2
|
+
:id: 428
|
3
|
+
:name: Necklace of circles
|
4
|
+
:url: http://projecteuler.net/problem=428
|
5
|
+
:content: "\r\n<p>Let <var>a</var>, <var>b</var> and <var>c</var> be positive numbers.<br>\r\nLet
|
6
|
+
W, X, Y, Z be four collinear points where |WX| = <var>a</var>, |XY| = <var>b</var>,
|
7
|
+
|YZ| = <var>c</var> and |WZ| = <var>a</var> + <var>b</var> + <var>c</var>.<br>\r\nLet
|
8
|
+
C<sub>in</sub> be the circle having the diameter XY.<br>\r\nLet C<sub>out</sub>
|
9
|
+
be the circle having the diameter WZ.<br></p>\r\n\r\n<p>\r\nThe triplet (<var>a</var>,
|
10
|
+
<var>b</var>, <var>c</var>) is called a <em>necklace triplet</em> if you can place
|
11
|
+
<var>k</var> <img src=\"images/symbol_ge.gif\" width=\"10\" height=\"12\" alt=\"≥\"
|
12
|
+
border=\"0\" style=\"vertical-align:middle;\"> 3 distinct circles C<sub>1</sub>,
|
13
|
+
C<sub>2</sub>, ..., C<sub><var>k</var></sub> such that:\r\n</p>\n<ul>\n<li>C<sub><var>i</var></sub>
|
14
|
+
has no common interior points with any C<sub><var>j</var></sub> for 1 <img src=\"images/symbol_le.gif\"
|
15
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>i</var>,
|
16
|
+
<var>j</var> <img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\"
|
17
|
+
border=\"0\" style=\"vertical-align:middle;\"><var>k</var> and <var>i</var> <img
|
18
|
+
src=\"images/symbol_ne.gif\" width=\"11\" height=\"10\" alt=\"≠\" border=\"0\" style=\"vertical-align:middle;\"><var>j</var>,\r\n</li>\n<li>C<sub><var>i</var></sub>
|
19
|
+
is tangent to both C<sub>in</sub> and C<sub>out</sub> for 1 <img src=\"images/symbol_le.gif\"
|
20
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>i</var>
|
21
|
+
<img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
22
|
+
style=\"vertical-align:middle;\"><var>k</var>,\r\n</li>\n<li>C<sub><var>i</var></sub>
|
23
|
+
is tangent to C<sub><var>i</var>+1</sub> for 1 <img src=\"images/symbol_le.gif\"
|
24
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>i</var>
|
25
|
+
k, and\r\n</li>\n<li>C<sub><var>k</var></sub> is tangent to C<sub>1</sub>.\r\n</li>\n</ul>\n<p>\r\nFor
|
26
|
+
example, (5, 5, 5) and (4, 3, 21) are necklace triplets, while it can be shown that
|
27
|
+
(2, 2, 5) is not.\r\n</p>\r\n<p align=\"center\"><img src=\"project/images/p428_necklace.png\"></p>\r\n\r\n<p>\r\nLet
|
28
|
+
T(<var>n</var>) be the number of necklace triplets (<var>a</var>, <var>b</var>,
|
29
|
+
<var>c</var>) such that <var>a</var>, <var>b</var> and <var>c</var> are positive
|
30
|
+
integers, and <var>b</var> <img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\"
|
31
|
+
alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>n</var>.\r\nFor example,
|
32
|
+
T(1) = 9, T(20) = 732 and T(3000) = 438106.\r\n</p>\r\n<p>\r\nFind T(1 000 000 000).\r\n</p>\r\n"
|
@@ -0,0 +1,10 @@
|
|
1
|
+
---
|
2
|
+
:id: 429
|
3
|
+
:name: Sum of squares of unitary divisors
|
4
|
+
:url: http://projecteuler.net/problem=429
|
5
|
+
:content: "\r\n<p>\r\nA unitary divisor <var>d</var> of a number <var>n</var> is a
|
6
|
+
divisor of <var>n</var> that has the property gcd(<var>d, n/d</var>) = 1.<br>\r\nThe
|
7
|
+
unitary divisors of 4! = 24 are 1, 3, 8 and 24.<br>\r\nThe sum of their squares
|
8
|
+
is 1<sup>2</sup> + 3<sup>2</sup> + 8<sup>2</sup> + 24<sup>2</sup> = 650.\r\n</p>\r\n<p>\r\nLet
|
9
|
+
S(<var>n</var>) represent the sum of the squares of the unitary divisors of <var>n</var>.
|
10
|
+
Thus S(4!)=650.\r\n</p>\r\n<p>\r\nFind S(100 000 000!) modulo 1 000 000 009.\r\n</p>\r\n"
|
@@ -0,0 +1,17 @@
|
|
1
|
+
---
|
2
|
+
:id: 43
|
3
|
+
:name: Sub-string divisibility
|
4
|
+
:url: http://projecteuler.net/problem=43
|
5
|
+
:content: "\r\n<p>The number, 1406357289, is a 0 to 9 pandigital number because it
|
6
|
+
is made up of each of the digits 0 to 9 in some order, but it also has a rather
|
7
|
+
interesting sub-string divisibility property.</p>\r\n<p>Let <i>d</i><sub>1</sub>
|
8
|
+
be the 1<sup>st</sup> digit, <i>d</i><sub>2</sub> be the 2<sup>nd</sup> digit, and
|
9
|
+
so on. In this way, we note the following:</p>\r\n<ul>\n<li>\n<i>d</i><sub>2</sub><i>d</i><sub>3</sub><i>d</i><sub>4</sub>=406
|
10
|
+
is divisible by 2</li>\r\n<li>\n<i>d</i><sub>3</sub><i>d</i><sub>4</sub><i>d</i><sub>5</sub>=063
|
11
|
+
is divisible by 3</li>\r\n<li>\n<i>d</i><sub>4</sub><i>d</i><sub>5</sub><i>d</i><sub>6</sub>=635
|
12
|
+
is divisible by 5</li>\r\n<li>\n<i>d</i><sub>5</sub><i>d</i><sub>6</sub><i>d</i><sub>7</sub>=357
|
13
|
+
is divisible by 7</li>\r\n<li>\n<i>d</i><sub>6</sub><i>d</i><sub>7</sub><i>d</i><sub>8</sub>=572
|
14
|
+
is divisible by 11</li>\r\n<li>\n<i>d</i><sub>7</sub><i>d</i><sub>8</sub><i>d</i><sub>9</sub>=728
|
15
|
+
is divisible by 13</li>\r\n<li>\n<i>d</i><sub>8</sub><i>d</i><sub>9</sub><i>d</i><sub>10</sub>=289
|
16
|
+
is divisible by 17</li>\r\n</ul>\n<p>Find the sum of all 0 to 9 pandigital numbers
|
17
|
+
with this property.</p>\r\n\r\n"
|
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
:id: 430
|
3
|
+
:name: Range flips
|
4
|
+
:url: http://projecteuler.net/problem=430
|
5
|
+
:content: "\r\n<p><var>N</var> disks are placed in a row, indexed 1 to <var>N</var>
|
6
|
+
from left to right.<br>\r\nEach disk has a black side and white side. Initially
|
7
|
+
all disks show their white side.</p>\r\n\r\n<p>At each turn, two, not necessarily
|
8
|
+
distinct, integers <var>A</var> and <var>B</var> between 1 and <var>N</var> (inclusive)
|
9
|
+
are chosen uniformly at random.<br>\r\nAll disks with an index from <var>A</var>
|
10
|
+
to <var>B</var> (inclusive) are flipped.</p>\r\n\r\n<p>The following example shows
|
11
|
+
the case <var>N</var> = 8. At the first turn <var>A</var> = 5 and <var>B</var> =
|
12
|
+
2, and at the second turn <var>A</var> = 4 and <var>B</var> = 6.</p>\r\n\r\n<p align=\"center\"><img
|
13
|
+
src=\"project/images/p_430_flips.gif\"></p>\r\n\r\n<p>Let E(<var>N</var>, <var>M</var>)
|
14
|
+
be the expected number of disks that show their white side after <var>M</var> turns.<br>\r\nWe
|
15
|
+
can verify that E(3, 1) = 10/9, E(3, 2) = 5/3, E(10, 4) <img src=\"images/symbol_asymp.gif\"
|
16
|
+
width=\"11\" height=\"9\" alt=\"≈\" border=\"0\" style=\"vertical-align:middle;\">
|
17
|
+
5.157 and E(100, 10) <img src=\"images/symbol_asymp.gif\" width=\"11\" height=\"9\"
|
18
|
+
alt=\"≈\" border=\"0\" style=\"vertical-align:middle;\"> 51.893.</p>\r\n\r\n<p>Find
|
19
|
+
E(10<sup>10</sup>, 4000).<br>\r\nGive your answer rounded to 2 decimal places behind
|
20
|
+
the decimal point.</p>\r\n"
|
@@ -0,0 +1,33 @@
|
|
1
|
+
---
|
2
|
+
:id: 431
|
3
|
+
:name: Square Space Silo
|
4
|
+
:url: http://projecteuler.net/problem=431
|
5
|
+
:content: "\r\n<p>Fred the farmer arranges to have a new storage silo installed on
|
6
|
+
his farm and having an obsession for all things square he is absolutely devastated
|
7
|
+
when he discovers that it is circular. Quentin, the representative from the company
|
8
|
+
that installed the silo, explains that they only manufacture cylindrical silos,
|
9
|
+
but he points out that it is resting on a square base. Fred is not amused and insists
|
10
|
+
that it is removed from his property.</p>\r\n\r\n<p>Quick thinking Quentin explains
|
11
|
+
that when granular materials are delivered from above a conical slope is formed
|
12
|
+
and the natural angle made with the horizontal is called the angle of repose. For
|
13
|
+
example if the angle of repose, $\\alpha = 30$ degrees, and grain is delivered at
|
14
|
+
the centre of the silo then a perfect cone will form towards the top of the cylinder.
|
15
|
+
In the case of this silo, which has a diameter of 6m, the amount of space wasted
|
16
|
+
would be approximately 32.648388556 m<sup>3</sup>. However, if grain is delivered
|
17
|
+
at a point on the top which has a horizontal distance of $x$ metres from the centre
|
18
|
+
then a cone with a strangely curved and sloping base is formed. He shows Fred a
|
19
|
+
picture.</p>\r\n\r\n<div style=\"text-align:center;\">\r\n <img src=\"project/images/p_431_grain_silo.png\">\n</div>\r\n\r\n<p>We
|
20
|
+
shall let the amount of space wasted in cubic metres be given by $V(x)$. If $x =
|
21
|
+
1.114785284$, which happens to have three squared decimal places, then the amount
|
22
|
+
of space wasted, $V(1.114785284) \\approx 36$. Given the range of possible solutions
|
23
|
+
to this problem there is exactly one other option: $V(2.511167869) \\approx 49$.
|
24
|
+
It would be like knowing that the square is king of the silo, sitting in splendid
|
25
|
+
glory on top of your grain.</p>\r\n\r\n<p>Fred's eyes light up with delight at this
|
26
|
+
elegant resolution, but on closer inspection of Quentin's drawings and calculations
|
27
|
+
his happiness turns to despondency once more. Fred points out to Quentin that it's
|
28
|
+
the radius of the silo that is 6 metres, not the diameter, and the angle of repose
|
29
|
+
for his grain is 40 degrees. However, if Quentin can find a set of solutions for
|
30
|
+
this particular silo then he will be more than happy to keep it.</p>\r\n\r\n<p>If
|
31
|
+
Quick thinking Quentin is to satisfy frustratingly fussy Fred the farmer's appetite
|
32
|
+
for all things square then determine the values of $x$ for all possible square space
|
33
|
+
wastage options and calculate $\\sum x$ correct to 9 decimal places.</p>\r\n"
|
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
:id: 432
|
3
|
+
:name: Totient sum
|
4
|
+
:url: http://projecteuler.net/problem=432
|
5
|
+
:content: "\r\n<p>\r\nLet S(<var>n,m</var>) = <img src=\"images/symbol_sum.gif\" width=\"11\"
|
6
|
+
height=\"14\" alt=\"∑\" border=\"0\" style=\"vertical-align:middle;\">φ(<var>n <img
|
7
|
+
src=\"images/symbol_times.gif\" width=\"9\" height=\"9\" alt=\"×\" border=\"0\"
|
8
|
+
style=\"vertical-align:middle;\"> i</var>) for 1 <img src=\"images/symbol_le.gif\"
|
9
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>i
|
10
|
+
<img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
11
|
+
style=\"vertical-align:middle;\"> m</var>. (φ is Euler's totient function)<br>\r\nYou
|
12
|
+
are given that S(510510,10<sup>6</sup> )= 45480596821125120. \r\n</p>\r\n<p>\r\nFind
|
13
|
+
S(510510,10<sup>11</sup>).<br>\r\nGive the last 9 digits of your answer.\r\n</p>\r\n\r\n"
|
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
:id: 433
|
3
|
+
:name: Steps in Euclid's algorithm
|
4
|
+
:url: http://projecteuler.net/problem=433
|
5
|
+
:content: "\r\n<p>\r\nLet E(<var>x</var><sub>0</sub>, <var>y</var><sub>0</sub>) be
|
6
|
+
the number of steps it takes to determine the greatest common divisor of <var>x</var><sub>0</sub>
|
7
|
+
and <var>y</var><sub>0</sub> with <b>Euclid's algorithm</b>. More formally:<br><var>x</var><sub>1</sub>
|
8
|
+
= <var>y</var><sub>0</sub>, <var>y</var><sub>1</sub> = <var>x</var><sub>0</sub>
|
9
|
+
mod <var>y</var><sub>0</sub><br><var>x<sub>n</sub></var> = <var>y</var><sub><var>n</var>-1</sub>,
|
10
|
+
<var>y</var><sub><var>n</var></sub> = <var>x</var><sub><var>n</var>-1</sub> mod
|
11
|
+
<var>y</var><sub><var>n</var>-1</sub><br>\r\nE(<var>x</var><sub>0</sub>, <var>y</var><sub>0</sub>)
|
12
|
+
is the smallest <var>n</var> such that <var>y</var><sub><var>n</var></sub> = 0.\r\n</p>\r\n<p>\r\nWe
|
13
|
+
have E(1,1) = 1, E(10,6) = 3 and E(6,10) = 4.\r\n</p>\r\n<p>\r\nDefine S(N) as the
|
14
|
+
sum of E(<var>x,y</var>) for 1 <img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\"
|
15
|
+
alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>x,y</var> <img src=\"images/symbol_le.gif\"
|
16
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">
|
17
|
+
N.<br>\r\nWe have S(1) = 1, S(10) = 221 and S(100) = 39826.\r\n</p>\r\n<p>\r\nFind
|
18
|
+
S(5·10<sup>6</sup>).\r\n</p>\r\n\r\n\r\n"
|
@@ -0,0 +1,32 @@
|
|
1
|
+
---
|
2
|
+
:id: 434
|
3
|
+
:name: Rigid graphs
|
4
|
+
:url: http://projecteuler.net/problem=434
|
5
|
+
:content: "\r\n<p>Recall that a graph is a collection of vertices and edges connecting
|
6
|
+
the vertices, and that two vertices connected by an edge are called adjacent.<br>\r\nGraphs
|
7
|
+
can be embedded in Euclidean space by associating each vertex with a point in the
|
8
|
+
Euclidean space.<br>\r\nA <strong>flexible</strong> graph is an embedding of a graph
|
9
|
+
where it is possible to move one or more vertices continuously so that the distance
|
10
|
+
between at least two nonadjacent vertices is altered while the distances between
|
11
|
+
each pair of adjacent vertices is kept constant.<br>\r\nA <strong>rigid</strong>
|
12
|
+
graph is an embedding of a graph which is not flexible.<br>\r\nInformally, a graph
|
13
|
+
is rigid if by replacing the vertices with fully rotating hinges and the edges with
|
14
|
+
rods that are unbending and inelastic, no parts of the graph can be moved independently
|
15
|
+
from the rest of the graph.\r\n</p>\r\n<p>The <strong>grid graphs</strong> embedded
|
16
|
+
in the Euclidean plane are not rigid, as the following animation demonstrates:<br><img
|
17
|
+
src=\"project/images/p434_rigid.gif\"></p>\r\n<p>However, one can make them rigid
|
18
|
+
by adding diagonal edges to the cells. For example, for the 2x3 grid graph, there
|
19
|
+
are 19 ways to make the graph rigid:<br><img src=\"project/images/p434_rigid23.png\"></p>\r\n<p>Note
|
20
|
+
that for the purposes of this problem, we do not consider changing the orientation
|
21
|
+
of a diagonal edge or adding both diagonal edges to a cell as a different way of
|
22
|
+
making a grid graph rigid.\r\n</p>\r\n<p>Let <var>R</var>(<var>m</var>,<var>n</var>)
|
23
|
+
be the number of ways to make the <var>m</var> <img src=\"images/symbol_times.gif\"
|
24
|
+
width=\"9\" height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\"><var>n</var>
|
25
|
+
grid graph rigid. <br>\r\nE.g. <var>R</var>(2,3) = 19 and <var>R</var>(5,5) = 23679901\r\n</p>\r\n<p>Define
|
26
|
+
<var>S</var>(<var>N</var>) as <img src=\"images/symbol_sum.gif\" width=\"11\" height=\"14\"
|
27
|
+
alt=\"∑\" border=\"0\" style=\"vertical-align:middle;\"><var>R</var>(<var>i</var>,<var>j</var>)
|
28
|
+
for 1 <img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
29
|
+
style=\"vertical-align:middle;\"><var>i</var>, <var>j</var> <img src=\"images/symbol_le.gif\"
|
30
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>N</var>.<br>\r\nE.g.
|
31
|
+
<var>S</var>(5) = 25021721.<br>\r\nFind <var>S</var>(100), give your answer modulo
|
32
|
+
1000000033\r\n</p>\r\n"
|
@@ -0,0 +1,21 @@
|
|
1
|
+
---
|
2
|
+
:id: 435
|
3
|
+
:name: Polynomials of Fibonacci numbers
|
4
|
+
:url: http://projecteuler.net/problem=435
|
5
|
+
:content: "\r\n<p>The <strong>Fibonacci numbers</strong> {f<sub>n</sub>, n <img src=\"images/symbol_ge.gif\"
|
6
|
+
width=\"10\" height=\"12\" alt=\"≥\" border=\"0\" style=\"vertical-align:middle;\">
|
7
|
+
0} are defined recursively as f<sub>n</sub> = f<sub>n-1</sub> + f<sub>n-2</sub>
|
8
|
+
with base cases f<sub>0</sub> = 0 and f<sub>1</sub> = 1.</p>\r\n<p>Define the polynomials
|
9
|
+
{F<sub>n</sub>, n <img src=\"images/symbol_ge.gif\" width=\"10\" height=\"12\" alt=\"≥\"
|
10
|
+
border=\"0\" style=\"vertical-align:middle;\"> 0} as F<sub>n</sub>(x) = <img src=\"images/symbol_sum.gif\"
|
11
|
+
width=\"11\" height=\"14\" alt=\"∑\" border=\"0\" style=\"vertical-align:middle;\">f<sub>i</sub>x<sup>i</sup>
|
12
|
+
for 0 <img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
13
|
+
style=\"vertical-align:middle;\"> i <img src=\"images/symbol_le.gif\" width=\"10\"
|
14
|
+
height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"> n.</p>\r\n<p>For
|
15
|
+
example, F<sub>7</sub>(x) = x + x<sup>2</sup> + 2x<sup>3</sup> + 3x<sup>4</sup>
|
16
|
+
+ 5x<sup>5</sup> + 8x<sup>6</sup> + 13x<sup>7</sup>, and F<sub>7</sub>(11) = 268357683.</p>\r\n<p>Let
|
17
|
+
n = 10<sup>15</sup>. Find the sum [<img src=\"images/symbol_sum.gif\" width=\"11\"
|
18
|
+
height=\"14\" alt=\"∑\" border=\"0\" style=\"vertical-align:middle;\"><sub>0<img
|
19
|
+
src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">x<img
|
20
|
+
src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">100</sub>
|
21
|
+
F<sub>n</sub>(x)] mod 1307674368000 (= 15!).</p>\r\n"
|
@@ -0,0 +1,21 @@
|
|
1
|
+
---
|
2
|
+
:id: 436
|
3
|
+
:name: Unfair wager
|
4
|
+
:url: http://projecteuler.net/problem=436
|
5
|
+
:content: "\r\n<p>Julie proposes the following wager to her sister Louise.<br>\r\nShe
|
6
|
+
suggests they play a game of chance to determine who will wash the dishes.<br>\r\nFor
|
7
|
+
this game, they shall use a generator of independent random numbers uniformly distributed
|
8
|
+
between 0 and 1.<br>\r\nThe game starts with <var>S</var> = 0.<br>\r\nThe first
|
9
|
+
player, Louise, adds to <var>S</var> different random numbers from the generator
|
10
|
+
until <var>S</var> > 1 and records her last random number '<var>x</var>'.<br>\r\nThe
|
11
|
+
second player, Julie, continues adding to <var>S</var> different random numbers
|
12
|
+
from the generator until <var>S</var> > 2 and records her last random number
|
13
|
+
'<var>y</var>'.<br>\r\nThe player with the highest number wins and the loser washes
|
14
|
+
the dishes, i.e. if <var>y</var> > <var>x</var> the second player wins.</p>\r\n\r\n<p>For
|
15
|
+
e<var>x</var>ample, if the first player draws 0.62 and 0.44, the first player turn
|
16
|
+
ends since 0.62+0.44 > 1 and <var>x</var> = 0.44.<br>\r\nIf the second players
|
17
|
+
draws 0.1, 0.27 and 0.91, the second player turn ends since 0.62+0.44+0.1+0.27+0.91
|
18
|
+
> 2 and <var>y</var> = 0.91.\r\nSince <var>y</var> > <var>x</var>, the second
|
19
|
+
player wins.</p>\r\n\r\n<p>Louise thinks about it for a second, and objects: \"That's
|
20
|
+
not fair\".<br>\r\nWhat is the probability that the second player wins?<br>\r\nGive
|
21
|
+
your answer rounded to 10 places behind the decimal point in the form 0.abcdefghij</p>\r\n\r\n"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
:id: 437
|
3
|
+
:name: Fibonacci primitive roots
|
4
|
+
:url: http://projecteuler.net/problem=437
|
5
|
+
:content: "\r\n<p>\r\nWhen we calculate 8<sup>n</sup> modulo 11 for n=0 to 9 we get:
|
6
|
+
1, 8, 9, 6, 4, 10, 3, 2, 5, 7.<br>\r\nAs we see all possible values from 1 to 10
|
7
|
+
occur. So 8 is a <b>primitive root</b> of 11.<br>\r\nBut there is more:<br>\r\nIf
|
8
|
+
we take a closer look we see:<br>\r\n1+8=9<br>\r\n8+9=17<img src=\"images/symbol_cong.gif\"
|
9
|
+
width=\"9\" height=\"11\" alt=\"≡\" border=\"0\" style=\"vertical-align:middle;\">6
|
10
|
+
mod 11<br>\r\n9+6=15<img src=\"images/symbol_cong.gif\" width=\"9\" height=\"11\"
|
11
|
+
alt=\"≡\" border=\"0\" style=\"vertical-align:middle;\">4 mod 11<br>\r\n6+4=10<br>\r\n4+10=14<img
|
12
|
+
src=\"images/symbol_cong.gif\" width=\"9\" height=\"11\" alt=\"≡\" border=\"0\"
|
13
|
+
style=\"vertical-align:middle;\">3 mod 11<br>\r\n10+3=13<img src=\"images/symbol_cong.gif\"
|
14
|
+
width=\"9\" height=\"11\" alt=\"≡\" border=\"0\" style=\"vertical-align:middle;\">2
|
15
|
+
mod 11<br>\r\n3+2=5<br>\r\n2+5=7<br>\r\n5+7=12<img src=\"images/symbol_cong.gif\"
|
16
|
+
width=\"9\" height=\"11\" alt=\"≡\" border=\"0\" style=\"vertical-align:middle;\">1
|
17
|
+
mod 11.\r\n</p>\r\nSo the powers of 8 mod 11 are cyclic with period 10, and 8<sup>n</sup>
|
18
|
+
+ 8<sup>n+1</sup> ≡ 8<sup>n+2</sup> (mod 11).<br>\r\n8 is called a <b>Fibonacci
|
19
|
+
primitive root</b> of 11.<br>\r\nNot every prime has a Fibonacci primitive root.<br>\r\nThere
|
20
|
+
are 323 primes less than 10000 with one or more Fibonacci primitive roots and the
|
21
|
+
sum of these primes is 1480491.<br>\r\nFind the sum of the primes less than 100,000,000
|
22
|
+
with at least one Fibonacci primitive root.\r\n\r\n\r\n"
|
@@ -0,0 +1,29 @@
|
|
1
|
+
---
|
2
|
+
:id: 438
|
3
|
+
:name: Integer part of polynomial equation's solutions
|
4
|
+
:url: http://projecteuler.net/problem=438
|
5
|
+
:content: "\r\n<p>\r\nFor an <var>n</var>-tuple of integers <var>t</var> = (<var>a</var><sub>1</sub>,
|
6
|
+
..., <var>a</var><sub><var>n</var></sub>), let (<var>x</var><sub>1</sub>, ..., <var>x</var><sub><var>n</var></sub>)
|
7
|
+
be the solutions of the polynomial equation <var>x</var><sup><var>n</var></sup>
|
8
|
+
+ <var>a</var><sub>1</sub><var>x</var><sup><var>n</var>-1</sup> + <var>a</var><sub>2</sub><var>x</var><sup><var>n</var>-2</sup>
|
9
|
+
+ ... + <var>a</var><sub><var>n</var>-1</sub><var>x</var> + <var>a</var><sub><var>n</var></sub>
|
10
|
+
= 0.\r\n</p>\r\n<p>\r\nConsider the following two conditions:\r\n</p>\n<ul>\n<li>\n<var>x</var><sub>1</sub>,
|
11
|
+
..., <var>x</var><sub><var>n</var></sub> are all real.\r\n</li>\n<li>If <var>x</var><sub>1</sub>,
|
12
|
+
..., <var>x</var><sub><var>n</var></sub> are sorted, <img src=\"images/symbol_lfloor.gif\"
|
13
|
+
width=\"6\" height=\"16\" alt=\"⌊\" border=\"0\" style=\"vertical-align:middle;\"><var>x</var><sub><var>i</var></sub><img
|
14
|
+
src=\"images/symbol_rfloor.gif\" width=\"6\" height=\"16\" alt=\"⌋\" border=\"0\"
|
15
|
+
style=\"vertical-align:middle;\"> = <var>i</var> for 1 <img src=\"images/symbol_le.gif\"
|
16
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>i</var>
|
17
|
+
<img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
18
|
+
style=\"vertical-align:middle;\"><var>n</var>. (<img src=\"images/symbol_lfloor.gif\"
|
19
|
+
width=\"6\" height=\"16\" alt=\"⌊\" border=\"0\" style=\"vertical-align:middle;\">·<img
|
20
|
+
src=\"images/symbol_rfloor.gif\" width=\"6\" height=\"16\" alt=\"⌋\" border=\"0\"
|
21
|
+
style=\"vertical-align:middle;\">: floor function.)\r\n</li>\n</ul>\n<p>\r\nIn the
|
22
|
+
case of <var>n</var> = 4, there are 12 <var>n</var>-tuples of integers which satisfy
|
23
|
+
both conditions.<br>\r\nWe define S(<var>t</var>) as the sum of the absolute values
|
24
|
+
of the integers in <var>t</var>.<br>\r\nFor <var>n</var> = 4 we can verify that
|
25
|
+
<img src=\"images/symbol_sum.gif\" width=\"11\" height=\"14\" alt=\"∑\" border=\"0\"
|
26
|
+
style=\"vertical-align:middle;\">S(<var>t</var>) = 2087 for all <var>n</var>-tuples
|
27
|
+
<var>t</var> which satisfy both conditions.\r\n</p>\r\n<p>\r\nFind <img src=\"images/symbol_sum.gif\"
|
28
|
+
width=\"11\" height=\"14\" alt=\"∑\" border=\"0\" style=\"vertical-align:middle;\">S(<var>t</var>)
|
29
|
+
for <var>n</var> = 7.\r\n</p>\r\n"
|