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,28 @@
|
|
1
|
+
---
|
2
|
+
:id: 384
|
3
|
+
:name: Rudin-Shapiro sequence
|
4
|
+
:url: http://projecteuler.net/problem=384
|
5
|
+
:content: "\r\n<p>Define the sequence a(n) as the number of adjacent pairs of ones
|
6
|
+
in the binary expansion of n (possibly overlapping).\r\n<br>E.g.: a(5) = a(101<sub>2</sub>)
|
7
|
+
= 0, a(6) = a(110<sub>2</sub>) = 1, a(7) = a(111<sub>2</sub>) = 2</p>\r\n\r\n<p>Define
|
8
|
+
the sequence b(n) = (-1)<sup>a(n)</sup>.\r\n<br>This sequence is called the <b>Rudin-Shapiro</b>
|
9
|
+
sequence.</p>\r\n<p>Also consider the summatory sequence of b(n): <img src=\"project/images/p_384_formula.gif\"
|
10
|
+
style=\"margin-top:-9px;\">.</p>\r\n\r\n<p>The first couple of values of these sequences
|
11
|
+
are:\r\n<br><tt>n &nbsp 0 &nbsp 1 &nbsp 2 &nbsp 3 &nbsp
|
12
|
+
4 &nbsp 5 &nbsp 6 &nbsp 7\r\n<br>a(n) &nbsp 0 &nbsp
|
13
|
+
0 &nbsp 0 &nbsp 1 &nbsp 0 &nbsp 0 &nbsp 1 &nbsp
|
14
|
+
2\r\n<br>b(n) &nbsp 1 &nbsp 1 &nbsp 1 &nbsp -1 &nbsp
|
15
|
+
1 &nbsp 1 &nbsp -1 &nbsp 1\r\n<br>s(n) &nbsp 1 &nbsp
|
16
|
+
2 &nbsp 3 &nbsp 2 &nbsp 3 &nbsp 4 &nbsp 3 &nbsp
|
17
|
+
4</tt></p>\r\n\r\n<p>The sequence s(n) has the remarkable property that all elements
|
18
|
+
are positive and every positive integer k occurs exactly k times.</p>\r\n\r\n<p>Define
|
19
|
+
g(t,c), with 1 <img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\"
|
20
|
+
border=\"0\" style=\"vertical-align:middle;\"> c <img src=\"images/symbol_le.gif\"
|
21
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">
|
22
|
+
t, as the index in s(n) for which t occurs for the c'th time in s(n).\r\n<br>E.g.:
|
23
|
+
g(3,3) = 6, g(4,2) = 7 and g(54321,12345) = 1220847710.</p>\r\n\r\n<p>Let F(n) be
|
24
|
+
the fibonacci sequence defined by:\r\n<br>F(0)=F(1)=1 and\r\n<br>F(n)=F(n-1)+F(n-2)
|
25
|
+
for n>1.</p>\r\n\r\n<p>Define GF(t)=g(F(t),F(t-1)).</p>\r\n\r\n<p>Find ΣGF(t)
|
26
|
+
for 2<img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
27
|
+
style=\"vertical-align:middle;\">t<img src=\"images/symbol_le.gif\" width=\"10\"
|
28
|
+
height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">45.</p>\r\n"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
:id: 385
|
3
|
+
:name: Ellipses inside triangles
|
4
|
+
:url: http://projecteuler.net/problem=385
|
5
|
+
:content: "\r\n<p>\r\nFor any triangle <var>T</var> in the plane, it can be shown
|
6
|
+
that there is a unique ellipse with largest area that is completely inside <var>T</var>.\r\n</p>\n<p
|
7
|
+
align=\"center\">\r\n<img src=\"project/images/p_385_ellipsetriangle.png\"></p>\r\n<p>\r\nFor
|
8
|
+
a given <var>n</var>, consider triangles <var>T</var> such that:<br>\r\n- the vertices
|
9
|
+
of <var>T</var> have integer coordinates with absolute value <img src=\"images/symbol_le.gif\"
|
10
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">
|
11
|
+
n, and <br>\r\n- the <b>foci</b><sup>1</sup> of the largest-area ellipse inside
|
12
|
+
<var>T</var> are (<img src=\"images/symbol_radic.gif\" width=\"14\" height=\"16\"
|
13
|
+
alt=\"√\" border=\"0\" style=\"vertical-align:middle;\">13,0) and (-<img src=\"images/symbol_radic.gif\"
|
14
|
+
width=\"14\" height=\"16\" alt=\"√\" border=\"0\" style=\"vertical-align:middle;\">13,0).<br>\r\nLet
|
15
|
+
A(<var>n</var>) be the sum of the areas of all such triangles.\r\n</p>\r\n<p>\r\nFor
|
16
|
+
example, if <var>n</var> = 8, there are two such triangles. Their vertices are (-4,-3),(-4,3),(8,0)
|
17
|
+
and (4,3),(4,-3),(-8,0), and the area of each triangle is 36. Thus A(8) = 36 + 36
|
18
|
+
= 72.\r\n</p>\r\n<p>\r\nIt can be verified that A(10) = 252, A(100) = 34632 and
|
19
|
+
A(1000) = 3529008.\r\n</p>\r\n<p>\r\nFind A(1 000 000 000).\r\n</p>\r\n<p>\r\n\r\n<sup>1</sup>The
|
20
|
+
<b>foci</b> (plural of <b>focus</b>) of an ellipse are two points A and B such that
|
21
|
+
for every point P on the boundary of the ellipse, <var>AP</var> + <var>PB</var>
|
22
|
+
is constant.\r\n\r\n\r\n</p>\r\n\r\n\r\n\r\n"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
---
|
2
|
+
:id: 386
|
3
|
+
:name: Maximum length of an antichain
|
4
|
+
:url: http://projecteuler.net/problem=386
|
5
|
+
:content: "\r\n<p>Let <var>n</var> be an integer and <var>S</var>(<var>n</var>) be
|
6
|
+
the set of factors of <var>n</var>.</p>\r\n\r\n<p>A subset <var>A</var> of <var>S</var>(<var>n</var>)
|
7
|
+
is called an <b>antichain</b> of <var>S</var>(<var>n</var>) if <var>A</var> contains
|
8
|
+
only one element or if none of the elements of <var>A</var> divides any of the other
|
9
|
+
elements of <var>A</var>.</p>\r\n\r\n<p>For example: <var>S</var>(30) = {1, 2, 3,
|
10
|
+
5, 6, 10, 15, 30}\r\n<br>{2, 5, 6} is not an antichain of <var>S</var>(30).\r\n<br>{2,
|
11
|
+
3, 5} is an antichain of <var>S</var>(30).</p>\r\n\r\n<p>Let <var>N</var>(<var>n</var>)
|
12
|
+
be the maximum length of an antichain of <var>S</var>(<var>n</var>).</p>\r\n\r\n<p>Find
|
13
|
+
Σ<var>N</var>(<var>n</var>) for 1 <img src=\"images/symbol_le.gif\" width=\"10\"
|
14
|
+
height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>n</var>
|
15
|
+
<img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
16
|
+
style=\"vertical-align:middle;\"> 10<sup>8</sup></p>\r\n"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
---
|
2
|
+
:id: 387
|
3
|
+
:name: Harshad Numbers
|
4
|
+
:url: http://projecteuler.net/problem=387
|
5
|
+
:content: "\r\n<p>A <b>Harshad or Niven number</b> is a number that is divisible by
|
6
|
+
the sum of its digits.\r\n<br>201 is a Harshad number because it is divisible by
|
7
|
+
3 (the sum of its digits.)\r\n<br>When we truncate the last digit from 201, we get
|
8
|
+
20, which is a Harshad number.\r\n<br>When we truncate the last digit from 20, we
|
9
|
+
get 2, which is also a Harshad number.\r\n<br>Let's call a Harshad number that,
|
10
|
+
while recursively truncating the last digit, always results in a Harshad number
|
11
|
+
a <i>right truncatable Harshad number.</i></p> \r\n\r\n<p>Also:\r\n<br>201/3=67
|
12
|
+
which is prime.\r\n<br>Let's call a Harshad number that, when divided by the sum
|
13
|
+
of its digits, results in a prime a <i>strong Harshad number</i>.</p>\r\n\r\n<p>Now
|
14
|
+
take the number 2011 which is prime.\r\n<br>When we truncate the last digit from
|
15
|
+
it we get 201, a strong Harshad number that is also right truncatable.\r\n<br>Let's
|
16
|
+
call such primes <i>strong, right truncatable Harshad primes</i>.</p>\r\n\r\n<p>You
|
17
|
+
are given that the sum of the strong, right truncatable Harshad primes less than
|
18
|
+
10000 is 90619.</p>\r\n\r\n<p>Find the sum of the strong, right truncatable Harshad
|
19
|
+
primes less than 10<sup>14</sup>.</p>\r\n"
|
@@ -0,0 +1,12 @@
|
|
1
|
+
---
|
2
|
+
:id: 388
|
3
|
+
:name: Distinct Lines
|
4
|
+
:url: http://projecteuler.net/problem=388
|
5
|
+
:content: "\r\n<p>\r\nConsider all lattice points (a,b,c) with 0 <img src=\"images/symbol_le.gif\"
|
6
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">
|
7
|
+
a,b,c <img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
8
|
+
style=\"vertical-align:middle;\"> N.\r\n</p>\r\n<p>\r\nFrom the origin O(0,0,0)
|
9
|
+
all lines are drawn to the other lattice points.<br>\r\nLet D(N) be the number of
|
10
|
+
<i>distinct</i> such lines.\r\n</p>\r\n<p>\r\nYou are given that D(1 000 000) =
|
11
|
+
831909254469114121.\r\n</p>\n<p>\r\nFind D(10<sup>10</sup>). Give as your answer
|
12
|
+
the first nine digits followed by the last nine digits.\r\n</p>\r\n\r\n\r\n\r\n"
|
@@ -0,0 +1,12 @@
|
|
1
|
+
---
|
2
|
+
:id: 389
|
3
|
+
:name: Platonic Dice
|
4
|
+
:url: http://projecteuler.net/problem=389
|
5
|
+
:content: "\r\n<p>\r\nAn unbiased single 4-sided die is thrown and its value, <var>T</var>,
|
6
|
+
is noted.<br><var>T</var> unbiased 6-sided dice are thrown and their scores are
|
7
|
+
added together. The sum, <var>C</var>, is noted.<br><var>C</var> unbiased 8-sided
|
8
|
+
dice are thrown and their scores are added together. The sum, <var>O</var>, is noted.<br><var>O</var>
|
9
|
+
unbiased 12-sided dice are thrown and their scores are added together. The sum,
|
10
|
+
<var>D</var>, is noted.<br><var>D</var> unbiased 20-sided dice are thrown and their
|
11
|
+
scores are added together. The sum, <var>I</var>, is noted.<br>\r\nFind the variance
|
12
|
+
of <var>I</var>, and give your answer rounded to 4 decimal places.\r\n</p>\r\n"
|
@@ -0,0 +1,10 @@
|
|
1
|
+
---
|
2
|
+
:id: 39
|
3
|
+
:name: Integer right triangles
|
4
|
+
:url: http://projecteuler.net/problem=39
|
5
|
+
:content: "\r\n<p>If <i>p</i> is the perimeter of a right angle triangle with integral
|
6
|
+
length sides, {<i>a</i>,<i>b</i>,<i>c</i>}, there are exactly three solutions for
|
7
|
+
<i>p</i> = 120.</p>\r\n<p style=\"\\'text-align:center;\\'\">{20,48,52}, {24,45,51},
|
8
|
+
{30,40,50}</p>\r\n<p>For which value of <i>p</i> <img src=\"images/symbol_le.gif\"
|
9
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">
|
10
|
+
1000, is the number of solutions maximised?</p>\r\n\r\n"
|
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
:id: 390
|
3
|
+
:name: Triangles with non rational sides and integral area
|
4
|
+
:url: http://projecteuler.net/problem=390
|
5
|
+
:content: "\r\n<p>Consider the triangle with sides <img src=\"images/symbol_radic.gif\"
|
6
|
+
width=\"14\" height=\"16\" alt=\"√\" border=\"0\" style=\"vertical-align:middle;\">5,
|
7
|
+
<img src=\"images/symbol_radic.gif\" width=\"14\" height=\"16\" alt=\"√\" border=\"0\"
|
8
|
+
style=\"vertical-align:middle;\">65 and <img src=\"images/symbol_radic.gif\" width=\"14\"
|
9
|
+
height=\"16\" alt=\"√\" border=\"0\" style=\"vertical-align:middle;\">68.\r\nIt
|
10
|
+
can be shown that this triangle has area 9.</p>\r\n\r\n<p>S(n) is the sum of the
|
11
|
+
areas of all triangles with sides <img src=\"images/symbol_radic.gif\" width=\"14\"
|
12
|
+
height=\"16\" alt=\"√\" border=\"0\" style=\"vertical-align:middle;\">(1+b<sup>2</sup>),
|
13
|
+
<img src=\"images/symbol_radic.gif\" width=\"14\" height=\"16\" alt=\"√\" border=\"0\"
|
14
|
+
style=\"vertical-align:middle;\">(1+c<sup>2</sup>) and <img src=\"images/symbol_radic.gif\"
|
15
|
+
width=\"14\" height=\"16\" alt=\"√\" border=\"0\" style=\"vertical-align:middle;\">(b<sup>2</sup>+c<sup>2</sup>)
|
16
|
+
(for positive integers b and c ) that have an integral area not exceeding n.</p>\r\n\r\n<p>The
|
17
|
+
example triangle has b=2 and c=8.</p>\r\n\r\n<p>S(10<sup>6</sup>)=18018206.</p>\r\n\r\n<p>Find
|
18
|
+
S(10<sup>10</sup>).</p>\r\n"
|
@@ -0,0 +1,29 @@
|
|
1
|
+
---
|
2
|
+
:id: 391
|
3
|
+
:name: Hopping Game
|
4
|
+
:url: http://projecteuler.net/problem=391
|
5
|
+
:content: "\r\n<p>\r\nLet <var>s<sub>k</sub></var> be the number of 1’s when writing
|
6
|
+
the numbers from 0 to <var>k</var> in binary.<br>\r\nFor example, writing 0 to 5
|
7
|
+
in binary, we have 0, 1, 10, 11, 100, 101. There are seven 1’s, so <var>s</var><sub>5</sub>
|
8
|
+
= 7.<br>\r\nThe sequence S = {<var>s<sub>k</sub></var> : <var>k</var> <img src=\"images/symbol_ge.gif\"
|
9
|
+
width=\"10\" height=\"12\" alt=\"≥\" border=\"0\" style=\"vertical-align:middle;\">
|
10
|
+
0} starts {0, 1, 2, 4, 5, 7, 9, 12, ...}.<br></p>\r\n\r\n<p>\r\nA game is played
|
11
|
+
by two players. Before the game starts, a number <var>n</var> is chosen. A counter
|
12
|
+
<var>c</var> starts at 0. At each turn, the player chooses a number from 1 to <var>n</var>
|
13
|
+
(inclusive) and increases <var>c</var> by that number. The resulting value of <var>c</var>
|
14
|
+
must be a member of S. If there are no more valid moves, the player loses.\r\n</p>\r\n\r\n<p>\r\nFor
|
15
|
+
example:<br>\r\nLet <var>n</var> = 5. <var>c</var> starts at 0.<br>\r\nPlayer 1
|
16
|
+
chooses 4, so <var>c</var> becomes 0 + 4 = 4.<br>\r\nPlayer 2 chooses 5, so <var>c</var>
|
17
|
+
becomes 4 + 5 = 9.<br>\r\nPlayer 1 chooses 3, so <var>c</var> becomes 9 + 3 = 12.<br>\r\netc.<br>\r\nNote
|
18
|
+
that <var>c</var> must always belong to S, and each player can increase <var>c</var>
|
19
|
+
by at most <var>n</var>.\r\n</p>\r\n\r\n<p>\r\nLet M(<var>n</var>) be the highest
|
20
|
+
number the first player can choose at her first turn to force a win, and M(<var>n</var>)
|
21
|
+
= 0 if there is no such move. For example, M(2) = 2, M(7) = 1 and M(20) = 4.\r\n</p>\r\n\r\n<p>\r\nGiven
|
22
|
+
Σ(M(<var>n</var>))<sup>3</sup> = 8150 for 1 <img src=\"images/symbol_le.gif\" width=\"10\"
|
23
|
+
height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>n</var>
|
24
|
+
<img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
25
|
+
style=\"vertical-align:middle;\"> 20.\r\n</p>\r\n\r\n<p>\r\nFind Σ(M(<var>n</var>))<sup>3</sup>
|
26
|
+
for 1 <img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
27
|
+
style=\"vertical-align:middle;\"><var>n</var> <img src=\"images/symbol_le.gif\"
|
28
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">
|
29
|
+
1000.\r\n</p>\r\n"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
:id: 392
|
3
|
+
:name: Enmeshed unit circle
|
4
|
+
:url: http://projecteuler.net/problem=392
|
5
|
+
:content: "\r\n<p>\r\nA rectilinear grid is an orthogonal grid where the spacing between
|
6
|
+
the gridlines does not have to be equidistant.<br>\r\nAn example of such grid is
|
7
|
+
logarithmic graph paper.\r\n</p>\r\n<p>\r\nConsider rectilinear grids in the Cartesian
|
8
|
+
coordinate system with the following properties:<br></p>\n<ul>\n<li>The gridlines
|
9
|
+
are parallel to the axes of the Cartesian coordinate system.</li>\n<li>There are
|
10
|
+
N+2 vertical and N+2 horizontal gridlines. Hence there are (N+1) x (N+1) rectangular
|
11
|
+
cells.</li>\n<li>The equations of the two outer vertical gridlines are x = -1 and
|
12
|
+
x = 1.</li>\n<li>The equations of the two outer horizontal gridlines are y = -1
|
13
|
+
and y = 1.</li>\n<li>The grid cells are colored red if they overlap with the <dfn
|
14
|
+
title=\"The unit circle is the circle that has radius 1 and is centered at the origin\">unit
|
15
|
+
circle</dfn>, black otherwise.</li>\n</ul>For this problem we would like you to
|
16
|
+
find the postions of the remaining N inner horizontal and N inner vertical gridlines
|
17
|
+
so that the area occupied by the red cells is minimized.\r\n\r\n<p>\r\nE.g. here
|
18
|
+
is a picture of the solution for N = 10:\r\n</p>\n<p align=\"center\">\r\n<img src=\"project/images/p392_gridlines.png\"></p>\r\n\r\n\r\nThe
|
19
|
+
area occupied by the red cells for N = 10 rounded to 10 digits behind the decimal
|
20
|
+
point is 3.3469640797.\r\n\r\n<p>\r\nFind the positions for N = 400.<br> \r\nGive
|
21
|
+
as your answer the area occupied by the red cells rounded to 10 digits behind the
|
22
|
+
decimal point.\r\n</p>\r\n\r\n"
|
@@ -0,0 +1,12 @@
|
|
1
|
+
---
|
2
|
+
:id: 393
|
3
|
+
:name: Migrating ants
|
4
|
+
:url: http://projecteuler.net/problem=393
|
5
|
+
:content: "\r\n<p>\r\nAn <var>n</var><img src=\"images/symbol_times.gif\" width=\"9\"
|
6
|
+
height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\"><var>n</var>
|
7
|
+
grid of squares contains <var>n</var><sup>2</sup> ants, one ant per square.<br>\r\nAll
|
8
|
+
ants decide to move simultaneously to an adjacent square (usually 4 possibilities,
|
9
|
+
except for ants on the edge of the grid or at the corners).<br>\r\nWe define <var>f</var>(<var>n</var>)
|
10
|
+
to be the number of ways this can happen without any ants ending on the same square
|
11
|
+
and without any two ants crossing the same edge between two squares.\r\n</p>\r\n<p>\r\nYou
|
12
|
+
are given that <var>f</var>(4) = 88.<br>\r\nFind <var>f</var>(10).\r\n</p>\r\n\r\n"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
:id: 394
|
3
|
+
:name: Eating pie
|
4
|
+
:url: http://projecteuler.net/problem=394
|
5
|
+
:content: "\r\n<p>\r\nJeff eats a pie in an unusual way.<br>\r\nThe pie is circular.
|
6
|
+
He starts with slicing an initial cut in the pie along a radius.<br>\r\nWhile there
|
7
|
+
is at least a given fraction <var>F</var> of pie left, he performs the following
|
8
|
+
procedure:<br>\r\n- He makes two slices from the pie centre to any point of what
|
9
|
+
is remaining of the pie border, any point on the remaining pie border equally likely.
|
10
|
+
This will divide the remaining pie into three pieces.<br> \r\n- Going counterclockwise
|
11
|
+
from the initial cut, he takes the first two pie pieces and eats them.<br>\r\nWhen
|
12
|
+
less than a fraction <var>F</var> of pie remains, he does not repeat this procedure.
|
13
|
+
Instead, he eats all of the remaining pie.\r\n</p>\r\n<p align=\"center\">\r\n<img
|
14
|
+
src=\"project/images/p_394_eatpie.gif\"></p>\r\n\r\n\r\n<p>\r\nFor <var>x</var>
|
15
|
+
<img src=\"images/symbol_ge.gif\" width=\"10\" height=\"12\" alt=\"≥\" border=\"0\"
|
16
|
+
style=\"vertical-align:middle;\"> 1, let E(<var>x</var>) be the expected number
|
17
|
+
of times Jeff repeats the procedure above with <var>F</var> = <sup>1</sup>/<sub><var>x</var></sub>.<br>\r\nIt
|
18
|
+
can be verified that E(1) = 1, E(2) <img src=\"images/symbol_asymp.gif\" width=\"11\"
|
19
|
+
height=\"9\" alt=\"≈\" border=\"0\" style=\"vertical-align:middle;\"> 1.2676536759,
|
20
|
+
and E(7.5) <img src=\"images/symbol_asymp.gif\" width=\"11\" height=\"9\" alt=\"≈\"
|
21
|
+
border=\"0\" style=\"vertical-align:middle;\"> 2.1215732071.\r\n</p>\r\n<p>\r\nFind
|
22
|
+
E(40) rounded to 10 decimal places behind the decimal point.\r\n</p>\r\n\r\n\r\n"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
---
|
2
|
+
:id: 395
|
3
|
+
:name: Pythagorean tree
|
4
|
+
:url: http://projecteuler.net/problem=395
|
5
|
+
:content: "\r\n<p>\r\nThe <b>Pythagorean tree</b> is a fractal generated by the following
|
6
|
+
procedure:\r\n</p>\r\n\r\n<p>\r\nStart with a unit square. Then, calling one of
|
7
|
+
the sides its base (in the animation, the bottom side is the base):\r\n</p>\n<ol>\n<li>
|
8
|
+
Attach a right triangle to the side opposite the base, with the hypotenuse coinciding
|
9
|
+
with that side and with the sides in a 3-4-5 ratio. Note that the smaller side of
|
10
|
+
the triangle must be on the 'right' side with respect to the base (see animation).</li>\r\n<li>
|
11
|
+
Attach a square to each leg of the right triangle, with one of its sides coinciding
|
12
|
+
with that leg.</li>\r\n<li> Repeat this procedure for both squares, considering
|
13
|
+
as their bases the sides touching the triangle.</li>\r\n</ol>\r\nThe resulting figure,
|
14
|
+
after an infinite number of iterations, is the Pythagorean tree.\r\n\r\n\r\n<div
|
15
|
+
align=\"center\"><img src=\"project/images/p_395_pythagorean.gif\"></div>\r\n\r\n<p>\r\nIt
|
16
|
+
can be shown that there exists at least one rectangle, whose sides are parallel
|
17
|
+
to the largest square of the Pythagorean tree, which encloses the Pythagorean tree
|
18
|
+
completely.\r\n</p>\r\n<p>\r\nFind the smallest area possible for such a bounding
|
19
|
+
rectangle, and give your answer rounded to 10 decimal places.\r\n</p>\r\n"
|
@@ -0,0 +1,28 @@
|
|
1
|
+
---
|
2
|
+
:id: 396
|
3
|
+
:name: Weak Goodstein sequence
|
4
|
+
:url: http://projecteuler.net/problem=396
|
5
|
+
:content: "\r\n<p>\r\nFor any positive integer n, the <b>nth weak Goodstein sequence</b>
|
6
|
+
{g<sub>1</sub>, g<sub>2</sub>, g<sub>3</sub>, ...} is defined as:\r\n</p>\n<ul>\n<li>
|
7
|
+
g<sub>1</sub> = <var>n</var>\r\n</li>\n<li> for <var>k</var> <img src=\"images/symbol_gt.gif\"
|
8
|
+
width=\"10\" height=\"10\" alt=\">\" border=\"0\" style=\"vertical-align:middle;\">
|
9
|
+
1, g<sub><var>k</var></sub> is obtained by writing g<sub><var>k</var>-1</sub> in
|
10
|
+
base <var>k</var>, interpreting it as a base <var>k</var> + 1 number, and subtracting
|
11
|
+
1.\r\n</li>\n</ul>\r\nThe sequence terminates when g<sub><var>k</var></sub> becomes
|
12
|
+
0.\r\n\r\n<p>\r\nFor example, the 6th weak Goodstein sequence is {6, 11, 17, 25,
|
13
|
+
...}:\r\n</p>\n<ul>\n<li> g<sub>1</sub> = 6.\r\n</li>\n<li> g<sub>2</sub> = 11 since
|
14
|
+
6 = 110<sub>2</sub>, 110<sub>3</sub> = 12, and 12 - 1 = 11.\r\n</li>\n<li> g<sub>3</sub>
|
15
|
+
= 17 since 11 = 102<sub>3</sub>, 102<sub>4</sub> = 18, and 18 - 1 = 17.\r\n</li>\n<li>
|
16
|
+
g<sub>4</sub> = 25 since 17 = 101<sub>4</sub>, 101<sub>5</sub> = 26, and 26 - 1
|
17
|
+
= 25.\r\n</li>\n</ul>\r\nand so on.\r\n\r\n<p>\r\nIt can be shown that every weak
|
18
|
+
Goodstein sequence terminates.\r\n</p>\r\n<p>\r\nLet G(<var>n</var>) be the number
|
19
|
+
of nonzero elements in the <var>n</var>th weak Goodstein sequence.<br>\r\nIt can
|
20
|
+
be verified that G(2) = 3, G(4) = 21 and G(6) = 381.<br>\r\nIt can also be verified
|
21
|
+
that ΣG(<var>n</var>) = 2517 for 1 <img src=\"images/symbol_le.gif\" width=\"10\"
|
22
|
+
height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>n</var>
|
23
|
+
<img src=\"images/symbol_lt.gif\" width=\"10\" height=\"10\" alt=\"<\" border=\"0\"
|
24
|
+
style=\"vertical-align:middle;\"> 8.\r\n</p>\r\n<p>\r\nFind the last 9 digits of
|
25
|
+
ΣG(<var>n</var>) for 1 <img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\"
|
26
|
+
alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>n</var> <img src=\"images/symbol_lt.gif\"
|
27
|
+
width=\"10\" height=\"10\" alt=\"<\" border=\"0\" style=\"vertical-align:middle;\">
|
28
|
+
16.\r\n</p>\r\n"
|
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
:id: 397
|
3
|
+
:name: Triangle on parabola
|
4
|
+
:url: http://projecteuler.net/problem=397
|
5
|
+
:content: "\r\n<p>\r\nOn the parabola <var>y</var> = <var>x</var><sup>2</sup>/<var>k</var>,
|
6
|
+
three points A(<var>a</var>, <var>a</var><sup>2</sup>/<var>k</var>), B(<var>b</var>,
|
7
|
+
<var>b</var><sup>2</sup>/<var>k</var>) and C(<var>c</var>, <var>c</var><sup>2</sup>/<var>k</var>)
|
8
|
+
are chosen.\r\n</p>\r\n<p>\r\nLet F(<var>K</var>, <var>X</var>) be the number of
|
9
|
+
the integer quadruplets (<var>k</var>, <var>a</var>, <var>b</var>, <var>c</var>)
|
10
|
+
such that at least one angle of the triangle ABC is 45-degree, with 1 <img src=\"images/symbol_le.gif\"
|
11
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>k</var>
|
12
|
+
<img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
13
|
+
style=\"vertical-align:middle;\"><var>K</var> and -<var>X</var> <img src=\"images/symbol_le.gif\"
|
14
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"><var>a</var>
|
15
|
+
<img src=\"images/symbol_lt.gif\" width=\"10\" height=\"10\" alt=\"<\" border=\"0\"
|
16
|
+
style=\"vertical-align:middle;\"><var>b</var> <img src=\"images/symbol_lt.gif\"
|
17
|
+
width=\"10\" height=\"10\" alt=\"<\" border=\"0\" style=\"vertical-align:middle;\"><var>c</var>
|
18
|
+
<img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
19
|
+
style=\"vertical-align:middle;\"><var>X</var>.\r\n</p>\r\n<p>\r\nFor example, F(1,
|
20
|
+
10) = 41 and F(10, 100) = 12492.<br>\r\nFind F(10<sup>6</sup>, 10<sup>9</sup>).\r\n</p>\r\n"
|
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
:id: 398
|
3
|
+
:name: Cutting rope
|
4
|
+
:url: http://projecteuler.net/problem=398
|
5
|
+
:content: "\r\n<p>\r\nInside a rope of length <var>n</var>, <var>n</var>-1 points
|
6
|
+
are placed with distance 1 from each other and from the endpoints. Among these points,
|
7
|
+
we choose <var>m</var>-1 points at random and cut the rope at these points to create
|
8
|
+
<var>m</var> segments.\r\n</p>\r\n<p>\r\nLet E(<var>n</var>, <var>m</var>) be the
|
9
|
+
expected length of the second-shortest segment.\r\nFor example, E(3, 2) = 2 and
|
10
|
+
E(8, 3) = 16/7.\r\nNote that if multiple segments have the same shortest length
|
11
|
+
the length of the second-shortest segment is defined as the same as the shortest
|
12
|
+
length.\r\n</p>\r\n<p>\r\nFind E(10<sup>7</sup>, 100).\r\nGive your answer rounded
|
13
|
+
to 5 decimal places behind the decimal point.\r\n</p>\r\n"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
:id: 399
|
3
|
+
:name: Squarefree Fibonacci Numbers
|
4
|
+
:url: http://projecteuler.net/problem=399
|
5
|
+
:content: "\r\n<p>\r\nThe first 15 fibonacci numbers are:<br>\r\n1,1,2,3,5,8,13,21,34,55,89,144,233,377,610.<br>\r\nIt
|
6
|
+
can be seen that 8 and 144 are not squarefree: 8 is divisible by 4 and 144 is divisible
|
7
|
+
by 4 and by 9.<br> \r\nSo the first 13 squarefree fibonacci numbers are:<br>\r\n1,1,2,3,5,13,21,34,55,89,233,377
|
8
|
+
and 610.\r\n</p>\r\n<p>\r\nThe 200th squarefree fibonacci number is:\r\n971183874599339129547649988289594072811608739584170445.<br>\r\nThe
|
9
|
+
last sixteen digits of this number are: 1608739584170445 and in scientific notation
|
10
|
+
this number can be written as 9.7e53.\r\n</p>\r\n<p>\r\nFind the 100 000 000th squarefree
|
11
|
+
fibonacci number.<br>\r\nGive as your answer its last sixteen digits followed by
|
12
|
+
a comma followed by the number in scientific notation (rounded to one digit after
|
13
|
+
the decimal point).<br>\r\nFor the 200th squarefree number the answer would have
|
14
|
+
been: 1608739584170445,9.7e53\r\n</p>\r\n<p>\r\n<font size=\"-1\">\r\nNote:<br>
|
15
|
+
\r\nFor this problem, assume that for every prime p, the first fibonacci number
|
16
|
+
divisible by p is not divisible by p<sup>2</sup> (this is part of <b>Wall's conjecture</b>).
|
17
|
+
This has been verified for primes <img src=\"images/symbol_le.gif\" width=\"10\"
|
18
|
+
height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\"> 3·10<sup>15</sup>,
|
19
|
+
but has not been proven in general.<br>\r\n\r\nIf it happens that the conjecture
|
20
|
+
is false, then the accepted answer to this problem isn't guaranteed to be the 100
|
21
|
+
000 000th squarefree fibonacci number, rather it represents only a lower bound for
|
22
|
+
that number.\r\n</font>\r\n</p>\r\n\r\n\r\n\r\n"
|
data/data/problems/4.yml
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
---
|
2
|
+
:id: 4
|
3
|
+
:name: Largest palindrome product
|
4
|
+
:url: http://projecteuler.net/problem=4
|
5
|
+
:content: "\r\n\n<p>A palindromic number reads the same both ways. The largest palindrome
|
6
|
+
made from the product of two 2-digit numbers is 9009 = 91 <img src=\"images/symbol_times.gif\"
|
7
|
+
width=\"9\" height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\">
|
8
|
+
99.</p>\n<p>Find the largest palindrome made from the product of two 3-digit numbers.</p>\n\r\n"
|
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
:id: 40
|
3
|
+
:name: Champernowne's constant
|
4
|
+
:url: http://projecteuler.net/problem=40
|
5
|
+
:content: "\r\n<p>An irrational decimal fraction is created by concatenating the positive
|
6
|
+
integers:</p>\r\n<p style=\"text-align:center;\">0.12345678910<span style=\"color:#dd0000;font-size:14pt;\">1</span>112131415161718192021...</p>\r\n<p>It
|
7
|
+
can be seen that the 12<sup>th</sup> digit of the fractional part is 1.</p>\r\n<p>If
|
8
|
+
<i>d</i><sub><i>n</i></sub> represents the <i>n</i><sup>th</sup> digit of the fractional
|
9
|
+
part, find the value of the following expression.</p>\r\n<p style=\"text-align:center;\"><i>d</i><sub>1</sub><img
|
10
|
+
src=\"images/symbol_times.gif\" width=\"9\" height=\"9\" alt=\"×\" border=\"0\"
|
11
|
+
style=\"vertical-align:middle;\"><i>d</i><sub>10</sub><img src=\"images/symbol_times.gif\"
|
12
|
+
width=\"9\" height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\"><i>d</i><sub>100</sub><img
|
13
|
+
src=\"images/symbol_times.gif\" width=\"9\" height=\"9\" alt=\"×\" border=\"0\"
|
14
|
+
style=\"vertical-align:middle;\"><i>d</i><sub>1000</sub><img src=\"images/symbol_times.gif\"
|
15
|
+
width=\"9\" height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\"><i>d</i><sub>10000</sub><img
|
16
|
+
src=\"images/symbol_times.gif\" width=\"9\" height=\"9\" alt=\"×\" border=\"0\"
|
17
|
+
style=\"vertical-align:middle;\"><i>d</i><sub>100000</sub><img src=\"images/symbol_times.gif\"
|
18
|
+
width=\"9\" height=\"9\" alt=\"×\" border=\"0\" style=\"vertical-align:middle;\"><i>d</i><sub>1000000</sub></p>\r\n\r\n"
|
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
:id: 400
|
3
|
+
:name: Fibonacci tree game
|
4
|
+
:url: http://projecteuler.net/problem=400
|
5
|
+
:content: "\r\n<p>\r\nA <b>Fibonacci tree</b> is a binary tree recursively defined
|
6
|
+
as:</p>\n<ul>\n<li>T(0) is the empty tree.\r\n</li>\n<li>T(1) is the binary tree
|
7
|
+
with only one node.\r\n</li>\n<li>T(<var>k</var>) consists of a root node that has
|
8
|
+
T(<var>k</var>-1) and T(<var>k</var>-2) as children.\r\n</li>\n</ul>\n<p>\r\nOn
|
9
|
+
such a tree two players play a take-away game. On each turn a player selects a node
|
10
|
+
and removes that node along with the subtree rooted at that node.<br>\r\nThe player
|
11
|
+
who is forced to take the root node of the entire tree loses.</p>\n<p>\r\n\r\n</p>\n<p>\r\nHere
|
12
|
+
are the winning moves of the first player on the first turn for T(<var>k</var>)
|
13
|
+
from <var>k</var>=1 to <var>k</var>=6.\r\n</p>\n<p align=\"center\"><img src=\"project/images/p400_winning.png\"></p>\r\n\r\n\r\n\r\nLet
|
14
|
+
<var>f</var>(<var>k</var>) be the number of winning moves of the first player (i.e.
|
15
|
+
the moves for which the second player has no winning strategy) on the first turn
|
16
|
+
of the game when this game is played on T(<var>k</var>).\r\n\r\n\r\n<p>\r\nFor example,
|
17
|
+
<var>f</var>(5) = 1 and <var>f</var>(10) = 17.\r\n</p>\r\n\r\n<p>\r\nFind <var>f</var>(10000).
|
18
|
+
Give the last 18 digits of your answer.\r\n</p>\r\n"
|
@@ -0,0 +1,11 @@
|
|
1
|
+
---
|
2
|
+
:id: 401
|
3
|
+
:name: Sum of squares of divisors
|
4
|
+
:url: http://projecteuler.net/problem=401
|
5
|
+
:content: "\r\n<p>\r\nThe divisors of 6 are 1,2,3 and 6.<br>\r\nThe sum of the squares
|
6
|
+
of these numbers is 1+4+9+36=50.\r\n</p>\r\n<p>\r\nLet sigma2(n) represent the sum
|
7
|
+
of the squares of the divisors of n.\r\nThus sigma2(6)=50.\r\n</p>\r\nLet SIGMA2
|
8
|
+
represent the summatory function of sigma2, that is SIGMA2(n)=<img src=\"images/symbol_sum.gif\"
|
9
|
+
width=\"11\" height=\"14\" alt=\"∑\" border=\"0\" style=\"vertical-align:middle;\">sigma2(i)
|
10
|
+
for i=1 to n.<br>\r\nThe first 6 values of SIGMA2 are: 1,6,16,37,63 and 113.\r\n\r\n<p>\r\nFind
|
11
|
+
SIGMA2(10<sup>15</sup>) modulo 10<sup>9</sup>. \r\n</p>\r\n"
|
@@ -0,0 +1,25 @@
|
|
1
|
+
---
|
2
|
+
:id: 402
|
3
|
+
:name: Integer-valued polynomials
|
4
|
+
:url: http://projecteuler.net/problem=402
|
5
|
+
:content: "\r\n<p>\r\nIt can be shown that the polynomial <var>n</var><sup>4</sup>
|
6
|
+
+ 4<var>n</var><sup>3</sup> + 2<var>n</var><sup>2</sup> + 5<var>n</var> is a multiple
|
7
|
+
of 6 for every integer <var>n</var>. It can also be shown that 6 is the largest
|
8
|
+
integer satisfying this property.\r\n</p>\r\n<p>\r\nDefine M(<var>a</var>, <var>b</var>,
|
9
|
+
<var>c</var>) as the maximum <var>m</var> such that <var>n</var><sup>4</sup> + <var>a</var><var>n</var><sup>3</sup>
|
10
|
+
+ <var>b</var><var>n</var><sup>2</sup> + <var>c</var><var>n</var> is a multiple
|
11
|
+
of <var>m</var> for all integers <var>n</var>. For example, M(4, 2, 5) = 6.\r\n</p>\r\n<p>\r\nAlso,
|
12
|
+
define S(<var>N</var>) as the sum of M(<var>a</var>, <var>b</var>, <var>c</var>)
|
13
|
+
for all 0 <img src=\"images/symbol_lt.gif\" width=\"10\" height=\"10\" alt=\"<\"
|
14
|
+
border=\"0\" style=\"vertical-align:middle;\"><var>a</var>, <var>b</var>, <var>c</var>
|
15
|
+
<img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
16
|
+
style=\"vertical-align:middle;\"><var>N</var>.\r\n</p>\r\n<p>\r\nWe can verify that
|
17
|
+
S(10) = 1972 and S(10000) = 2024258331114.\r\n</p>\r\n<p>\r\nLet F<sub><var>k</var></sub>
|
18
|
+
be the Fibonacci sequence:<br>\r\nF<sub>0</sub> = 0, F<sub>1</sub> = 1 and<br>\r\nF<sub><var>k</var></sub>
|
19
|
+
= F<sub><var>k</var>-1</sub> + F<sub><var>k</var>-2</sub> for <var>k</var> <img
|
20
|
+
src=\"images/symbol_ge.gif\" width=\"10\" height=\"12\" alt=\"≥\" border=\"0\" style=\"vertical-align:middle;\">
|
21
|
+
2.\r\n</p>\r\n<p>\r\nFind the last 9 digits of Σ S(F<sub><var>k</var></sub>) for
|
22
|
+
2 <img src=\"images/symbol_le.gif\" width=\"10\" height=\"12\" alt=\"≤\" border=\"0\"
|
23
|
+
style=\"vertical-align:middle;\"><var>k</var> <img src=\"images/symbol_le.gif\"
|
24
|
+
width=\"10\" height=\"12\" alt=\"≤\" border=\"0\" style=\"vertical-align:middle;\">
|
25
|
+
1234567890123.\r\n</p>\r\n"
|