<?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 39</title>
	<atom:link href="http://www.thattommyhall.com/2008/04/12/project-euler-39/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thattommyhall.com/2008/04/12/project-euler-39/</link>
	<description>A Random Walk Through Idea Space</description>
	<lastBuildDate>Fri, 20 Aug 2010 14:52:21 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: tom</title>
		<link>http://www.thattommyhall.com/2008/04/12/project-euler-39/comment-page-1/#comment-706</link>
		<dc:creator>tom</dc:creator>
		<pubDate>Mon, 14 Apr 2008 13:32:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.thattommyhall.com/2008/04/12/project-euler-39/#comment-706</guid>
		<description>http://paste.bradleygill.com/index.php?paste_id=238</description>
		<content:encoded><![CDATA[<p><a href="http://paste.bradleygill.com/index.php?paste_id=238" rel="nofollow">http://paste.bradleygill.com/index.php?paste_id=238</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ejs</title>
		<link>http://www.thattommyhall.com/2008/04/12/project-euler-39/comment-page-1/#comment-704</link>
		<dc:creator>ejs</dc:creator>
		<pubDate>Mon, 14 Apr 2008 11:18:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.thattommyhall.com/2008/04/12/project-euler-39/#comment-704</guid>
		<description>While I don&#039;t have the code I used I remember solving it far faster using brute force. After 10 min playing this is what I think I had (hoping the indentation works):

import math
from eulerhelpers import timed

@timed
def solve39(cap=1000):
    result = [0] * (cap+1)
    for b in xrange(1, cap/2):
        for c in xrange(1, min(b, cap/2-b)+1):
            a = math.sqrt(b**2 + c**2)
            if a+b+c &gt; cap:
                break
            if not a%1:
                result[int(a)+b+c] += 1
        if not b%(cap/20):
            print b,
            yield
    print max((i, e) for e, i in enumerate(result))

On my computer, without psyco, it completes in just over 0.1 seconds or about 7 times longer than your more mathematical code. I stopped there thinking it was enough.</description>
		<content:encoded><![CDATA[<p>While I don&#8217;t have the code I used I remember solving it far faster using brute force. After 10 min playing this is what I think I had (hoping the indentation works):</p>
<p>import math<br />
from eulerhelpers import timed</p>
<p>@timed<br />
def solve39(cap=1000):<br />
    result = [0] * (cap+1)<br />
    for b in xrange(1, cap/2):<br />
        for c in xrange(1, min(b, cap/2-b)+1):<br />
            a = math.sqrt(b**2 + c**2)<br />
            if a+b+c &gt; cap:<br />
                break<br />
            if not a%1:<br />
                result[int(a)+b+c] += 1<br />
        if not b%(cap/20):<br />
            print b,<br />
            yield<br />
    print max((i, e) for e, i in enumerate(result))</p>
<p>On my computer, without psyco, it completes in just over 0.1 seconds or about 7 times longer than your more mathematical code. I stopped there thinking it was enough.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
