<?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 6</title>
	<atom:link href="http://www.fsharp.it/2008/01/23/project-euler-in-f-problem-6/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.fsharp.it/2008/01/23/project-euler-in-f-problem-6/</link>
	<description>Functional programming on .Net</description>
	<lastBuildDate>Wed, 23 Mar 2011 17:29:06 +0100</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Project Euler - Problem 19 - Noticias externas</title>
		<link>http://www.fsharp.it/2008/01/23/project-euler-in-f-problem-6/comment-page-1/#comment-107</link>
		<dc:creator>Project Euler - Problem 19 - Noticias externas</dc:creator>
		<pubDate>Fri, 07 Mar 2008 05:38:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.fsharp.it/2008/01/23/project-euler-in-f-problem-6/#comment-107</guid>
		<description>[...] haven&#039;t been to Project Euler in a while, but since I&#039;m seeing other F# folks are getting into it, I figured I&#039;d help work to improve the average F# &#039;genus rating&#039; [...]</description>
		<content:encoded><![CDATA[<p>[...] haven&#39;t been to Project Euler in a while, but since I&#39;m seeing other F# folks are getting into it, I figured I&#39;d help work to improve the average F# &#39;genus rating&#39; [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michiel Borkent</title>
		<link>http://www.fsharp.it/2008/01/23/project-euler-in-f-problem-6/comment-page-1/#comment-94</link>
		<dc:creator>Michiel Borkent</dc:creator>
		<pubDate>Mon, 03 Mar 2008 14:21:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.fsharp.it/2008/01/23/project-euler-in-f-problem-6/#comment-94</guid>
		<description>Of course I meant the expression (x_1 + .. +  x_2)^2  - (x_1^2 + .. + x_100^2) , not (x_1^2 .. x_100^2) - (x_1 + .. +  x_2)^2</description>
		<content:encoded><![CDATA[<p>Of course I meant the expression (x_1 + .. +  x_2)^2  &#8211; (x_1^2 + .. + x_100^2) , not (x_1^2 .. x_100^2) &#8211; (x_1 + .. +  x_2)^2</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michiel Borkent</title>
		<link>http://www.fsharp.it/2008/01/23/project-euler-in-f-problem-6/comment-page-1/#comment-93</link>
		<dc:creator>Michiel Borkent</dc:creator>
		<pubDate>Mon, 03 Mar 2008 14:19:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.fsharp.it/2008/01/23/project-euler-in-f-problem-6/#comment-93</guid>
		<description>With some cleverness the expression (x_1^2 .. x_100^2) - (x_1 .. x_2)^2 can be simplified to the sum of x_i*x_j, where i ranges from [1 .. 100] and j &gt; i.

Example: (a + b)^2 - (a^2 + b^2)   = 2ab.
Exameple: (a + b + c)^2 - (a^2 + b^2 + c^2)  = 2(ab+ac+bc) 

The following uses this simplification:

#light
let rec diff2 l = 
    match l with
    &#124; [] -&gt; 0
    &#124; _ -&gt; 2 * List.sumByInt (fun x -&gt; List.hd l * x) (List.tl l) + diff2 (List.tl l) 
diff2 [1 .. 100]</description>
		<content:encoded><![CDATA[<p>With some cleverness the expression (x_1^2 .. x_100^2) &#8211; (x_1 .. x_2)^2 can be simplified to the sum of x_i*x_j, where i ranges from [1 .. 100] and j &gt; i.</p>
<p>Example: (a + b)^2 &#8211; (a^2 + b^2)   = 2ab.<br />
Exameple: (a + b + c)^2 &#8211; (a^2 + b^2 + c^2)  = 2(ab+ac+bc) </p>
<p>The following uses this simplification:</p>
<p>#light<br />
let rec diff2 l =<br />
    match l with<br />
    | [] -&gt; 0<br />
    | _ -&gt; 2 * List.sumByInt (fun x -&gt; List.hd l * x) (List.tl l) + diff2 (List.tl l)<br />
diff2 [1 .. 100]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Continuing Adventures in F# - Matthew Podwysocki's Blog</title>
		<link>http://www.fsharp.it/2008/01/23/project-euler-in-f-problem-6/comment-page-1/#comment-11</link>
		<dc:creator>Continuing Adventures in F# - Matthew Podwysocki's Blog</dc:creator>
		<pubDate>Tue, 29 Jan 2008 16:42:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.fsharp.it/2008/01/23/project-euler-in-f-problem-6/#comment-11</guid>
		<description>[...] Euler problems in F# Problem #1 in F# Problem #1 (alternate) Problem #6 Problem [...]</description>
		<content:encoded><![CDATA[<p>[...] Euler problems in F# Problem #1 in F# Problem #1 (alternate) Problem #6 Problem [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

