<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>To Hell in a Handbasket</title>
	<atom:link href="http://ericsilva.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://ericsilva.org</link>
	<description>General Views, Opinions, and Observations in the World Around Me by Eric Silva</description>
	<lastBuildDate>Wed, 28 Jul 2010 18:36:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Really Slick OpenGL Screen Savers</title>
		<link>http://ericsilva.org/2010/07/15/really-slick-opengl-screen-savers/</link>
		<comments>http://ericsilva.org/2010/07/15/really-slick-opengl-screen-savers/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 20:03:50 +0000</pubDate>
		<dc:creator>Eric Silva</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[opengl]]></category>
		<category><![CDATA[screen savers]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://ericsilva.org/2010/07/15/really-slick-opengl-screen-savers/</guid>
		<description><![CDATA[Tired of the boring screen savers that come with Windows and haven’t changed since Windows 3.1?&#160; Take a look at Really Slick Screensavers for some cool OpenGL savers available for Windows, Linux, Solaris, or Mac OS X.]]></description>
			<content:encoded><![CDATA[<p>Tired of the boring screen savers that come with Windows and haven’t changed since Windows 3.1?&#160; Take a look at <a href="http://www.reallyslick.com/" target="_blank">Really Slick Screensavers</a> for some cool OpenGL savers available for Windows, Linux, Solaris, or Mac OS X.</p>
]]></content:encoded>
			<wfw:commentRss>http://ericsilva.org/2010/07/15/really-slick-opengl-screen-savers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Greenshot &#8211; free screenshot tool</title>
		<link>http://ericsilva.org/2010/07/13/greenshot-free-screenshot-tool/</link>
		<comments>http://ericsilva.org/2010/07/13/greenshot-free-screenshot-tool/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 17:30:32 +0000</pubDate>
		<dc:creator>Eric Silva</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[InterWebNet]]></category>
		<category><![CDATA[Greenshot]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[screen capture]]></category>
		<category><![CDATA[SnagIt]]></category>

		<guid isPermaLink="false">http://ericsilva.org/2010/07/13/greenshot-free-screenshot-tool/</guid>
		<description><![CDATA[After using SnagIt for several years with my old company, I was in need of an open source replacement.&#160; After using everyone’s favorite research assistant, I found Greenshot.&#160; It doesn’t have all the bells and whistles that SnagIt has, but it has the basics which is what you use 80% of the time anyway. So [...]]]></description>
			<content:encoded><![CDATA[<p>After using <a href="http://www.techsmith.com/screen-capture.asp" target="_blank">SnagIt</a> for several years with my old company, I was in need of an open source replacement.&#160; After using everyone’s <a href="http://google.com" target="_blank">favorite research assistant</a>, I found <a href="http://getgreenshot.org/" target="_blank">Greenshot</a>.&#160; It doesn’t have all the bells and whistles that SnagIt has, but it has the basics which is what you use 80% of the time anyway.</p>
<p>So far, so good.&#160; If you are need of a good screenshot/capture tool, and don’t feel like forking over $50 for a SnagIt license, check out <a href="http://getgreenshot.org/" target="_blank">Greenshot</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://ericsilva.org/2010/07/13/greenshot-free-screenshot-tool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What I Learned Today While Reading Wikipedia</title>
		<link>http://ericsilva.org/2010/03/31/what-i-learned-today-while-reading-wikipedia/</link>
		<comments>http://ericsilva.org/2010/03/31/what-i-learned-today-while-reading-wikipedia/#comments</comments>
		<pubDate>Thu, 01 Apr 2010 02:33:40 +0000</pubDate>
		<dc:creator>Eric Silva</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Observations]]></category>
		<category><![CDATA[WILTWRW]]></category>

		<guid isPermaLink="false">http://ericsilva.org/2010/03/31/what-i-learned-today-while-reading-wikipedia/</guid>
		<description><![CDATA[I learned that Fryderyk Chopin, the composer, had his heart removed before burial because he had a fear of being buried alive. I also learned that Thousand Island dressing did not originate in the Thousand Islands area of the St. Lawrence river. It originated in New Orleans before 1900.]]></description>
			<content:encoded><![CDATA[<p>I learned that Fryderyk Chopin, the composer, had his heart removed before burial because he had a fear of being buried alive.</p>
<p>I also learned that Thousand Island dressing did not originate in the Thousand Islands area of the St. Lawrence river.  It originated in New Orleans before 1900.</p>
]]></content:encoded>
			<wfw:commentRss>http://ericsilva.org/2010/03/31/what-i-learned-today-while-reading-wikipedia/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple Calendar Control for Web Application</title>
		<link>http://ericsilva.org/2010/03/19/simple-calendar-control-for-web-application/</link>
		<comments>http://ericsilva.org/2010/03/19/simple-calendar-control-for-web-application/#comments</comments>
		<pubDate>Fri, 19 Mar 2010 19:07:08 +0000</pubDate>
		<dc:creator>Eric Silva</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[InterWebNet]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Calendar]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[LinkedIn]]></category>

		<guid isPermaLink="false">http://ericsilva.org/?p=379</guid>
		<description><![CDATA[I originally did this back in 2007, but did not want to lose the content, so I decided to put it up here. I found a robust and relatively simple calendar control to use for web UIs. It can use a pop-up window or a floating &#60;div&#62; tag. I prefer the latter as it makes [...]]]></description>
			<content:encoded><![CDATA[<p>I originally did this back in 2007, but did not want to lose the content, so I decided to put it up here.</p>
<p>I found a robust and relatively simple calendar control to use for web UIs.  It can use a pop-up window or a floating <code>&lt;div&gt;</code> tag.  I prefer the latter as it makes the page look good and avoids a pop-up.</p>
<p>To use the control simply put the <a href='http://ericsilva.org/wp-content/uploads/2010/03/CalendarPopup.js'>CalendarPopup.js</a> file in your application&#8217;s &#8220;scripts&#8221; directory and be sure to include it in your JSP. <em>(I used this in a Java app, but you can apply it to any language.)</em></p>
<p>Download the <a href="http://ericsilva.org/wp-content/uploads/2010/03/cal.gif"><img src="http://ericsilva.org/wp-content/uploads/2010/03/cal.gif" alt="" title="cal.gif" width="16" height="16" /></a> and put it in your images directory.</p>
<p>Add the following lines to your application&#8217;s JavaScript file (or include on the same page if you don&#8217;t have an external JS file):</p>
<pre class="brush: jscript;">
// Set up Calendar control
var calObj = new CalendarPopup(&quot;calDiv&quot;);
calObj.showNavigationDropdowns();
calObj.setMonthNames('JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP','OCT','NOV','DEC');

// Handle the Calendar control
function doCalendar(destObjId, srcObj) {
    calObj.select(document.getElementById(destObjId),srcObj.id,'dd-MMM-yyyy');
}
</pre>
<p>Then add the following lines to your JSP:</p>
<pre class="brush: xml;">
&lt;script&gt;document.write(getCalendarStyles());&lt;/script&gt;
</pre>
<p>In your JSP, add the following HTML code where you want your date field and calendar control:</p>
<pre class="brush: xml;">
&lt;input id=&quot;dateField&quot; style=&quot;width: auto;&quot; maxlength=&quot;11&quot; name=&quot;actualDate&quot; size=&quot;25&quot; type=&quot;text&quot; /&gt;
&lt;img id=&quot;imgCal&quot; onclick=&quot;doCalendar('dateField',this);return false;&quot; src=&quot;cal.gif&quot; border=&quot;0&quot; alt=&quot;&quot; /&gt;
</pre>
<p>That&#8217;s it!</p>
<p>In order to workaround IE 6&#8242;s inability to recognize the z-index attribute on the  tag, I made some modifications to the original JavaScript code. You will need to pass the an ID value to be used for the hidden  that will overlay the  box. </p>
<pre class="brush: jscript;">
var calObj = new CalendarPopup(&quot;calDiv&quot;, &quot;calFrame&quot;);
</pre>
<p>You will also need to specify the following styles in a stylesheet.  The ID values in the stylesheet must match the names of your DIV and IFRAME IDs on your page. </p>
<pre class="brush: css;">
div#calDiv {
    position:absolute; visibility:hidden;
    background-color:white;
    layer-background-color:white;
}
.select-free {
    position:absolute; z-index:10;/*any value*/
    overflow:hidden;/*must have*/
    width:152px;/*do not change value for calendar control */;
}
.select-free iframe#calFrame {
    display:none;/*sorry for IE5*/
    display:block;/*sorry for IE5*/
    position:absolute;/*must have*/
    top:0;/*must have*/
    left:0;/*must have*/
    z-index:-1;/*must have*/
    filter:mask();/*must have*/
    width:3000px;/*must have for any big value*/
    height:3000px/*must have for any big value*/;
}
</pre>
<p>Your JSP now needs the following line: </p>
<pre class="brush: xml;">
&lt;div id=&quot;calDiv&quot; class=&quot;select-free&quot;&gt;&lt;/div&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://ericsilva.org/2010/03/19/simple-calendar-control-for-web-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Funniest Thing on the Twitter All Day</title>
		<link>http://ericsilva.org/2010/01/13/funniest-thing-on-the-twitter-all-day/</link>
		<comments>http://ericsilva.org/2010/01/13/funniest-thing-on-the-twitter-all-day/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 21:41:33 +0000</pubDate>
		<dc:creator>Eric Silva</dc:creator>
				<category><![CDATA[Humor]]></category>
		<category><![CDATA[InterWebNet]]></category>
		<category><![CDATA[Penny Arcade]]></category>
		<category><![CDATA[PVP]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://ericsilva.org/2010/01/13/funniest-thing-on-the-twitter-all-day/</guid>
		<description><![CDATA[A conversation between @cwgabriel from Penny Arcade and @pvponline from PVP. Brought a tear to my eye after @wilw got involved.]]></description>
			<content:encoded><![CDATA[<p>A conversation between <a href="http://twitter.com/cwgabriel" target="_blank">@cwgabriel</a> from <a href="http://www.penny-arcade.com" target="_blank">Penny Arcade</a> and <a href="http://twitter.com/pvponline" target="_blank">@pvponline</a> from <a href="http://pvponline.com" target="_blank">PVP</a>.</p>
<p>Brought a tear to my eye after <a href="http://twitter.com/wilw" target="_blank">@wilw</a> got involved.</p>
<p><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="gabriel_pvp_tweets" border="0" alt="gabriel_pvp_tweets" src="http://ericsilva.org/wp-content/uploads/2010/01/gabriel_pvp_tweets_2.png" width="265" height="1007" /></p>
]]></content:encoded>
			<wfw:commentRss>http://ericsilva.org/2010/01/13/funniest-thing-on-the-twitter-all-day/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>New Cub Scout Belt Loops and Pins</title>
		<link>http://ericsilva.org/2010/01/13/new-cub-scout-belt-loops-and-pins/</link>
		<comments>http://ericsilva.org/2010/01/13/new-cub-scout-belt-loops-and-pins/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 15:09:25 +0000</pubDate>
		<dc:creator>Eric Silva</dc:creator>
				<category><![CDATA[Cub Scouts]]></category>
		<category><![CDATA[academics]]></category>
		<category><![CDATA[belt loops]]></category>
		<category><![CDATA[recognition]]></category>
		<category><![CDATA[Scouting]]></category>
		<category><![CDATA[Sports]]></category>

		<guid isPermaLink="false">http://ericsilva.org/2010/01/13/new-cub-scout-belt-loops-and-pins/</guid>
		<description><![CDATA[The Boy Scout Trail has posted the requirements for the twelve new Cub Scout Belt Loops and Sports/Academic Pins on their website. The new Sports loops and pins are: Hiking Skateboarding Kickball Horseback Riding The new Academic loops and pins are: Video Games Reading and Writing Photography Pet Care Nutrition Good Manners Family Travel Disabilities [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://www.boyscouttrail.com" target="_blank">Boy Scout Trail</a> has posted the requirements for the twelve new Cub Scout Belt Loops and Sports/Academic Pins on their website.</p>
<p>The new Sports loops and pins are:</p>
<ul>
<li><a href="http://www.boyscouttrail.com/content/content/cub_scouts_hiking_sports_pin_and_belt_loop-2036.asp" target="_blank">Hiking</a></li>
<li><a href="http://www.boyscouttrail.com/content/content/cub_scouts_skateboarding_sports_pin_and_belt_loop-2027.asp" target="_blank">Skateboarding</a></li>
<li><a href="http://www.boyscouttrail.com/content/content/cub_scouts_kickball_sports_pin_and_belt_loop-2026.asp" target="_blank">Kickball</a></li>
<li><a href="http://www.boyscouttrail.com/content/content/cub_scouts_horseback_riding_sports_pin_and_belt_loop-2025.asp" target="_blank">Horseback Riding</a></li>
</ul>
<p>The new Academic loops and pins are:</p>
<ul>
<li><a href="http://www.boyscouttrail.com/content/content/cub_scouts_video_games_academics_pin_and_belt_loop-2035.asp" target="_blank">Video Games</a></li>
<li><a href="http://www.boyscouttrail.com/content/content/cub_scouts_reading_and_writing_academics_pin_and_belt_loop-2034.asp" target="_blank">Reading and Writing</a></li>
<li><a href="http://www.boyscouttrail.com/content/content/cub_scouts_photography_academics_pin_and_belt_loop-2033.asp" target="_blank">Photography</a></li>
<li><a href="http://www.boyscouttrail.com/content/content/cub_scouts_pet_care_academics_pin_and_belt_loop-2032.asp" target="_blank">Pet Care</a></li>
<li><a href="http://www.boyscouttrail.com/content/content/cub_scouts_nutrition_academics_pin_and_belt_loop-2031.asp" target="_blank">Nutrition</a></li>
<li><a href="http://www.boyscouttrail.com/content/content/cub_scouts_good_manners_academic_pin_and_belt_loop-2030.asp" target="_blank">Good Manners</a></li>
<li><a href="http://www.boyscouttrail.com/content/content/cub_scouts_family_travel_academics_pin_and_belt_loop-2029.asp" target="_blank">Family Travel</a></li>
<li><a href="http://www.boyscouttrail.com/content/content/cub_scouts_disabilities_awareness_academics_pin_and_belt_loop-2028.asp" target="_blank">Disabilities Awareness</a></li>
</ul>
<ul>These requirements are also available in the 2010 edition of the <a href="http://www.scoutstuff.org/BSASupply/ItemDetail.aspx?cat=01RTL&amp;ctgy=PRODUCTS&amp;c2=BOOKS_LIT&amp;c3=LDRS_TRAINING&amp;c4=&amp;lv=3&amp;item=34299" target="_blank">Cub Scout Academics &amp; Sports Program Guide</a>.</ul>
]]></content:encoded>
			<wfw:commentRss>http://ericsilva.org/2010/01/13/new-cub-scout-belt-loops-and-pins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Good Ol&#8217; Healthcare</title>
		<link>http://ericsilva.org/2010/01/12/good-ol-healthcare/</link>
		<comments>http://ericsilva.org/2010/01/12/good-ol-healthcare/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 04:20:12 +0000</pubDate>
		<dc:creator>Eric Silva</dc:creator>
				<category><![CDATA[Humor]]></category>
		<category><![CDATA[Observations]]></category>
		<category><![CDATA[Politics]]></category>
		<category><![CDATA[Healthcare]]></category>

		<guid isPermaLink="false">http://ericsilva.org/2010/01/12/good-ol-healthcare/</guid>
		<description><![CDATA[Now, let me get this straight&#8230;..We are going to pass a health care plan written by a committee whose chairman says he doesn&#8217;t understand it, passed by a Congress that hasn&#8217;t read it but exempts themselves from it, to be signed by a president that also hasn&#8217;t read it and who smokes, with funding administered [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>Now, let me get this straight&#8230;..We are going to pass a health care plan written by a committee whose chairman says he doesn&#8217;t understand it, passed by a Congress that hasn&#8217;t read it but exempts themselves from it, to be signed by a president that also hasn&#8217;t read it and who smokes, with funding administered by a treasury chief who didn&#8217;t pay his taxes…all to be overseen by a surgeon general who is obese, and financed by a country that&#8217;s nearly broke. What could possibly go wrong?     </p>
<p>~Anonymous</p>
<p>From today&#8217;s &quot;<a href="http://www.thegartmanletter.com/">The Gartman Letter</a>&quot;</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://ericsilva.org/2010/01/12/good-ol-healthcare/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverado Vineyards</title>
		<link>http://ericsilva.org/2010/01/01/silverado-vineyards/</link>
		<comments>http://ericsilva.org/2010/01/01/silverado-vineyards/#comments</comments>
		<pubDate>Fri, 01 Jan 2010 05:50:53 +0000</pubDate>
		<dc:creator>Eric Silva</dc:creator>
				<category><![CDATA[Wine]]></category>
		<category><![CDATA[chardonnay]]></category>

		<guid isPermaLink="false">http://ericsilva.org/?p=363</guid>
		<description><![CDATA[Type: Chardonnay Year: 2007 Location: Napa County, California Link: silveradovineyards.com Rating: 8 out of 10 Opinion: Very good chardonnay comprised of fruit from vineyards in the Napa Valley into Carneros. Minimal oak flavor as to not overpower the fruit. Hints of golden apple and pear aroma with green apple, lemon zest, and honeysuckle flavors provide [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Type:</strong> Chardonnay<br />
<strong>Year:</strong> 2007<br />
<strong>Location:</strong> Napa County, California<br />
<strong>Link:</strong> <a href="http://silveradovineyards.com">silveradovineyards.com</a><br />
<strong>Rating:</strong> 8 out of 10<br />
<strong>Opinion:</strong> Very good chardonnay comprised of fruit from vineyards in the Napa Valley into Carneros.  Minimal oak flavor as to not overpower the fruit.  Hints of golden apple and pear aroma with green apple, lemon zest, and honeysuckle flavors provide a refreshing finish.</p>
]]></content:encoded>
			<wfw:commentRss>http://ericsilva.org/2010/01/01/silverado-vineyards/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Primality Test v2.0</title>
		<link>http://ericsilva.org/2009/12/14/primality-test-v2-0/</link>
		<comments>http://ericsilva.org/2009/12/14/primality-test-v2-0/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 18:02:44 +0000</pubDate>
		<dc:creator>Eric Silva</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Math]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[prime numbers]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://ericsilva.org/?p=359</guid>
		<description><![CDATA[After feedback from some friends of mine, and doing a little bit of background research, I am writing this update to my original post last week.  As it turns out, by checking all the numbers in the form 6k ± 1  instead of checking each number up to the input value, I have increased the speed [...]]]></description>
			<content:encoded><![CDATA[<p>After feedback from some friends of mine, and doing a little bit of <a href="http://en.wikipedia.org/wiki/Primality_test" target="_blank">background research</a>, I am writing this update to my <a href="http://ericsilva.org/2009/12/10/determining-if-a-number-is-prime/" target="_self">original post last week</a>.  As it turns out, by checking all the numbers in the form 6<em>k</em> ± 1 <img style="vertical-align: middle; margin: 0px; border: initial none initial;" src="http://upload.wikimedia.org/math/2/8/e/28edd0f7feeaea1aac75a80e84bc048c.png" alt="\scriptstyle{}\leq\sqrt n" /> instead of checking each number up to the input value, I have increased the speed by 7 times! determineIsPrime3 (line 48 below) is the fastest algorithm so far.  determineIsPrime2, a simple comparision against the <img src="http://upload.wikimedia.org/math/f/8/d/f8d9ab3dcb0f9aee56999cd1fc1f7b21.png" alt="\scriptstyle\sqrt n" />, was twice as fast as the original algorithm.</p>
<p>For now, I am putting this one to bed.  It was a fun exercise, but I have got what I need from it.</p>
<pre class="brush: python; gutter: true; toolbar: true;">
'''
Checks the specified value to determine if it is a prime number.
If it is not prime the divisor will be returned instead.

@author: Eric Silva
'''

import math, time

#Change this value to whatever value you want to test for prime.
#testValue = 65027
#testValue = 155188329701
testValue = 99194853094755497
#testValue = 10888869450418352160768000001
print 'Testing %d...' % testValue

def determineIsPrime(testPrime):
    if testPrime % 2 == 0:
        return 'Divisible by 2'
    if testPrime % 3 == 0:
        return 'Divisible by 3'
    testNum = 7
    testLimit = testPrime
    while testLimit &gt;= testNum:
        if testPrime % testNum == 0:
           return 'Divisible by %d' % testNum
        testLimit = testPrime/testNum

        testNum = testNum + 2

    return '%d is prime!' % testPrime

def determineIsPrime2(testPrime):
    if testPrime % 2 == 0:
        return 'Divisible by 2'
    if testPrime % 3 == 0:
        return 'Divisible by 3'
    testNum = 5
    sqrt = math.sqrt(testPrime)
    while testNum &lt;= sqrt:
        if testPrime % testNum == 0:
           return 'Divisible by %d' % testNum

        testNum = testNum + 2

    return '%d is prime!' % testPrime

def determineIsPrime3(testPrime):
    if testPrime % 2 == 0:
        return 'Divisible by 2'
    if testPrime % 3 == 0:
        return 'Divisible by 3'
    testNum = 7
    sqrt = math.sqrt(testPrime)
    while ((6 * testNum) + 1 &lt;= sqrt) or ((6 * testNum) - 1 &lt;= sqrt):
        if testPrime % testNum == 0:
           return 'Divisible by %d' % testNum

        testNum = testNum + 2

    return '%d is prime!' % testPrime

startTime = time.time()
result = determineIsPrime(testValue)
endTime = time.time()

print result
print '1. Calculation took %f s\n' % (endTime - startTime)

startTime = time.time()
result = determineIsPrime2(testValue)
endTime = time.time()

print result
print '2. Calculation took %f s\n' % (endTime - startTime)

startTime = time.time()
result = determineIsPrime3(testValue)
endTime = time.time()

print result
print '3. Calculation took %f s\n' % (endTime - startTime)
</pre>
<p><strong>Results:</strong></p>
<pre class="brush: plain;">
Testing 99194853094755497...
99194853094755497 is prime!
1. Calculation took 202.609000 s

99194853094755497 is prime!
2. Calculation took 114.813000 s

99194853094755497 is prime!
3. Calculation took 28.781000 s
</pre>
]]></content:encoded>
			<wfw:commentRss>http://ericsilva.org/2009/12/14/primality-test-v2-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Determining if a Number is Prime</title>
		<link>http://ericsilva.org/2009/12/10/determining-if-a-number-is-prime/</link>
		<comments>http://ericsilva.org/2009/12/10/determining-if-a-number-is-prime/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 12:09:55 +0000</pubDate>
		<dc:creator>Eric Silva</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Math]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[prime numbers]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://ericsilva.org/?p=353</guid>
		<description><![CDATA[While working on some caching settings, I had a need to know if a number is prime. I wrote this little Python script which will tell you if the number defined in the script is indeed a prime. ''' Checks the specified value to determine if it is a prime number. If it is not [...]]]></description>
			<content:encoded><![CDATA[<p>While working on some caching settings, I had a need to know if a number is prime.  I wrote this little Python script which will tell you if the number defined in the script is indeed a prime.</p>
<pre class="brush: python; gutter: true; toolbar: true;">
'''
Checks the specified value to determine if it is a prime number.
If it is not prime the divisor will be returned instead.

@author: Eric Silva
'''

#Change this value to whatever value you want to test for prime.
testValue = 3011

def determineIsPrime(testPrime):
    if testPrime % 2 == 0:
        return 'Divisible by 2'
    testNum = 3
    testLimit = testPrime
    while testLimit &gt;= testNum:
        if testPrime % testNum == 0:
           return 'Divisible by %d' % testNum
        testLimit = testPrime/testNum

        testNum = testNum + 2

    return '%d is prime!' % testPrime

result = determineIsPrime(testValue)

print result
</pre>
]]></content:encoded>
			<wfw:commentRss>http://ericsilva.org/2009/12/10/determining-if-a-number-is-prime/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
