<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Project Euler in F# &#8211; Problem 53 &#8211; Dynamic Programming</title>
	<atom:link href="http://www.navision-blog.de/2008/12/08/project-euler-in-fsharp-problem-53/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.navision-blog.de/2008/12/08/project-euler-in-fsharp-problem-53/</link>
	<description>This Blog is about Microsoft Dynamics NAV (f.k.a Navision incl. C/SIDE and C/AL), C#, F# and .NET in general.</description>
	<lastBuildDate>Tue, 31 Jan 2012 17:13:06 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Steffen Forkmann</title>
		<link>http://www.navision-blog.de/2008/12/08/project-euler-in-fsharp-problem-53/comment-page-1/#comment-82406</link>
		<dc:creator>Steffen Forkmann</dc:creator>
		<pubDate>Tue, 09 Dec 2008 17:18:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.navision-blog.de/2008/12/08/project-euler-in-fsharp-problem-53/#comment-82406</guid>
		<description>@GrahameTheHornist:

Thank you. I tried your solution on my computer and with 16ms it is the fastest so far. Well done.</description>
		<content:encoded><![CDATA[<p>@GrahameTheHornist:</p>
<p>Thank you. I tried your solution on my computer and with 16ms it is the fastest so far. Well done.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: GrahameTheHornist</title>
		<link>http://www.navision-blog.de/2008/12/08/project-euler-in-fsharp-problem-53/comment-page-1/#comment-82403</link>
		<dc:creator>GrahameTheHornist</dc:creator>
		<pubDate>Tue, 09 Dec 2008 16:56:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.navision-blog.de/2008/12/08/project-euler-in-fsharp-problem-53/#comment-82403</guid>
		<description>&lt;pre&gt;
let euler53() =
    let binomial (* n k *) =
        let binomials = Array2.create 101 101 1I
        fun n k -&gt; 
            let b = binomials.[n-1, k] + binomials.[n-1, k-1]
            binomials.[n, k] &lt;- b
            binomials.[n, n-k] &lt;- b
            b
        
    let rec nLoop n acc = if n &gt; 100 then acc 
                                     else kLoop n 1 acc
    and kLoop n k acc =
        if k &gt; n/2 
            then nLoop (n+1) acc
        elif binomial n k &gt; 1000000I 
            then nLoop (n+1) (acc + n-1 - 2*(k-1))
        else kLoop n (k+1) acc                  
                      
    nLoop 1 0 
&lt;/pre&gt;
</description>
		<content:encoded><![CDATA[<pre>
let euler53() =
    let binomial (* n k *) =
        let binomials = Array2.create 101 101 1I
        fun n k ->
            let b = binomials.[n-1, k] + binomials.[n-1, k-1]
            binomials.[n, k] < - b
            binomials.[n, n-k] <- b
            b

    let rec nLoop n acc = if n > 100 then acc
                                     else kLoop n 1 acc
    and kLoop n k acc =
        if k > n/2
            then nLoop (n+1) acc
        elif binomial n k > 1000000I
            then nLoop (n+1) (acc + n-1 - 2*(k-1))
        else kLoop n (k+1) acc                  

    nLoop 1 0
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steffen Forkmann</title>
		<link>http://www.navision-blog.de/2008/12/08/project-euler-in-fsharp-problem-53/comment-page-1/#comment-82364</link>
		<dc:creator>Steffen Forkmann</dc:creator>
		<pubDate>Tue, 09 Dec 2008 08:10:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.navision-blog.de/2008/12/08/project-euler-in-fsharp-problem-53/#comment-82364</guid>
		<description>Thanks Grahame. But I think something went wrong. Where is the definition of the nLoop?

(i added a &lt;pre&gt; for code formatting)</description>
		<content:encoded><![CDATA[<p>Thanks Grahame. But I think something went wrong. Where is the definition of the nLoop?</p>
<p>(i added a &lt;pre&gt; for code formatting)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Claudio</title>
		<link>http://www.navision-blog.de/2008/12/08/project-euler-in-fsharp-problem-53/comment-page-1/#comment-82363</link>
		<dc:creator>Claudio</dc:creator>
		<pubDate>Tue, 09 Dec 2008 08:09:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.navision-blog.de/2008/12/08/project-euler-in-fsharp-problem-53/#comment-82363</guid>
		<description>Great post!
Dynamic programming is exactly what I had in mind when I asked for optimization strategies.</description>
		<content:encoded><![CDATA[<p>Great post!<br />
Dynamic programming is exactly what I had in mind when I asked for optimization strategies.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: GrahameTheHornist</title>
		<link>http://www.navision-blog.de/2008/12/08/project-euler-in-fsharp-problem-53/comment-page-1/#comment-82307</link>
		<dc:creator>GrahameTheHornist</dc:creator>
		<pubDate>Mon, 08 Dec 2008 23:48:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.navision-blog.de/2008/12/08/project-euler-in-fsharp-problem-53/#comment-82307</guid>
		<description>Shoot, no formatting! Sorry about that.</description>
		<content:encoded><![CDATA[<p>Shoot, no formatting! Sorry about that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: GrahameTheHornist</title>
		<link>http://www.navision-blog.de/2008/12/08/project-euler-in-fsharp-problem-53/comment-page-1/#comment-82306</link>
		<dc:creator>GrahameTheHornist</dc:creator>
		<pubDate>Mon, 08 Dec 2008 23:47:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.navision-blog.de/2008/12/08/project-euler-in-fsharp-problem-53/#comment-82306</guid>
		<description>Great efficiency improvements! I wrote the following version of your algorithm, using recursion instead of an imperative style and also using (k-1) instead of c. My version seems to be a little more efficient.
&lt;pre&gt;
let euler53() =
    let binomial (* n k *) =
        let binomials = Array2.create 101 101 1I
        fun n k -&gt; 
            let b = binomials.[n-1, k] + binomials.[n-1, k-1]
            binomials.[n, k] &lt;- b
            binomials.[n, n-k]  100 then acc 
                                     else kLoop n 1 acc
    and kLoop n k acc =
        if k &gt; n/2 
            then nLoop (n+1) acc
        elif binomial n k &gt; 1000000I 
            then nLoop (n+1) (acc + n-1 - 2*(k-1))
        else kLoop n (k+1) acc                  
                      
    nLoop 1 0&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Great efficiency improvements! I wrote the following version of your algorithm, using recursion instead of an imperative style and also using (k-1) instead of c. My version seems to be a little more efficient.</p>
<pre>
let euler53() =
    let binomial (* n k *) =
        let binomials = Array2.create 101 101 1I
        fun n k -&gt;
            let b = binomials.[n-1, k] + binomials.[n-1, k-1]
            binomials.[n, k] &lt;- b
            binomials.[n, n-k]  100 then acc
                                     else kLoop n 1 acc
    and kLoop n k acc =
        if k &gt; n/2
            then nLoop (n+1) acc
        elif binomial n k &gt; 1000000I
            then nLoop (n+1) (acc + n-1 - 2*(k-1))
        else kLoop n (k+1) acc                  

    nLoop 1 0</pre>
]]></content:encoded>
	</item>
</channel>
</rss>

