﻿<?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 Problem Two</title>
	<atom:link href="http://www.peteonsoftware.com/index.php/2008/12/07/project-euler-problem-two/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.peteonsoftware.com/index.php/2008/12/07/project-euler-problem-two/</link>
	<description></description>
	<lastBuildDate>Fri, 03 Sep 2010 10:18:06 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Ben Maddox</title>
		<link>http://www.peteonsoftware.com/index.php/2008/12/07/project-euler-problem-two/comment-page-1/#comment-930</link>
		<dc:creator>Ben Maddox</dc:creator>
		<pubDate>Sun, 07 Dec 2008 19:50:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.peteonsoftware.com/?p=70#comment-930</guid>
		<description>I think this worked, but I haven&#039;t tested it in a while.  I didn&#039;t try anything fancy like caching the values. :)

        public static int SolveProblem2()
        {
            int previousValue = 1;
            int currentValue = 1;
            int fibonacciSum = 0;
            
            while (currentValue &lt; 4000000)
            {
                int newValue = previousValue + currentValue;
                previousValue = currentValue;
                currentValue = newValue;

                if (newValue % 2 == 0)
                {
                    fibonacciSum += newValue;
                }
            }
            return fibonacciSum;
        }</description>
		<content:encoded><![CDATA[<p>I think this worked, but I haven&#8217;t tested it in a while.  I didn&#8217;t try anything fancy like caching the values. <img src='http://www.peteonsoftware.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>        public static int SolveProblem2()<br />
        {<br />
            int previousValue = 1;<br />
            int currentValue = 1;<br />
            int fibonacciSum = 0;</p>
<p>            while (currentValue &lt; 4000000)<br />
            {<br />
                int newValue = previousValue + currentValue;<br />
                previousValue = currentValue;<br />
                currentValue = newValue;</p>
<p>                if (newValue % 2 == 0)<br />
                {<br />
                    fibonacciSum += newValue;<br />
                }<br />
            }<br />
            return fibonacciSum;<br />
        }</p>
]]></content:encoded>
	</item>
</channel>
</rss>
