
{"id":15990,"date":"2014-10-18T15:39:36","date_gmt":"2014-10-18T15:39:36","guid":{"rendered":"http:\/\/www.beautifulwork.org\/?p=15990"},"modified":"2014-10-18T15:39:36","modified_gmt":"2014-10-18T15:39:36","slug":"project-euler-problem-2-internals-using-python-debugger","status":"publish","type":"post","link":"https:\/\/www.trueangle.org\/index.php\/2014\/10\/18\/project-euler-problem-2-internals-using-python-debugger\/","title":{"rendered":"Project Euler Problem 2, solution  internals using  python debugger"},"content":{"rendered":"<pre>\n$python -m pdb project-euler-2.py \n&gt; \/home\/jeffrin\/beautifulwork\/lib\/project-euler-2.py(13)()\n-&gt; '''\n(Pdb) next\n&gt; \/home\/jeffrin\/beautifulwork\/lib\/project-euler-2.py(15)()\n-&gt; cache = {}\n(Pdb) next\n&gt; \/home\/jeffrin\/beautifulwork\/lib\/project-euler-2.py(16)()\n-&gt; def fib(n):\n(Pdb) next\n&gt; \/home\/jeffrin\/beautifulwork\/lib\/project-euler-2.py(20)()\n-&gt; n = 0\n(Pdb) next\n&gt; \/home\/jeffrin\/beautifulwork\/lib\/project-euler-2.py(21)()\n-&gt; i = 0\n(Pdb) next\n&gt; \/home\/jeffrin\/beautifulwork\/lib\/project-euler-2.py(22)()\n-&gt; while fib(i)  \/home\/jeffrin\/beautifulwork\/lib\/project-euler-2.py(23)()\n-&gt; if not fib(i) % 2: n = n + fib(i)\n(Pdb) next\n&gt; \/home\/jeffrin\/beautifulwork\/lib\/project-euler-2.py(24)()\n-&gt; i = i + 1\n(Pdb) next\n&gt; \/home\/jeffrin\/beautifulwork\/lib\/project-euler-2.py(22)()\n-&gt; while fib(i)  \/home\/jeffrin\/beautifulwork\/lib\/project-euler-2.py(23)()\n-&gt; if not fib(i) % 2: n = n + fib(i)\n(Pdb) next\n&gt; \/home\/jeffrin\/beautifulwork\/lib\/project-euler-2.py(24)()\n-&gt; i = i + 1\n(Pdb) continue\n4613732\nThe program finished and will be restarted\n&gt; \/home\/jeffrin\/beautifulwork\/lib\/project-euler-2.py(13)()\n-&gt; '''\n(Pdb) \n<\/pre>\n<p><a href=\"http:\/\/www.bytemuse.com\/post\/fibonacci-spiral\/\">http:\/\/www.bytemuse.com\/post\/fibonacci-spiral\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>$python -m pdb project-euler-2.py &gt; \/home\/jeffrin\/beautifulwork\/lib\/project-euler-2.py(13)() -&gt; &#8221;&#8217; (Pdb) next &gt; \/home\/jeffrin\/beautifulwork\/lib\/project-euler-2.py(15)() -&gt; cache = {} (Pdb) next &gt; \/home\/jeffrin\/beautifulwork\/lib\/project-euler-2.py(16)() -&gt; def fib(n): (Pdb) next &gt; \/home\/jeffrin\/beautifulwork\/lib\/project-euler-2.py(20)() -&gt; n = 0 (Pdb) next &gt; \/home\/jeffrin\/beautifulwork\/lib\/project-euler-2.py(21)() -&gt; i = 0 (Pdb) next &gt; \/home\/jeffrin\/beautifulwork\/lib\/project-euler-2.py(22)() -&gt; while fib(i) \/home\/jeffrin\/beautifulwork\/lib\/project-euler-2.py(23)() -&gt; if not fib(i) % 2: n = &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.trueangle.org\/index.php\/2014\/10\/18\/project-euler-problem-2-internals-using-python-debugger\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Project Euler Problem 2, solution  internals using  python debugger&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[31,91,93],"tags":[752],"_links":{"self":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/15990"}],"collection":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/comments?post=15990"}],"version-history":[{"count":0,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/15990\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media?parent=15990"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/categories?post=15990"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/tags?post=15990"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}