{"id":76,"date":"2013-04-05T13:42:44","date_gmt":"2013-04-05T05:42:44","guid":{"rendered":"http:\/\/nike0good.jp1.rpvhost.net\/?p=76"},"modified":"2013-04-05T13:42:44","modified_gmt":"2013-04-05T05:42:44","slug":"project-euler-2-even-fibonacci-numbers","status":"publish","type":"post","link":"https:\/\/nike0good.com\/?p=76","title":{"rendered":"Project Euler 2-Even Fibonacci numbers"},"content":{"rendered":"<h2>Even Fibonacci numbers<\/h2>\n<div>\n<h3>Problem 2<\/h3>\n<\/div>\n<div role=\"problem\">\n<p>Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:<\/p>\n<p>1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...<\/p>\n<p>By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.<\/p>\n<\/div>\n<div>\n<form action=\"http:\/\/projecteuler.net\/problem=2\" method=\"post\" name=\"form\">\n<table width=\"400\" cellpadding=\"10\" align=\"center\">\n<tbody>\n<tr>\n<td>\n<table>\n<tbody>\n<tr>\n<td>\n<div>Answer:<\/div>\n<\/td>\n<td><b>4613732<\/b><\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">Completed on Fri, 5 Apr 2013, 06:37<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/form>\n<\/div>\n<p>Go to the thread for&nbsp;<a href=\"http:\/\/projecteuler.net\/thread=2\">problem 2<\/a>&nbsp;in the forum.<\/p>\n<p>&nbsp;Even(\u662f\u5076\u6570\u7684\u610f\u601d\u2026\u2026(\u2500.\u2500|||<\/p>\n<p><code lang=\"python\">f=[1,1,1]<br \/>\ni=2<br \/>\nans=0<br \/>\nwhile f[i]+f[i-1]&lt;4000000:<br \/>\n    i=i+1<br \/>\n    f.append(f[i-1]+f[i-2])<br \/>\n    if (f[i]%2==0): ans=ans+f[i]<br \/>\nprint sum(f)-1,f,ans<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Even Fibonacci numbers Problem 2 Each new term in the F [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","footnotes":""},"categories":[5],"tags":[32,42],"class_list":["post-76","post","type-post","status-publish","format-standard","hentry","category-mathematics","tag-fibonacci-number","tag-project-euler"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Project Euler 2-Even Fibonacci numbers - nike0good<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/nike0good.com\/?p=76\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Project Euler 2-Even Fibonacci numbers - nike0good\" \/>\n<meta property=\"og:description\" content=\"Even Fibonacci numbers Problem 2 Each new term in the F [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/nike0good.com\/?p=76\" \/>\n<meta property=\"og:site_name\" content=\"nike0good\" \/>\n<meta property=\"article:published_time\" content=\"2013-04-05T05:42:44+00:00\" \/>\n<meta name=\"author\" content=\"nike0good\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"nike0good\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/nike0good.com\\\/?p=76#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/nike0good.com\\\/?p=76\"},\"author\":{\"name\":\"nike0good\",\"@id\":\"https:\\\/\\\/nike0good.com\\\/#\\\/schema\\\/person\\\/4defa38da89de87e400861e73396baad\"},\"headline\":\"Project Euler 2-Even Fibonacci numbers\",\"datePublished\":\"2013-04-05T05:42:44+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/nike0good.com\\\/?p=76\"},\"wordCount\":73,\"commentCount\":0,\"keywords\":[\"Fibonacci number\",\"Project Euler\"],\"articleSection\":[\"\u6570\u5b66\uff01\u6570\u5b66\uff01\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/nike0good.com\\\/?p=76#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/nike0good.com\\\/?p=76\",\"url\":\"https:\\\/\\\/nike0good.com\\\/?p=76\",\"name\":\"Project Euler 2-Even Fibonacci numbers - nike0good\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/nike0good.com\\\/#website\"},\"datePublished\":\"2013-04-05T05:42:44+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/nike0good.com\\\/#\\\/schema\\\/person\\\/4defa38da89de87e400861e73396baad\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/nike0good.com\\\/?p=76#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/nike0good.com\\\/?p=76\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/nike0good.com\\\/?p=76#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/nike0good.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Project Euler 2-Even Fibonacci numbers\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/nike0good.com\\\/#website\",\"url\":\"https:\\\/\\\/nike0good.com\\\/\",\"name\":\"nike0good\",\"description\":\"\u6709\u6240\u4f5c\u4e3a\u662f\u4eba\u751f\u7684\u6700\u9ad8\u5883\u754c\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/nike0good.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/nike0good.com\\\/#\\\/schema\\\/person\\\/4defa38da89de87e400861e73396baad\",\"name\":\"nike0good\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8e5fa08d5c367a1a6fb5ff13bb10ed5a331f981513256951290ae42322da6854?s=96&d=identicon&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8e5fa08d5c367a1a6fb5ff13bb10ed5a331f981513256951290ae42322da6854?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8e5fa08d5c367a1a6fb5ff13bb10ed5a331f981513256951290ae42322da6854?s=96&d=identicon&r=g\",\"caption\":\"nike0good\"},\"sameAs\":[\"https:\\\/\\\/nike0good.com\"],\"url\":\"https:\\\/\\\/nike0good.com\\\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Project Euler 2-Even Fibonacci numbers - nike0good","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/nike0good.com\/?p=76","og_locale":"zh_CN","og_type":"article","og_title":"Project Euler 2-Even Fibonacci numbers - nike0good","og_description":"Even Fibonacci numbers Problem 2 Each new term in the F [&hellip;]","og_url":"https:\/\/nike0good.com\/?p=76","og_site_name":"nike0good","article_published_time":"2013-04-05T05:42:44+00:00","author":"nike0good","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"nike0good"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/nike0good.com\/?p=76#article","isPartOf":{"@id":"https:\/\/nike0good.com\/?p=76"},"author":{"name":"nike0good","@id":"https:\/\/nike0good.com\/#\/schema\/person\/4defa38da89de87e400861e73396baad"},"headline":"Project Euler 2-Even Fibonacci numbers","datePublished":"2013-04-05T05:42:44+00:00","mainEntityOfPage":{"@id":"https:\/\/nike0good.com\/?p=76"},"wordCount":73,"commentCount":0,"keywords":["Fibonacci number","Project Euler"],"articleSection":["\u6570\u5b66\uff01\u6570\u5b66\uff01"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/nike0good.com\/?p=76#respond"]}]},{"@type":"WebPage","@id":"https:\/\/nike0good.com\/?p=76","url":"https:\/\/nike0good.com\/?p=76","name":"Project Euler 2-Even Fibonacci numbers - nike0good","isPartOf":{"@id":"https:\/\/nike0good.com\/#website"},"datePublished":"2013-04-05T05:42:44+00:00","author":{"@id":"https:\/\/nike0good.com\/#\/schema\/person\/4defa38da89de87e400861e73396baad"},"breadcrumb":{"@id":"https:\/\/nike0good.com\/?p=76#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/nike0good.com\/?p=76"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/nike0good.com\/?p=76#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/nike0good.com\/"},{"@type":"ListItem","position":2,"name":"Project Euler 2-Even Fibonacci numbers"}]},{"@type":"WebSite","@id":"https:\/\/nike0good.com\/#website","url":"https:\/\/nike0good.com\/","name":"nike0good","description":"\u6709\u6240\u4f5c\u4e3a\u662f\u4eba\u751f\u7684\u6700\u9ad8\u5883\u754c","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/nike0good.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/nike0good.com\/#\/schema\/person\/4defa38da89de87e400861e73396baad","name":"nike0good","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/secure.gravatar.com\/avatar\/8e5fa08d5c367a1a6fb5ff13bb10ed5a331f981513256951290ae42322da6854?s=96&d=identicon&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/8e5fa08d5c367a1a6fb5ff13bb10ed5a331f981513256951290ae42322da6854?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8e5fa08d5c367a1a6fb5ff13bb10ed5a331f981513256951290ae42322da6854?s=96&d=identicon&r=g","caption":"nike0good"},"sameAs":["https:\/\/nike0good.com"],"url":"https:\/\/nike0good.com\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/nike0good.com\/index.php?rest_route=\/wp\/v2\/posts\/76","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nike0good.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nike0good.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nike0good.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nike0good.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=76"}],"version-history":[{"count":0,"href":"https:\/\/nike0good.com\/index.php?rest_route=\/wp\/v2\/posts\/76\/revisions"}],"wp:attachment":[{"href":"https:\/\/nike0good.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=76"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nike0good.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=76"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nike0good.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=76"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}