<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>puzzle | Learn C Games Programming Blog</title>
	<atom:link href="https://learncgames.com/tag/puzzle/feed/" rel="self" type="application/rss+xml" />
	<link>https://learncgames.com</link>
	<description>A blog about C, programming games and my ebook(s).</description>
	<lastBuildDate>Mon, 15 Feb 2021 20:18:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://learncgames.com/wp-content/uploads/2020/03/cropped-favicon-32x32.png</url>
	<title>puzzle | Learn C Games Programming Blog</title>
	<link>https://learncgames.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">181446779</site>	<item>
		<title>Answer to the C Puzzle</title>
		<link>https://learncgames.com/answer-to-the-c-puzzle/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=answer-to-the-c-puzzle</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Thu, 18 Feb 2021 00:00:04 +0000</pubDate>
				<category><![CDATA[C]]></category>
		<category><![CDATA[answers]]></category>
		<category><![CDATA[puzzle]]></category>
		<guid isPermaLink="false">https://learncgames.com/?p=2696</guid>

					<description><![CDATA[<p>If you look back at the puzzle, you might think the for loop is a bit odd starting at -1 and that&#8217;s the snag. It exits the for loop immediately because -1 is actually more than 5. It&#8217;s a rather subtle bug. The type of d is obviously int, but the type of (TOTAL_ELEMENTS &#8211; [&#8230;]</p>
The post <a href="https://learncgames.com/answer-to-the-c-puzzle/">Answer to the C Puzzle</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></description>
										<content:encoded><![CDATA[<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:167,&quot;href&quot;:&quot;https:\/\/pixabay.com\/users\/absolutvision-6158753\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=2636254&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20251202005902\/https:\/\/pixabay.com\/users\/absolutvision-6158753\/?utm_source=link-attribution&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 12:22:55&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-13 18:38:53&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-17 08:07:24&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-25 23:09:09&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-06 23:28:36&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-26 01:58:02&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-22 13:45:27&quot;,&quot;http_code&quot;:403}],&quot;broken&quot;:true,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-22 13:45:27&quot;,&quot;http_code&quot;:403},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:168,&quot;href&quot;:&quot;https:\/\/pixabay.com\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=2636254&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260205102120\/https:\/\/pixabay.com\/?utm_source=link-attribution&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 12:22:57&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-13 18:38:57&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-17 08:07:24&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-25 23:09:09&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-06 23:28:36&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-26 01:57:59&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-19 07:31:05&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-22 13:45:26&quot;,&quot;http_code&quot;:403}],&quot;broken&quot;:true,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-22 13:45:26&quot;,&quot;http_code&quot;:403},&quot;process&quot;:&quot;done&quot;}]'></div>
