{"id":25604,"date":"2014-12-03T22:11:06","date_gmt":"2014-12-03T13:11:06","guid":{"rendered":"http:\/\/www.softantenna.com\/wp\/?p=25604"},"modified":"2014-12-03T22:11:06","modified_gmt":"2014-12-03T13:11:06","slug":"projectheuler","status":"publish","type":"post","link":"https:\/\/softantenna.com\/blog\/projectheuler\/","title":{"rendered":"\u65b0\u3057\u3044\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u306e\u5b66\u7fd2\u306b\u6700\u9069\u306a\u554f\u984c\u96c6\u30b5\u30a4\u30c8\u300cProject Euler\u300d"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2014\/12\/Iprojecteuler.png\" alt=\"Projecteuler\" title=\"projecteuler.png\" border=\"0\" width=\"546\" height=\"293\" \/><\/p>\n<p>\u300c<a href=\"https:\/\/projecteuler.net\/\">Project Euler<\/a>\u300d\u306f\u6570\u5b66\u3084\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306b\u95a2\u3059\u308b\u554f\u984c\u304c\u305f\u304f\u3055\u3093\u96c6\u3081\u3089\u308c\u305f\u554f\u984c\u96c6\u30b5\u30a4\u30c8\u3067\u3059\u3002<\/p>\n<p>\u51fa\u984c\u3055\u308c\u308b\u554f\u984c\u306f\u7c21\u5358\u306a\u3082\u306e\u304b\u3089\u96e3\u3057\u3044\u3082\u306e\u307e\u3067\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3\u8c4a\u5bcc\u3002\u5b9f\u969b\u306b\u554f\u984c\u3092\u624b\u3092\u52d5\u304b\u3057\u3066\u89e3\u3044\u3066\u3044\u304f\u3046\u3061\u306b\u3001\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u3084\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306b\u95a2\u3059\u308b\u77e5\u8b58\u304c\u8eab\u306b\u3064\u3044\u3066\u3044\u304f\u3053\u3068\u3067\u3057\u3087\u3046\u3002<\/p>\n<p><!--more--><\/p>\n<h3>3\u30685\u306e\u500d\u6570<\/h3>\n<p>\u4f8b\u3048\u3070\u4e00\u756a\u7c21\u5358\u306a\u554f\u984c\u300c<a href=\"\">Multiples of 3 and 5<\/a>\u300d\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3002<\/p>\n<pre>\nIf we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.\n\nFind the sum of all the multiples of 3 or 5 below 1000.\n<\/pre>\n<p>\u300c10\u672a\u6e80\u306e\u81ea\u7136\u6570\u306e\u4e2d\u30673\u307e\u305f\u306f5\u306e\u500d\u6570\u3092\u30ea\u30b9\u30c8\u30a2\u30c3\u30d7\u3059\u308b\u3068\u30013,5,6,9\u304c\u898b\u3064\u304b\u308b\u3002\u305d\u308c\u3089\u306e\u5408\u8a08\u306f23\u306b\u306a\u308b\u30021000\u672a\u6e80\u306e3\u30685\u306e\u500d\u6570\u306e\u5408\u8a08\u3092\u6c42\u3081\u3088\u300d<\/p>\n<p>\u8981\u3059\u308b\u306b1000\u672a\u6e80\u306e\u6570\u306e\u4e2d\u306b\u542b\u307e\u308c\u308b3\u307e\u305f\u306f5\u306e\u500d\u6570\u306e\u5408\u8a08\u3092\u6c42\u3081\u308c\u3070\u826f\u3044\u3088\u3046\u3067\u3059\u3002\u6570\u5b66\u7684\u306b\u6700\u9069\u3067\u306f\u306a\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u30d7\u30ed\u30b0\u30e9\u30de\u306a\u3089\u3070\u81ea\u7136\u306b\u6b21\u306e\u3088\u3046\u306a\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u304c\u982d\u306b\u6d6e\u304b\u3076\u306e\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b(Ruby\u3067\u3059)\u3002<\/p>\n<pre><code class=\"ruby\">def mysum(limit)\n  sum = 0\n  1.upto(limit) do |i|\n    if i % 3 == 0 || i % 5 == 0\n       sum += i\n    end\n  end\n  sum\nend\n\nputs mysum(9) # => 23\nputs mysum(999) # => \u79d8\u5bc6\n<\/code><\/pre>\n<p>\u7b54\u3048\u304c\u3082\u3068\u307e\u3063\u305f\u3089\u56de\u7b54\u3092\u30b5\u30a4\u30c8\u306b\u5165\u529b\u3057\u3001\u4ee5\u4e0b\u306e\u753b\u50cf\u304c\u8868\u793a\u3055\u308c\u308c\u3070\u6b63\u89e3\u3067\u3059\uff01\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2014\/12\/INewImage14.png\" alt=\"NewImage\" title=\"NewImage.png\" border=\"0\" width=\"200\" height=\"200\" \/><\/p>\n<p>\u6b63\u89e3\u3059\u308b\u3068\u554f\u984c\u306b\u5bfe\u3059\u308b\u30d5\u30a9\u30fc\u30e9\u30e0\u3092\u8868\u793a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u3001\u5343\u5dee\u4e07\u5225\u306a\u89e3\u7b54\u4f8b\u3092\u78ba\u8a8d\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u7684\u306a\u89e3\u304d\u65b9\u304b\u3089\u6570\u5b66\u7684\u306a\u89e3\u6cd5\u307e\u3067\u3044\u308d\u3044\u308d\u3042\u308b\u3053\u3068\u304c\u5206\u304b\u308a\u307e\u3059\u3002<\/p>\n<p>\u9032\u6357\u72b6\u6cc1\u306f\u4fdd\u5b58\u3055\u308c\u308b\u306e\u3067\u4eca\u5f8c\u306e\u52b1\u307f\u306b\u3082\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>\u307e\u3068\u3081<\/h3>\n<p>\u554f\u984c\u304c\u82f1\u8a9e\u3067\u51fa\u984c\u3059\u308b\u306e\u3067\u53b3\u5bc6\u306a\u610f\u5473\u3092\u8aad\u307f\u53d6\u308b\u306e\u304c\u5927\u5909\u2026\u3068\u601d\u3063\u3066\u691c\u7d22\u3057\u3066\u307f\u308b\u3068\u300c<a href=\"http:\/\/odz.sakura.ne.jp\/projecteuler\/index.php?Project%20Euler\">\u65e5\u672c\u8a9eWiki\u30b5\u30a4\u30c8<\/a>\u300d\u3067\u554f\u984c\u304c\u65e5\u672c\u8a9e\u306b\u7ffb\u8a33\u3055\u308c\u3066\u3044\u307e\u3057\u305f\u3002\u6570\u5b66\u3084\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306b\u81ea\u4fe1\u304c\u3042\u308b\u3051\u3069\u82f1\u8a9e\u306f\u3061\u3087\u3063\u3068\u2026\u3068\u3044\u3046\u65b9\u306f\u53c2\u8003\u306b\u306a\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u300cProject Euler\u300d\u306f\u6570\u5b66\u3084\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306b\u95a2\u3059\u308b\u554f\u984c\u304c\u305f\u304f\u3055\u3093\u96c6\u3081\u3089\u308c\u305f\u554f\u984c\u96c6\u30b5\u30a4\u30c8\u3067\u3059\u3002 \u51fa\u984c\u3055\u308c\u308b\u554f\u984c\u306f\u7c21\u5358\u306a\u3082\u306e\u304b\u3089\u96e3\u3057\u3044\u3082\u306e\u307e\u3067\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3\u8c4a\u5bcc\u3002\u5b9f\u969b\u306b\u554f\u984c\u3092\u624b\u3092\u52d5\u304b\u3057\u3066\u89e3\u3044\u3066\u3044\u304f\u3046\u3061\u306b\u3001\u30a2\u30eb\u30b4\u30ea\u30ba [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":25602,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[66,75],"tags":[2092,2534],"class_list":["post-25604","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-webservice","category-software","tag-math","tag-program"],"_links":{"self":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/25604","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/comments?post=25604"}],"version-history":[{"count":0,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/25604\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media\/25602"}],"wp:attachment":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media?parent=25604"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/categories?post=25604"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/tags?post=25604"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}