<?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: Prime numbers, Miller-Rabin</title>
	<atom:link href="http://shriphani.com/blog/2008/04/09/prime-numbers-miller-rabin/feed/" rel="self" type="application/rss+xml" />
	<link>http://shriphani.com/blog/2008/04/09/prime-numbers-miller-rabin/</link>
	<description>In Pursuit Of Truth and Beauty</description>
	<lastBuildDate>Mon, 06 Sep 2010 15:50:50 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Bio-Informatics &#8212; Shriphani &#8216;PSP&#8217; Palakodety</title>
		<link>http://shriphani.com/blog/2008/04/09/prime-numbers-miller-rabin/comment-page-1/#comment-8722</link>
		<dc:creator>Bio-Informatics &#8212; Shriphani &#8216;PSP&#8217; Palakodety</dc:creator>
		<pubDate>Fri, 04 Sep 2009 17:20:30 +0000</pubDate>
		<guid isPermaLink="false">http://shriphani.com/blog/2008/04/09/prime-numbers-miller-rabin/#comment-8722</guid>
		<description>[...] (which helped me a lot, thanks). And then I mixed it up with my miller rabin implementation and had a bit of fun [...]</description>
		<content:encoded><![CDATA[<p>[...] (which helped me a lot, thanks). And then I mixed it up with my miller rabin implementation and had a bit of fun [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shriphani</title>
		<link>http://shriphani.com/blog/2008/04/09/prime-numbers-miller-rabin/comment-page-1/#comment-6646</link>
		<dc:creator>Shriphani</dc:creator>
		<pubDate>Thu, 11 Jun 2009 23:43:55 +0000</pubDate>
		<guid isPermaLink="false">http://shriphani.com/blog/2008/04/09/prime-numbers-miller-rabin/#comment-6646</guid>
		<description>Matt,

The algorithm uses a check if a^p is congruent to 1 % n. a^p congruent to 1 % n means a^p -1 is divisible by n. 

Nice to know SICP has expmod. It uses the idea that a^b % n = ((a % n)^b) % n. I did write it some time back and it is on this blog. Thanks for pointing that out, I will try to integrate modular exponentiation into this script.</description>
		<content:encoded><![CDATA[<p>Matt,</p>
<p>The algorithm uses a check if a^p is congruent to 1 % n. a^p congruent to 1 % n means a^p -1 is divisible by n. </p>
<p>Nice to know SICP has expmod. It uses the idea that a^b % n = ((a % n)^b) % n. I did write it some time back and it is on this blog. Thanks for pointing that out, I will try to integrate modular exponentiation into this script.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt</title>
		<link>http://shriphani.com/blog/2008/04/09/prime-numbers-miller-rabin/comment-page-1/#comment-6638</link>
		<dc:creator>Matt</dc:creator>
		<pubDate>Thu, 11 Jun 2009 15:52:46 +0000</pubDate>
		<guid isPermaLink="false">http://shriphani.com/blog/2008/04/09/prime-numbers-miller-rabin/#comment-6638</guid>
		<description>Maybe you can help me, I&#039;m trying to implement Miller-Rabin as described in SICP, and I&#039;m getting a little lost.  The algorithm uses &#039;1 % n&#039;, but  I thought this would always be equal to 1? At least that&#039;s what my calculator says.  My math is a little rusty and I know I&#039;m being dense here, but Google isn&#039;t helping me.

BTW, if you&#039;re looking for the fastest speed possible you may want to look at SICP&#039;s expmod function (in section 1.2.6), they show a method for calculating a ^ b % n without actually calculating a ^ b.  Don&#039;t know if it&#039;s any faster in practice, but worth a shot.</description>
		<content:encoded><![CDATA[<p>Maybe you can help me, I&#8217;m trying to implement Miller-Rabin as described in SICP, and I&#8217;m getting a little lost.  The algorithm uses &#8217;1 % n&#8217;, but  I thought this would always be equal to 1? At least that&#8217;s what my calculator says.  My math is a little rusty and I know I&#8217;m being dense here, but Google isn&#8217;t helping me.</p>
<p>BTW, if you&#8217;re looking for the fastest speed possible you may want to look at SICP&#8217;s expmod function (in section 1.2.6), they show a method for calculating a ^ b % n without actually calculating a ^ b.  Don&#8217;t know if it&#8217;s any faster in practice, but worth a shot.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shriphani</title>
		<link>http://shriphani.com/blog/2008/04/09/prime-numbers-miller-rabin/comment-page-1/#comment-6526</link>
		<dc:creator>Shriphani</dc:creator>
		<pubDate>Tue, 02 Jun 2009 16:20:15 +0000</pubDate>
		<guid isPermaLink="false">http://shriphani.com/blog/2008/04/09/prime-numbers-miller-rabin/#comment-6526</guid>
		<description>Thanks for pointing out that this is wrong. rand_int&#039;s bounds are correct but I also felt that the core of the test could also do with some refactoring since I believe that was also not implemented correctly. Anyway, please let me know if the new snippet is still failing. I will be happy to fix it.</description>
		<content:encoded><![CDATA[<p>Thanks for pointing out that this is wrong. rand_int&#8217;s bounds are correct but I also felt that the core of the test could also do with some refactoring since I believe that was also not implemented correctly. Anyway, please let me know if the new snippet is still failing. I will be happy to fix it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Justin</title>
		<link>http://shriphani.com/blog/2008/04/09/prime-numbers-miller-rabin/comment-page-1/#comment-6506</link>
		<dc:creator>Justin</dc:creator>
		<pubDate>Tue, 02 Jun 2009 01:39:44 +0000</pubDate>
		<guid isPermaLink="false">http://shriphani.com/blog/2008/04/09/prime-numbers-miller-rabin/#comment-6506</guid>
		<description>Just a note for anyone else who stumbles on to this code snippet... this isn&#039;t a good implementation. The rand_int generated is less than n (or s, according to 2^s*d), whereas it needs to be less than the original number.

This implementation is not a good implementation, as 221 for example, is reported as prime more often than composite. Accuracy would be around 50% or less, whereas a good rabin-miller implementation would have 99.999% accuracy.</description>
		<content:encoded><![CDATA[<p>Just a note for anyone else who stumbles on to this code snippet&#8230; this isn&#8217;t a good implementation. The rand_int generated is less than n (or s, according to 2^s*d), whereas it needs to be less than the original number.</p>
<p>This implementation is not a good implementation, as 221 for example, is reported as prime more often than composite. Accuracy would be around 50% or less, whereas a good rabin-miller implementation would have 99.999% accuracy.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
