{"id":1218,"date":"2018-08-17T15:27:41","date_gmt":"2018-08-17T14:27:41","guid":{"rendered":"https:\/\/solidt.eu\/site\/?p=1218"},"modified":"2018-08-17T15:27:41","modified_gmt":"2018-08-17T14:27:41","slug":"fibonnacci","status":"publish","type":"post","link":"https:\/\/solidt.eu\/site\/fibonnacci\/","title":{"rendered":"Fibonnacci"},"content":{"rendered":"<pre class=\"lang:default decode:true  \">const round = Math.round, pow = Math.pow, sqrt = Math.sqrt\r\nconst sqrt5 = sqrt(5), phi = (1 + sqrt(5)) \/ 2\r\nconst fibonacci1 = (n) =&gt; round((pow(phi, n) -  pow(1-phi, n)) \/ sqrt5)\r\n\r\nfunction fibonacci2(n) {\r\n\treturn Math.round((Math.pow((1 + Math.sqrt(5)) \/ 2, n) -  Math.pow(-2 \/ (1 + Math.sqrt(5)), n)) \/  Math.sqrt(5));\r\n}\r\n\r\nfunction fib(a, b, n) { \r\n\tif(n) {\r\n\t\treturn fib(b, a + b, n - 1); \r\n\t} else {\r\n\t\treturn a;\r\n\t}\r\n}\r\n\r\nconst fibonacci3 = (n) =&gt; {\r\n\treturn fib(0, 1, n);\r\n}<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>const round = Math.round, pow = Math.pow, sqrt = Math.sqrt const sqrt5 = sqrt(5), phi = (1 + sqrt(5)) \/ 2 const fibonacci1 = (n) =&gt; round((pow(phi, n) &#8211; pow(1-phi, n)) \/ sqrt5) function fibonacci2(n) { return Math.round((Math.pow((1 + Math.sqrt(5)) \/ 2, n) &#8211; Math.pow(-2 \/ (1 + Math.sqrt(5)), n)) \/ Math.sqrt(5)); } function fib(a, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[5,4],"tags":[],"class_list":["post-1218","post","type-post","status-publish","format-standard","hentry","category-javascript","category-programming"],"_links":{"self":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts\/1218","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/comments?post=1218"}],"version-history":[{"count":1,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts\/1218\/revisions"}],"predecessor-version":[{"id":1219,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts\/1218\/revisions\/1219"}],"wp:attachment":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/media?parent=1218"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/categories?post=1218"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/tags?post=1218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}