<figure id="attachment_2697" aria-describedby="caption-attachment-2697" style="width: 300px" class="wp-caption alignleft"><img fetchpriority="high" decoding="async" class="size-medium wp-image-2697" src="https://learncgames.com/wp-content/uploads/2021/02/solve-2636254_640-300x168.jpg" alt="Solution" width="300" height="168" srcset="https://learncgames.com/wp-content/uploads/2021/02/solve-2636254_640-300x168.jpg 300w, https://learncgames.com/wp-content/uploads/2021/02/solve-2636254_640.jpg 640w" sizes="(max-width: 300px) 100vw, 300px" /><figcaption id="caption-attachment-2697" class="wp-caption-text">Image by <a href="https://pixabay.com/users/absolutvision-6158753/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=2636254">Gino Crescoli</a> from <a href="https://pixabay.com/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=2636254">Pixabay</a></figcaption></figure>
<p>If you look back at <a title="Link to fc puzzle" href="https://learncgames.com/a-little-c-puzzle/" target="_blank" rel="nofollow noopener">the puzzle</a>, you might think the for loop is a bit odd starting at -1 and that&#8217;s the snag. It exits the for loop immediately because -1 is actually more than 5. It&#8217;s a rather subtle bug. The type of d is obviously <strong>int</strong>, but the type of (TOTAL_ELEMENTS &#8211; 2) is <strong>unsigned int</strong>.</p>
<p>So what I believe is happening is the compiler is promoting d to an unsigned int which is 4294967295, and clearly that&#8217;s a bit larger than 5. To fix this just put (int) before the (TOTAL_ELEMENTS &#8211; 2) in the for loop and it will work.</p>The post <a href="https://learncgames.com/answer-to-the-c-puzzle/">Answer to the C Puzzle</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2696</post-id>	</item>
		<item>
		<title>A little C Puzzle</title>
		<link>https://learncgames.com/a-little-c-puzzle/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=a-little-c-puzzle</link>
					<comments>https://learncgames.com/a-little-c-puzzle/#comments</comments>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Mon, 15 Feb 2021 00:00:30 +0000</pubDate>
				<category><![CDATA[C]]></category>
		<category><![CDATA[question]]></category>
		<category><![CDATA[puzzle]]></category>
		<guid isPermaLink="false">https://learncgames.com/?p=2667</guid>

					<description><![CDATA[<p>The following C program doesn&#8217;t output anything. Why? #include&#60;stdio.h&#62; #define TOTAL_ELEMENTS (sizeof(array) / sizeof(array[0])) int array[] = { 23,34,12,17,204,99,16 }; int main() { int d; for (d = -1; d &#60;= (TOTAL_ELEMENTS - 2); d++) printf(&#34;%d\n&#34;, array[d + 1]); return 0; } &#160; This came from this site by Gowri Kumar which has a lot [&#8230;]</p>
The post <a href="https://learncgames.com/a-little-c-puzzle/">A little C Puzzle</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></description>
										<content:encoded><![CDATA[<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:172,&quot;href&quot;:&quot;https:\/\/pixabay.com\/users\/gdj-1086657\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=1751308&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260205100514\/https:\/\/pixabay.com\/users\/gdj-1086657\/?utm_source=link-attribution&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 12:30:57&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-12 02:18:23&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-25 04:42:44&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-22 09:12:30&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-26 01:45:32&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-31 04:52:21&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-04 15:14:06&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-08 11:23:26&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-12 08:23:34&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-16 00:13:33&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-19 07:31:05&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-23 01:39:42&quot;,&quot;http_code&quot;:403}],&quot;broken&quot;:true,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-23 01:39:42&quot;,&quot;http_code&quot;:403},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:173,&quot;href&quot;:&quot;https:\/\/pixabay.com\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=1751308&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260205102120\/https:\/\/pixabay.com\/?utm_source=link-attribution&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 12:30:59&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-12 22:35:45&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-24 01:06:55&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-27 10:54:03&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-10 00:03:52&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-22 09:12:30&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-26 01:45:32&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-31 04:52:21&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-04 15:14:07&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-08 11:23:27&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-12 08:23:35&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-16 00:13:31&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-19 07:31:05&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-23 01:39:42&quot;,&quot;http_code&quot;:403}],&quot;broken&quot;:true,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-23 01:39:42&quot;,&quot;http_code&quot;:403},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:174,&quot;href&quot;:&quot;http:\/\/www.gowrikumar.com\/c\/index.php&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20250605072906\/http:\/\/www.gowrikumar.com\/c\/index.php&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 12:31:01&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-12 22:35:41&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-25 04:42:44&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-22 09:12:31&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-26 01:45:33&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-31 04:52:31&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-04 15:14:06&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-08 11:23:25&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-12 08:23:36&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-16 00:13:32&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-19 07:31:06&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-23 01:39:43&quot;,&quot;http_code&quot;:200}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-23 01:39:43&quot;,&quot;http_code&quot;:200},&quot;process&quot;:&quot;done&quot;}]'></div>
