<?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: Largest Palindromic Number In Python</title>
	<atom:link href="http://pthree.org/2007/09/15/largest-palindromic-number-in-python/feed/" rel="self" type="application/rss+xml" />
	<link>http://pthree.org/2007/09/15/largest-palindromic-number-in-python/</link>
	<description>Linux.  GNU.  Freedom.</description>
	<pubDate>Fri, 21 Nov 2008 03:53:18 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7-beta3-9791</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: leed</title>
		<link>http://pthree.org/2007/09/15/largest-palindromic-number-in-python/#comment-108855</link>
		<dc:creator>leed</dc:creator>
		<pubDate>Sun, 26 Oct 2008 09:29:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.pthree.org/2007/09/15/largest-palindromic-number-in-python/#comment-108855</guid>
		<description>I think follow code is the fastest I have tried.
maxnum = 0
for i in range(990, 99, -11):
	for j in range(999, i, -1):
		num = i * j
		if num &#60;= maxnum:
			break
		else:
			strnum = str(num)
			if strnum == strnum[::-1]:
				maxnum = num
				break
print maxnum</description>
		<content:encoded><![CDATA[<p>I think follow code is the fastest I have tried.<br />
maxnum = 0<br />
for i in range(990, 99, -11):<br />
	for j in range(999, i, -1):<br />
		num = i * j<br />
		if num &lt;= maxnum:<br />
			break<br />
		else:<br />
			strnum = str(num)<br />
			if strnum == strnum[::-1]:<br />
				maxnum = num<br />
				break<br />
print maxnum</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: i dont know</title>
		<link>http://pthree.org/2007/09/15/largest-palindromic-number-in-python/#comment-107970</link>
		<dc:creator>i dont know</dc:creator>
		<pubDate>Thu, 11 Sep 2008 15:50:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.pthree.org/2007/09/15/largest-palindromic-number-in-python/#comment-107970</guid>
		<description>what's are biggest 2 3-dgits palindrome?</description>
		<content:encoded><![CDATA[<p>what&#8217;s are biggest 2 3-dgits palindrome?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Athropos</title>
		<link>http://pthree.org/2007/09/15/largest-palindromic-number-in-python/#comment-69317</link>
		<dc:creator>Athropos</dc:creator>
		<pubDate>Sun, 16 Sep 2007 12:52:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.pthree.org/2007/09/15/largest-palindromic-number-in-python/#comment-69317</guid>
		<description>You should use the timeit module when you need to time something. It's better than using the time command because you then don't measure the startup time of the Python interpreter which can be a big part of the total time.

&lt;code&gt;
import timeit

...

t1 = timeit.Timer('palindrome()', 'from __main__ import palindrome')
print t1.timeit(20)
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>You should use the timeit module when you need to time something. It&#8217;s better than using the time command because you then don&#8217;t measure the startup time of the Python interpreter which can be a big part of the total time.</p>
<p><pre class="php">import timeit
<span style="color: #ff0000">
...
</span>
t1 = timeit.Timer<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'palindrome()'</span>, <span style="color: #ff0000;">'from __main__ import palindrome'</span><span style="color: #66cc66;">&#41;</span>
<a href="http://www.php.net/print"><span style="color: #000066;">print</span></a> t1.timeit<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">20</span><span style="color: #66cc66;">&#41;</span></pre></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: phoenyx</title>
		<link>http://pthree.org/2007/09/15/largest-palindromic-number-in-python/#comment-69305</link>
		<dc:creator>phoenyx</dc:creator>
		<pubDate>Sun, 16 Sep 2007 09:13:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.pthree.org/2007/09/15/largest-palindromic-number-in-python/#comment-69305</guid>
		<description>FYI, it's considered bad form to post answers to problems outside of the forum.</description>
		<content:encoded><![CDATA[<p>FYI, it&#8217;s considered bad form to post answers to problems outside of the forum.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Duccio</title>
		<link>http://pthree.org/2007/09/15/largest-palindromic-number-in-python/#comment-69298</link>
		<dc:creator>Duccio</dc:creator>
		<pubDate>Sun, 16 Sep 2007 07:38:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.pthree.org/2007/09/15/largest-palindromic-number-in-python/#comment-69298</guid>
		<description>Good post...only a doubt.
When you reach the column of the table of multiple of 11 (990,979,etc.) i think you must multiplicate this number for all the numbers smaller than this, and not only for multiple of 11 smaller than this. For example I don't see 990*989,990*988,etc. that are multiple of 11 too. Don't you think?</description>
		<content:encoded><![CDATA[<p>Good post&#8230;only a doubt.<br />
When you reach the column of the table of multiple of 11 (990,979,etc.) i think you must multiplicate this number for all the numbers smaller than this, and not only for multiple of 11 smaller than this. For example I don&#8217;t see 990*989,990*988,etc. that are multiple of 11 too. Don&#8217;t you think?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aaron</title>
		<link>http://pthree.org/2007/09/15/largest-palindromic-number-in-python/#comment-69283</link>
		<dc:creator>Aaron</dc:creator>
		<pubDate>Sun, 16 Sep 2007 02:56:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.pthree.org/2007/09/15/largest-palindromic-number-in-python/#comment-69283</guid>
		<description>@Peter-  Ahh, yes.  Good call.  I've updated my post to reflect the change.

@Seth-  No problem.  Let me know how far you get. :)</description>
		<content:encoded><![CDATA[<p>@Peter-  Ahh, yes.  Good call.  I&#8217;ve updated my post to reflect the change.</p>
<p>@Seth-  No problem.  Let me know how far you get. <img src='http://pthree.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Seth</title>
		<link>http://pthree.org/2007/09/15/largest-palindromic-number-in-python/#comment-69279</link>
		<dc:creator>Seth</dc:creator>
		<pubDate>Sun, 16 Sep 2007 02:23:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.pthree.org/2007/09/15/largest-palindromic-number-in-python/#comment-69279</guid>
		<description>Never seen Project Euler before. Thanks for posting about it. :-)</description>
		<content:encoded><![CDATA[<p>Never seen Project Euler before. Thanks for posting about it. <img src='http://pthree.org/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter</title>
		<link>http://pthree.org/2007/09/15/largest-palindromic-number-in-python/#comment-69277</link>
		<dc:creator>Peter</dc:creator>
		<pubDate>Sun, 16 Sep 2007 02:06:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.pthree.org/2007/09/15/largest-palindromic-number-in-python/#comment-69277</guid>
		<description>A few thoughts:

- 5 digit palindromes are not necessarily divisible by 11, though that doesn't matter too much here as we're looking for 6 digit ones
abcba = 10001a + 1010b + 100c

- quick one liner (takes a few seconds here)
&lt;code&gt;max([x*y for x in range(100,1000) for y in range(100,1000) if str(x*y)==str(x*y)[::-1]])
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>A few thoughts:</p>
<p>- 5 digit palindromes are not necessarily divisible by 11, though that doesn&#8217;t matter too much here as we&#8217;re looking for 6 digit ones<br />
abcba = 10001a + 1010b + 100c</p>
<p>- quick one liner (takes a few seconds here)<br />
<pre class="php"><a href="http://www.php.net/max"><span style="color: #000066;">max</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#91;</span>x*y <span style="color: #b1b100;">for</span> x in <a href="http://www.php.net/range"><span style="color: #000066;">range</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">100</span>,<span style="color: #cc66cc;">1000</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">for</span> y in <a href="http://www.php.net/range"><span style="color: #000066;">range</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">100</span>,<span style="color: #cc66cc;">1000</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">if</span> str<span style="color: #66cc66;">&#40;</span>x*y<span style="color: #66cc66;">&#41;</span>==str<span style="color: #66cc66;">&#40;</span>x*y<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#91;</span>::<span style="color: #cc66cc;">-1</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span></pre></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Justin</title>
		<link>http://pthree.org/2007/09/15/largest-palindromic-number-in-python/#comment-69256</link>
		<dc:creator>Justin</dc:creator>
		<pubDate>Sat, 15 Sep 2007 23:19:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.pthree.org/2007/09/15/largest-palindromic-number-in-python/#comment-69256</guid>
		<description>&lt;code&gt;
def is_palin(num):
    s = str(num)
    return s == s[::-1]
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p><pre class="php">def is_palin<span style="color: #66cc66;">&#40;</span>num<span style="color: #66cc66;">&#41;</span>:
    s = str<span style="color: #66cc66;">&#40;</span>num<span style="color: #66cc66;">&#41;</span>
    <span style="color: #b1b100;">return</span> s == s<span style="color: #66cc66;">&#91;</span>::<span style="color: #cc66cc;">-1</span><span style="color: #66cc66;">&#93;</span></pre></p>
]]></content:encoded>
	</item>
</channel>
</rss>
