{"id":24345,"date":"2022-05-11T18:36:56","date_gmt":"2022-05-11T23:36:56","guid":{"rendered":"http:\/\/blog.kenperlin.com\/?p=24345"},"modified":"2022-05-11T18:36:56","modified_gmt":"2022-05-11T23:36:56","slug":"widget-wednesdays-19","status":"publish","type":"post","link":"http:\/\/blog.kenperlin.com\/?p=24345","title":{"rendered":"Widget Wednesdays #19"},"content":{"rendered":"<p>This week I am going to something different for Widget Wednesdays. I am going to describe my favorite &#8220;simplest computer program&#8221;.<\/p>\n<p>When somebody tells me that they could never learn how to program, this is the program that I scribble down on a napkin for them. Some of you might be familiar with this &#8212; it&#8217;s quite beautiful.<\/p>\n<p>Most of us learned about the Fibonacci sequence when we were kids. It describes so many things in nature, from the shape of flower petals to how populations grow.<\/p>\n<p>The principle is very simple. Starting with the numbers 0 and 1, you just keep adding the last two numbers to get the next one:<\/p>\n<p><font face=\"courier\">&nbsp; &nbsp; 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, &#8230;<\/font><\/p>\n<p>Nicely enough, a program to compute the nth number in the series looks like this:<\/p>\n<p><font face=\"courier\">fibonacci(n) is<br \/>\n<\/font><font face=\"courier\">&nbsp; &nbsp; if n &lt; 2<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; then n<br \/>\n&nbsp; &nbsp; else<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; fibonacci(n-2) + fibonacci(n-1)<\/font><\/p>\n<p>No matter how math-phobic you think you are, that is a very easy computer program to understand. And it contains many of the core ideas in computer programming &#8212; functions, variables, conditionals, arithmetic, and even recursion.<\/p>\n<p>Which makes me hopeful for the whole process of teaching programming. As an ancient Chinese proverb never said: &#8220;A program of a thousand lines begins with a single step.&#8221;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This week I am going to something different for Widget Wednesdays. I am going to describe my favorite &#8220;simplest computer program&#8221;. When somebody tells me that they could never learn how to program, this is the program that I scribble down on a napkin for them. Some of you might be familiar with this &#8212; &hellip; <a href=\"http:\/\/blog.kenperlin.com\/?p=24345\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Widget Wednesdays #19&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/posts\/24345"}],"collection":[{"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=24345"}],"version-history":[{"count":9,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/posts\/24345\/revisions"}],"predecessor-version":[{"id":24354,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=\/wp\/v2\/posts\/24345\/revisions\/24354"}],"wp:attachment":[{"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=24345"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=24345"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.kenperlin.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=24345"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}