<figure id="attachment_2668" aria-describedby="caption-attachment-2668" style="width: 182px" class="wp-caption alignleft"><img decoding="async" class="size-medium wp-image-2668" src="https://learncgames.com/wp-content/uploads/2021/02/question-mark-1751308_640-1-182x300.png" alt="Question mark" width="182" height="300" srcset="https://learncgames.com/wp-content/uploads/2021/02/question-mark-1751308_640-1-182x300.png 182w, https://learncgames.com/wp-content/uploads/2021/02/question-mark-1751308_640-1.png 389w" sizes="(max-width: 182px) 100vw, 182px" /><figcaption id="caption-attachment-2668" class="wp-caption-text">Image by <a href="https://pixabay.com/users/gdj-1086657/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=1751308">Gordon Johnson</a> from <a href="https://pixabay.com/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=1751308">Pixabay</a></figcaption></figure>
<p>The following C program doesn&#8217;t output anything. Why?</p>
<pre><code class="language-c" data-line="">#include&lt;stdio.h&gt;

#define TOTAL_ELEMENTS (sizeof(array) / sizeof(array[0]))
int array[] = { 23,34,12,17,204,99,16 };

int main()
{
    int d;

    for (d = -1; d &lt;= (TOTAL_ELEMENTS - 2); d++)
        printf(&quot;%d\n&quot;, array[d + 1]);

    return 0;
}</code></pre>
<p>&nbsp;</p>
<p>This came from <a title="Link to C puzzle page" href="http://www.gowrikumar.com/c/index.php" target="_blank" rel="nofollow noopener">this site</a> by Gowri Kumar which has a lot more C puzzles. Answer in a day or two&#8230;</p>The post <a href="https://learncgames.com/a-little-c-puzzle/">A little C Puzzle</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></content:encoded>
					
					<wfw:commentRss>https://learncgames.com/a-little-c-puzzle/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2667</post-id>	</item>
		<item>
		<title>A challenging Puzzle &#8211; fitting words in a grid</title>
		<link>https://learncgames.com/a-challenging-puzzle-fitting-words-in-a-grid/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=a-challenging-puzzle-fitting-words-in-a-grid</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Mon, 14 Dec 2020 00:00:54 +0000</pubDate>
				<category><![CDATA[C]]></category>
		<category><![CDATA[puzzle]]></category>
		<category><![CDATA[scrabble]]></category>
		<category><![CDATA[words]]></category>
		<guid isPermaLink="false">https://learncgames.com/?p=2058</guid>

					<description><![CDATA[<p>You are given a list of words. You have to fit them into a grid so that the grid is as small as possible. The words can go horizontal or vertical and can use letters from other words (like in Scrabble). But you can&#8217;t have words next to each other except where they share letters [&#8230;]</p>
The post <a href="https://learncgames.com/a-challenging-puzzle-fitting-words-in-a-grid/">A challenging Puzzle – fitting words in a grid</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></description>
										<content:encoded><![CDATA[<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:322,&quot;href&quot;:&quot;https:\/\/github.com\/pjama\/Queens&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20221225210508\/https:\/\/github.com\/pjama\/Queens&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 14:00:10&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-15 03:37:47&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-27 02:37:04&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-03 18:45:17&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-16 06:31:58&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-20 22:25:40&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-24 01:13:33&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-27 12:52:33&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-03 13:48:37&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-12 06:40:29&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-18 10:41:54&quot;,&quot;http_code&quot;:206}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-18 10:41:54&quot;,&quot;http_code&quot;:206},&quot;process&quot;:&quot;done&quot;}]'></div>
