{"id":7621,"date":"2026-06-08T00:01:12","date_gmt":"2026-06-08T07:01:12","guid":{"rendered":"https:\/\/c-for-dummies.com\/blog\/?p=7621"},"modified":"2026-06-06T14:53:06","modified_gmt":"2026-06-06T21:53:06","slug":"that-series-that-lacks-a-name-but-equals-5e-solution","status":"publish","type":"post","link":"https:\/\/c-for-dummies.com\/blog\/?p=7621","title":{"rendered":"That Series That Lacks a Name but Equals 5<em>e<\/em> &#8211; Solution"},"content":{"rendered":"<p>Once again, I dive into the murky waters of mathematics for <a href=\"https:\/\/c-for-dummies.com\/blog\/?p=7603\">this month&#8217;s Exercise<\/a>. The challenge is to code the Series That Has No Name (STHNN), which converges on the value 5<em>e<\/em>.<br \/>\n<!--more--><br \/>\nFrom the original post, Figure 1 shows the series as it&#8217;s written in mathematical hieroglyphics. The task is to convert these cryptic symbols into C code, with the program spitting out the value of <em>e<\/em>, Euler&#8217;s number.<\/p>\n<div id=\"attachment_7604\" style=\"width: 560px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-7604\" src=\"https:\/\/c-for-dummies.com\/blog\/wp-content\/uploads\/2026\/05\/0601-Figure1.png\" alt=\"\" width=\"550\" height=\"415\" class=\"size-full wp-image-7604\" srcset=\"https:\/\/c-for-dummies.com\/blog\/wp-content\/uploads\/2026\/05\/0601-Figure1.png 550w, https:\/\/c-for-dummies.com\/blog\/wp-content\/uploads\/2026\/05\/0601-Figure1-300x226.png 300w, https:\/\/c-for-dummies.com\/blog\/wp-content\/uploads\/2026\/05\/0601-Figure1-398x300.png 398w\" sizes=\"auto, (max-width: 550px) 100vw, 550px\" \/><p id=\"caption-attachment-7604\" class=\"wp-caption-text\">Figure 1. The frightening mathematical Series That Has No Name.<\/p><\/div>\n<p>For my solution I use two functions: <em>factorial()<\/em> and <em>cube()<\/em>.<\/p>\n<p>The <em>factorial()<\/em> function I stole from an <a href=\"https:\/\/c-for-dummies.com\/blog\/?p=1080\">earlier Lesson<\/a>, which I hinted at in the Exercise post. The <em>cube()<\/em> function returns the argument passed cubed. I could use the <em>pow()<\/em> function, but just decided instead to multiply the passed value thrice, as shown below.<\/p>\n<h3><a href=\"https:\/\/github.com\/dangookin\/C-For-Dummies-Blog\/blob\/master\/2026_06-Exercise.c\" rel=\"noopener\" target=\"_blank\">2026_06-Exercise.c<\/a><\/h3>\n<pre class=\"screen\">\r\n#include &lt;stdio.h&gt;\r\n\r\n<span class=\"comments\">\/* calculate the factorial *\/<\/span>\r\nlong factorial(long f)\r\n{\r\n    if( f==1 )\r\n        return(f);\r\n    else\r\n        return(f * factorial(f-1));\r\n}\r\n\r\n<span class=\"comments\">\/* calculate the cube *\/<\/span>\r\nlong cube(long c)\r\n{\r\n    return( c*c*c );\r\n}\r\n\r\nint main()\r\n{\r\n    int x;\r\n    float e = 0.0;\r\n\r\n    for( x=1; x&lt;50; x++ )\r\n        e += (float)cube(x)\/factorial(x);\r\n\r\n    printf(\"%f\\n\",e\/5.0);\r\n\r\n    return 0;\r\n}<\/pre>\n<p>The <em>main()<\/em> function uses a <em>for<\/em> loop to calculate the value of variable <code>e<\/code>, which is initialized to zero when the variable is declared:<\/p>\n<p><code>float e = 0.0;<\/code><\/p>\n<p>In the <em>for<\/em> loop, variable <code>e<\/code> is increased each iteration by the value of <code>x<\/code> cubed divided by <code>x<\/code> factorial. It&#8217;s a simple expression that represents the STHNN. I set the upper limit on variable <code>x<\/code> to 50 as larger values overflow but 50 still results in an approximation of <em>e<\/em> that works.<\/p>\n<p>Because the STHNN results in 5<em>e<\/em>, the result output is divided by 5.0, which results in <em>e<\/em>:<\/p>\n<pre>2.718282<\/pre>\n<p>I hope that your solution met with success.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Once again, I dive into the murky waters of mathematics for this month&#8217;s Exercise. The challenge is to code the Series That Has No Name (STHNN), which converges on the value 5e.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-7621","post","type-post","status-publish","format-standard","hentry","category-solution"],"_links":{"self":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/7621","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7621"}],"version-history":[{"count":3,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/7621\/revisions"}],"predecessor-version":[{"id":7639,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/7621\/revisions\/7639"}],"wp:attachment":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7621"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7621"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7621"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}