<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Round 5 in BreakPoint</title>
    <link>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3291261#M28124</link>
    <description>&lt;P&gt;I figured since I contribute here enough, that I can also contribute a question:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The smallest number evenly divisible by 1 thru 5 is 60. The smallest number evenly divisible by 1 thru 10 is 2520. What is the smallest number evenly divisible by 1 thru X where X is any number between 1 and 40?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bonus points for innovative solutions and for speed.&lt;/P&gt;</description>
    <pubDate>Wed, 04 May 2016 14:33:27 GMT</pubDate>
    <dc:creator>bsvare</dc:creator>
    <dc:date>2016-05-04T14:33:27Z</dc:date>
    <item>
      <title>Fun Coding Challenges / Questions</title>
      <link>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3252008#M27823</link>
      <description>&lt;P&gt;As I go through the forums or even work on my own projects I occasionally run across something that, after writing it up, I think "That was fun!" or "That was harder than I thought it would be".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, let's post interesting questions or problems that you come across and let others see what answers they&amp;nbsp;come up with.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2016 16:09:52 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3252008#M27823</guid>
      <dc:creator>BowenM</dc:creator>
      <dc:date>2016-02-11T16:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: Fun Coding Challenges / Questions</title>
      <link>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3252134#M27824</link>
      <description>&lt;P&gt;OK, so I meant to get this started earlier but got busy. &amp;nbsp;I'll also admit that I shamelessly stole the idea from reddit, and so I am going to shamelessly steal the first puzzle. &amp;nbsp;I don't expect later submissions&amp;nbsp;to be this well written or extensive, but this one looked fun.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This exercise is inspired by a &lt;A href="https://www.youtube.com/watch?v=U9qU20VmvaU&amp;amp;feature=youtu.be&amp;amp;t=47" target="_blank"&gt;Numberphile video&lt;/A&gt; (no need to watch past 2:00).&lt;/P&gt;&lt;P&gt;Description&lt;/P&gt;&lt;P&gt;A number of sailors (let's call it N) are stranded on an island with a huge pile of coconuts and a monkey. During the night, each sailor (in turn) does the following without the others knowing:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;He takes one N'th (e.g. if N=5, one fifth) of the coconuts in the pile and hides them&lt;/LI&gt;&lt;LI&gt;The division leaves one coconut left over, which is given to the monkey.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;In the morning, they split the remaining coconuts between them. This time the split is even. There's nothing left over for the monkey.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Your task:&lt;/STRONG&gt; Given the number of sailors (N), how many coconuts were in the pile to begin with (lowest possible number)?&lt;/P&gt;&lt;P&gt;Formal inputs/outputs Input&lt;/P&gt;&lt;P&gt;The input is a single number: N, the number of sailors. This number is a whole number that is greater than or equal to 2.&lt;/P&gt;&lt;P&gt;Output&lt;/P&gt;&lt;P&gt;The output is a single number: the number of coconuts in the original pile.&lt;/P&gt;&lt;P&gt;Sample input/output&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Input:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;5&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Output:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;3121&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Sample solution for 5 sailors:&lt;/STRONG&gt; &lt;A href="https://jsfiddle.net/722gjnze/8/" target="_blank"&gt;https://jsfiddle.net/722gjnze/8/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Credit&lt;/P&gt;&lt;P&gt;This challenge was originally &lt;A href="https://redd.it/3yjqno" target="_blank"&gt;suggested&lt;/A&gt; on &lt;A href="https://www.reddit.com/r/dailyprogrammer_ideas" target="_blank"&gt;/r/dailyprogrammer_ideas&lt;/A&gt; by &lt;A href="https://www.reddit.com/u/TinyLebowski" target="_blank"&gt;/u/TinyLebowski&lt;/A&gt; (prior to some changes by me). Have a cool challenge idea? Hop on over to &lt;A href="https://www.reddit.com/r/dailyprogrammer_ideas" target="_blank"&gt;/r/dailyprogrammer_ideas&lt;/A&gt; to tell everyone about it!&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit:&amp;nbsp;Source:&amp;nbsp;&lt;A href="https://www.reddit.com/r/dailyprogrammer/comments/43ouxy/20160201_challenge_252_easy_sailors_and_monkeys/" target="_blank"&gt;https://www.reddit.com/r/dailyprogrammer/comments/43ouxy/20160201_challenge_252_easy_sailors_and_monkeys/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2016 19:16:15 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3252134#M27824</guid>
      <dc:creator>BowenM</dc:creator>
      <dc:date>2016-02-11T19:16:15Z</dc:date>
    </item>
    <item>
      <title>Re: Fun Coding Challenges / Questions</title>
      <link>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3252142#M27825</link>
      <description>&lt;P&gt;It's not an individual challenge, but I've fount the &lt;A href="https://projecteuler.net/" target="_blank"&gt;https://projecteuler.net/&lt;/A&gt; website, and I've been attempting to go through all the puzzles here and attempt to solve in LabVIEW (only). They can get tough very quickly.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2016 19:40:01 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3252142#M27825</guid>
      <dc:creator>bsvare</dc:creator>
      <dc:date>2016-02-11T19:40:01Z</dc:date>
    </item>
    <item>
      <title>Re: Fun Coding Challenges / Questions</title>
      <link>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3252145#M27826</link>
      <description>&lt;P&gt;That was fun, I needed a break this afternoon. Once you get to 8 sailors it takes a while. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-SPOILER&gt;&lt;IMG src="https://ip1.i.lithium.com/f659a033a737213a2a24116699df2243e57d2097/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f31373833383069394234393043333042433136383039462f696d6167652d73697a652f6f726967696e616c3f763d6d70626c2d312670783d2d31" border="0" alt="sailors2.png" title="sailors2.png" /&gt;&lt;/LI-SPOILER&gt;</description>
      <pubDate>Thu, 11 Feb 2016 19:47:15 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3252145#M27826</guid>
      <dc:creator>Darren</dc:creator>
      <dc:date>2016-02-11T19:47:15Z</dc:date>
    </item>
    <item>
      <title>Re: Fun Coding Challenges / Questions</title>
      <link>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3252167#M27827</link>
      <description>&lt;P&gt;Funny you start his thread today because I was thinking about irational numbers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-SPOILER&gt;I have a seven year old G-daughter that I have been sneaking in math lesson when she is not looking.&lt;/LI-SPOILER&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it even possible to contrive a test of irrationality in a computer environment where everything has to be entered as a rational number?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ben&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2016 20:32:28 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3252167#M27827</guid>
      <dc:creator>Ben</dc:creator>
      <dc:date>2016-02-11T20:32:28Z</dc:date>
    </item>
    <item>
      <title>Re: Fun Coding Challenges / Questions</title>
      <link>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3252202#M27828</link>
      <description>&lt;P&gt;Here is my attempt.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-SPOILER&gt;&lt;IMG src="https://ip1.i.lithium.com/67a6e9d591705e2a8a199fea3d1a7ab3aa5abc9d/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f31373833383669413134423837444142463237363937382f696d6167652d73697a652f6f726967696e616c3f763d6d70626c2d312670783d2d31" border="0" alt="Monkey.png" title="Monkey.png" /&gt;&lt;/LI-SPOILER&gt;</description>
      <pubDate>Thu, 11 Feb 2016 21:45:16 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3252202#M27828</guid>
      <dc:creator>BowenM</dc:creator>
      <dc:date>2016-02-11T21:45:16Z</dc:date>
    </item>
    <item>
      <title>Re: Fun Coding Challenges / Questions</title>
      <link>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3252458#M27829</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://ni.lithium.com/t5/user/viewprofilepage/user-id/9539"&gt;@Ben&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;Funny you start his thread today because I was thinking about irational numbers. [...]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ben&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Are irrational numbers the numbers engineers get from managers?&amp;nbsp; Budgets, deadlines...&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2016 13:36:12 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3252458#M27829</guid>
      <dc:creator>jcarmody</dc:creator>
      <dc:date>2016-02-12T13:36:12Z</dc:date>
    </item>
    <item>
      <title>Re: Fun Coding Challenges / Questions</title>
      <link>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3252750#M27830</link>
      <description>&lt;P&gt;I have a VI (it's actually two VIs, is that breaking some rules?) that computes the answer for 9 sailors in 10.8ms.&amp;nbsp; Answer for 8 sailors takes 4.5ms.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll post them on Monday.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img id="smileytongue" class="emoticon emoticon-smileytongue" src="https://ni.lithium.com/i/smilies/16x16_smiley-tongue.gif" alt="Smiley Tongue" title="Smiley Tongue" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2016 20:12:51 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3252750#M27830</guid>
      <dc:creator>Intaris</dc:creator>
      <dc:date>2016-02-12T20:12:51Z</dc:date>
    </item>
    <item>
      <title>Re: Fun Coding Challenges / Questions</title>
      <link>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3252849#M27831</link>
      <description>&lt;P&gt;Hmm, removing a recursive VI call and replacing it with a for loop gets my timing for the 8 sailor solution down to 0.4ms.....&amp;nbsp; Funnily enough the 9 sailor solution only takes 1.4ms.&amp;nbsp; Seems like the Recursive VI call overhead was pretty significant in the previous example.&amp;nbsp; I'll tidy up the code and post both versions next week.&amp;nbsp; I think I'll implement an I64 version to get to higher numbers.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2016 23:50:35 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3252849#M27831</guid>
      <dc:creator>Intaris</dc:creator>
      <dc:date>2016-02-12T23:50:35Z</dc:date>
    </item>
    <item>
      <title>Re: Fun Coding Challenges / Questions</title>
      <link>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3252862#M27832</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://ni.lithium.com/t5/user/viewprofilepage/user-id/102130"&gt;@Intaris&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;I have a VI (it's actually two VIs, is that breaking some rules?) that computes the answer for 9 sailors in 10.8ms.&amp;nbsp; Answer for 8 sailors takes 4.5ms.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Hmm, noticed some patterns and do 8 in under 2us. Have to work out the theory.... &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Feb 2016 00:34:57 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3252862#M27832</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2016-02-13T00:34:57Z</dc:date>
    </item>
    <item>
      <title>Re: Fun Coding Challenges / Questions</title>
      <link>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3252889#M27833</link>
      <description>&lt;P&gt;Starting with Bowen's and doing some experiementing, I got it down to well sub-microseconds up to N=15&lt;/P&gt;&lt;P&gt;(result for 15 Sailors is &lt;SPAN&gt;437893890380859361 coconuts. W&lt;/SPAN&gt;e cannot go higher than 15 because of U64 overflow).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also found a direct equation, which takes even faster (flickering between 0 and a few hundred ns using high resolution relative seconds).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Might be interesting to go to higher N using custom datatypes... &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Feb 2016 05:27:51 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3252889#M27833</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2016-02-13T05:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: Fun Coding Challenges / Questions</title>
      <link>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3252928#M27834</link>
      <description>Yeah. There is a direct computation but that takes all the fun out of it.</description>
      <pubDate>Sat, 13 Feb 2016 12:48:20 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3252928#M27834</guid>
      <dc:creator>Intaris</dc:creator>
      <dc:date>2016-02-13T12:48:20Z</dc:date>
    </item>
    <item>
      <title>Re: Fun Coding Challenges / Questions</title>
      <link>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3252929#M27835</link>
      <description>I also have a method to significantly speed up my method&lt;BR /&gt;Recognising repeating patterns is key.</description>
      <pubDate>Sat, 13 Feb 2016 12:49:46 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3252929#M27835</guid>
      <dc:creator>Intaris</dc:creator>
      <dc:date>2016-02-13T12:49:46Z</dc:date>
    </item>
    <item>
      <title>Re: Fun Coding Challenges / Questions</title>
      <link>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3252976#M27836</link>
      <description>&lt;P&gt;Since there is a real danger of overflow, &lt;A href="https://oeis.org/A002021/b002021.txt" target="_blank"&gt;here's a list of correct results&lt;/A&gt; as a function of N.&lt;/P&gt;</description>
      <pubDate>Sat, 13 Feb 2016 20:36:48 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3252976#M27836</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2016-02-13T20:36:48Z</dc:date>
    </item>
    <item>
      <title>Re: Fun Coding Challenges / Questions</title>
      <link>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3253225#M27837</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://ni.lithium.com/t5/user/viewprofilepage/user-id/7614"&gt;@altenbach&lt;/a&gt; wrote:&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;Hmm, noticed some patterns and do 8 in under 2us. Have to work out the theory.... &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regarding working out the theory.... I did it empirically.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I actually have my versions at home, so I can't post them quite yet but here's how I went about it.&amp;nbsp; I initially wrote a Reentrant VI&amp;nbsp; to recursively check step-by-step (one step for each sailor) if the answers at each stage were divisible by Sailors-1 (otherwise the reverse of "sailor takes his share" wouldn't work).&amp;nbsp; All arithmetic was done with integers only.&amp;nbsp; I stopped the recursion if the answer is non-integer or the total number of saolirs ahve been "processed".&amp;nbsp; Observing the pattern of "Recursion depth before failure" each iteration gives rise to a very clear pattern which allows some very obvious optimisations to be made (even without being totally sure on the maths of the whole thing).&amp;nbsp; One could adjust the step size in the search according to the last recursion depth and reduce the problem from an exponential time to a linear time problem with increasing number of sailors.&amp;nbsp; It's still a search but it comes &lt;EM&gt;relatively&lt;/EM&gt; close to the direct methods.&amp;nbsp; Doing it this way, each new step actually automatically shifts to the next recursion depth, making the number of iterations required for the job to be approximately equal to the number of sailors instead of being hugely non-linear (more than 1000 times faster for calculating 11 sailors for example).&amp;nbsp; It was interesting how quickly the solution finding could be optimised on purely empirical observation.&amp;nbsp; Once I studied the sources in the internet, it was clear that even this approach was relatively inefficient, even though it's several orders of magnitude better than simple brute force methods.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll post more details later when I get home.&amp;nbsp; It was an interesting puzzle for a friday afternoon.&amp;nbsp; The fun part was seeing how far I could get without resorting to sources in the internet.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2016 10:47:41 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3253225#M27837</guid>
      <dc:creator>Intaris</dc:creator>
      <dc:date>2016-02-15T10:47:41Z</dc:date>
    </item>
    <item>
      <title>Re: Fun Coding Challenges / Questions</title>
      <link>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3253419#M27838</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;Intaris wrote:. I did it empirically.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;Yup, same thing here. &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt; I started with Bowen's, but used a conditional inner FOR loop to break early, then graphed how many itertions it actually took. It was clear that only a few regularly spaced inputs were such candidates. By looking at the inputs, a few well recognized numbers appeared, so the offset and multipliers could be generated from first principles (different formula for odd vs even N). Then I also noticed that the number of while loop iterations to get there was also a linear function of the input, so it was possible to create code that immediately ended up at the correct value and I was able to eliminate the outer while loop. Well, sub-microseconds.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Whiile my calculation is actually quite different from the direct formula, it basically only takes one look and gets there. &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2016 16:22:17 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3253419#M27838</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2016-02-15T16:22:17Z</dc:date>
    </item>
    <item>
      <title>Re: Fun Coding Challenges / Questions</title>
      <link>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3253443#M27839</link>
      <description>&lt;P&gt;Here's my empirical attempt. It is a bit circuitous. The other case contains the direct formula for comparison.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://ni.lithium.com/ni/attachments/ni/BreakPoint/27839/2/Sailornuts.png" border="0" alt="" title="" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Both fail for N&amp;gt;15 due to limitations of U64, so it might be interesting to create a solution that can deal with higher digit counts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2016 16:58:17 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3253443#M27839</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2016-02-15T16:58:17Z</dc:date>
    </item>
    <item>
      <title>Re: Fun Coding Challenges / Questions</title>
      <link>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3253506#M27840</link>
      <description>&lt;P&gt;Just using altenbach's code as a test point for my math library....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://ip1.i.lithium.com/02a39262eb362c3ba60291ac7fe1d8d6e725af99/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f31373835303569433632464145353743323934443446422f696d6167652d73697a652f6f726967696e616c3f763d6d70626c2d312670783d2d31" border="0" alt="MonkeysAndCoconuts.png" title="MonkeysAndCoconuts.png" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I didn't count all of the 9's but it looks right to my eye. &amp;nbsp;For 1000 sailors there are just a bunch more 9's in the middle.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2016 18:42:06 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3253506#M27840</guid>
      <dc:creator>Darin.K</dc:creator>
      <dc:date>2016-02-15T18:42:06Z</dc:date>
    </item>
    <item>
      <title>Re: Fun Coding Challenges / Questions</title>
      <link>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3253528#M27841</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://ni.lithium.com/t5/user/viewprofilepage/user-id/134255"&gt;@Darin.K&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;Just using altenbach's code as a test point for my math library.....&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Cool! You should use the code in the FALSE case instead....(&lt;A href="https://oeis.org/A002021" target="_blank"&gt;algorithm&lt;/A&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(However, since the world harvest of coconuts is limited&amp;nbsp;(1.44kg/nut, 62 millions tonnes/year), we will run out of coconuts much faster than we run out of sailors (or monkeys) :D. Then there is also the limiting factor of transporting and hiding coconuts in a single night.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And yes, you even caught the duplicate effort of subtracting 1 from a number. (I assume the compiler will at least take it out of the FOR loop (loop invariant code elimination) but we still do it once too many. :D. It would be more hurful in your code...)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Oh, and wow, such a library would be great addition to LabVIEW!!! How complete is it?&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2016 21:40:27 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3253528#M27841</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2016-02-15T21:40:27Z</dc:date>
    </item>
    <item>
      <title>Re: Fun Coding Challenges / Questions</title>
      <link>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3253639#M27846</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://ni.lithium.com/t5/user/viewprofilepage/user-id/7614"&gt;@altenbach&lt;/a&gt; wrote:&lt;BR /&gt;&lt;BLOCKQUOTE&gt;Oh, and wow, such a library would be great addition to LabVIEW!!! How complete is it?&lt;/BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The integer part of the library is fairly complete, to the point I need to break up the class into separate libraries. &amp;nbsp;I have most of the basic operations covered, along with comparisons and bitwise operations. &amp;nbsp;A lot of number theory as well (prime testing GCD, modular exponentiation and the like). &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mine is written in pure G because I am funny that way, but if this were to be built in I would probably put the guts 'under the hood' and leverage&amp;nbsp;GMP. &amp;nbsp;I agree that arbitrary precision math as a first-class citizen would be awesome. &amp;nbsp;I like how ints in Python do their integery thing with no worries about overflow and such unless you deliberately bind them to a fixed representation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2016 00:11:59 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/BreakPoint/Fun-Coding-Challenges-Questions/m-p/3253639#M27846</guid>
      <dc:creator>Darin.K</dc:creator>
      <dc:date>2016-02-16T00:11:59Z</dc:date>
    </item>
  </channel>
</rss>