<p><img decoding="async" class="alignleft size-medium wp-image-2061" src="https://learncgames.com/wp-content/uploads/2020/12/scrabble-words-273x300.png" alt="\scrabble words" width="273" height="300" srcset="https://learncgames.com/wp-content/uploads/2020/12/scrabble-words-273x300.png 273w, https://learncgames.com/wp-content/uploads/2020/12/scrabble-words.png 323w" sizes="(max-width: 273px) 100vw, 273px" />You are given a list of words. You have to fit them into a grid so that the grid is as small as possible. The words can go horizontal or vertical and can use letters from other words (<em>like in Scrabble</em>). But you can&#8217;t have words next to each other except where they share letters like in the picture above. MN BTW is not a valid Scrabble word so this is wrong! (I er borrowed it from somewhere!)</p>
<p>So words can be placed anywhere, in either orientation. Evaluating all the possibilities could probably be done by brute force. But for each word in each position on the board there are n-1 words to be fitted afterwards. Do you try and fit in each alternate word in a different orientation like horizontal then  vertical then horizontal?</p>
<p>If there are ten words to fit in say in a starting grid of 20 x 20 and the first word is 6 characters long then it can fit in 15 different places along the top line and on each of the 20 lines so that&#8217;s 300 positions. Then if its vertical there another 300 positions. That&#8217;s 600 positions to try. And for each of those 600 there&#8217;s 9! different combinations of words to fit in. 9! = 362,880.</p>
<p>Of course if the first word and the second word have no letters in common then it may be as well to skip that 2nd word and go onto the 3rd and so on. We want to keep the grid from getting too large with unconnected words. Also We might limit the first word to start in th 6 positions in the top row and maybe only the first and 2nd rows. That vastly reduces the number of combinations to try out. But still it&#8217;s a tough thing to program.</p>
<p>C isn&#8217;t usually the best language to program anything with text in, but in this case, we&#8217;re not building sentences or searching, just looking at arrays of characters and so it might just be suitable.</p>
<p>I&#8217;m going to have a go at this and see if it can be done and if so I&#8217;ll publish my code but this may take a few days. If so then it could be used as a basis of a word search generator though the rules about words being next to each other could be relaxed plus words run forwards and backwards in both horizontal and vertical orientation and also diagonal.</p>
<h3>Previous Puzzle Answer</h3>
<p>This was &#8220;I<em>f I have the integers 4,5,6,7 and 8 and a special C function f so that f(4)=2, f(5) = 5, f(6)=10, f(7)=40 and f(8) = 92. What is the function f</em>?&#8221;.Bit of a trick question this as the function is returning the number of unique Queens that could be fitted on a chess board of size n (4&#215;4,5&#215;5..8&#215;8) without being able to attack each other.</p>
<p>Philip Jama has posted a <a title="Link to arranging Queens program on GitHub" href="https://github.com/pjama/Queens" target="_blank" rel="nofollow noopener">C program on GitHub</a> to arrange the number of Queens on a chessboard of the specified size. So the function wasn&#8217;t really a function&#8230;</p>
<p>&nbsp;</p>The post <a href="https://learncgames.com/a-challenging-puzzle-fitting-words-in-a-grid/">A challenging Puzzle – fitting words in a grid</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2058</post-id>	</item>
		<item>
		<title>Interesting number sequence</title>
		<link>https://learncgames.com/interesting-number-sequence/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=interesting-number-sequence</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Sat, 12 Dec 2020 00:00:52 +0000</pubDate>
				<category><![CDATA[C]]></category>
		<category><![CDATA[Other stuff]]></category>
		<category><![CDATA[number sequence]]></category>
		<category><![CDATA[puzzle]]></category>
		<guid isPermaLink="false">https://learncgames.com/?p=2042</guid>

					<description><![CDATA[<p>Here&#8217;s an interesting puzzle (well for some people). If I have the integers 4,5,6,7 and 8 and a special C function f so that f(4)=2, f(5) = 5, f(6)=10, f(7)=40 and f(8) = 92. What is the function f? And no it&#8217;s not a simple array containing the numbers 2,5,10,40,92 at positions 4-8! I also [&#8230;]</p>
The post <a href="https://learncgames.com/interesting-number-sequence/">Interesting number sequence</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></description>
										<content:encoded><![CDATA[<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:323,&quot;href&quot;:&quot;https:\/\/pixabay.com\/users\/clker-free-vector-images-3736\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=29630&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260115073407\/https:\/\/pixabay.com\/users\/clker-free-vector-images-3736\/?utm_source=link-attribution&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 14:00:12&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-10 19:07:29&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-23 23:08:55&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-04 05:21:19&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-10 00:23:08&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-03 02:00:47&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-06 22:41:51&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-18 00:49:33&quot;,&quot;http_code&quot;:403}],&quot;broken&quot;:true,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-18 00:49:33&quot;,&quot;http_code&quot;:403},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:324,&quot;href&quot;:&quot;https:\/\/pixabay.com\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=29630&quot;,&quot;archived_href&quot;:&quot;&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[],&quot;broken&quot;:false,&quot;last_checked&quot;:null,&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:325,&quot;href&quot;:&quot;https:\/\/oeis.org&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260204152645\/https:\/\/oeis.org\/&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 14:00:20&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-10 19:07:29&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-23 23:08:55&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-04 05:21:20&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-10 00:23:10&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-03 02:00:48&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-06 22:42:00&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-18 00:49:34&quot;,&quot;http_code&quot;:200}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-18 00:49:34&quot;,&quot;http_code&quot;:200},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:326,&quot;href&quot;:&quot;https:\/\/en.wikipedia.org\/wiki\/Electron_shell&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260201223847\/https:\/\/en.wikipedia.org\/wiki\/Electron_shell&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 14:00:22&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-10 19:07:29&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-23 23:08:54&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-04 05:21:19&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-10 00:23:09&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-03 02:00:47&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-06 22:41:50&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-18 00:49:34&quot;,&quot;http_code&quot;:200}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-18 00:49:34&quot;,&quot;http_code&quot;:200},&quot;process&quot;:&quot;done&quot;}]'></div>
<figure id="attachment_2043" aria-describedby="caption-attachment-2043" style="width: 300px" class="wp-caption alignleft"><img loading="lazy" decoding="async" class="size-medium wp-image-2043" src="https://learncgames.com/wp-content/uploads/2020/12/chessboard-29630_640-300x300.png" alt="Chess Set" width="300" height="300" srcset="https://learncgames.com/wp-content/uploads/2020/12/chessboard-29630_640-300x300.png 300w, https://learncgames.com/wp-content/uploads/2020/12/chessboard-29630_640-150x150.png 150w, https://learncgames.com/wp-content/uploads/2020/12/chessboard-29630_640.png 640w" sizes="auto, (max-width: 300px) 100vw, 300px" /><figcaption id="caption-attachment-2043" class="wp-caption-text">Image by <a href="https://pixabay.com/users/clker-free-vector-images-3736/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=29630">Clker-Free-Vector-Images</a> from <a href="https://pixabay.com/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=29630">Pixabay</a></figcaption></figure>
<p>Here&#8217;s an interesting puzzle (<em>well for some people</em>). If I have the integers 4,5,6,7 and 8 and a special C function f so that f(4)=2, f(5) = 5, f(6)=10, f(7)=40 and f(8) = 92. What is the function f? And no it&#8217;s not a simple array containing the numbers 2,5,10,40,92 at positions 4-8!</p>
<p>I also checked the <a title="Link to Online Encyclopedia of Online sequences" href="https://oeis.org/" target="_blank" rel="nofollow noopener noreferrer">OEIS</a> (<em>Online Encyclopaedia of Integer sequences</em>) and it&#8217;s not in there either. Years ago I was fooled by a integer sequence that was the maximum number of electrons in <a title="Link to Wikipedia on Electron Shells" href="https://en.wikipedia.org/wiki/Electron_shell" target="_blank" rel="nofollow noopener noreferrer">orbital shells</a> but its definitely not that.</p>
<p>Here&#8217;s a minor clue. It is game related. Answer in a day or two.</p>The post <a href="https://learncgames.com/interesting-number-sequence/">Interesting number sequence</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2042</post-id>	</item>
	</channel>
</rss>
