Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. **************************************************************** Personal firewall software may warn about the connection IDLE makes to its subprocess using this computer's internal loopback interface. This connection is not visible on any external interface and no data is sent to or received from the Internet. **************************************************************** IDLE 2.6.4 >>> from polymodp import PolyModP >>> from polymodp import PModP >>> from polymod import PolyMod, PMod # version with 3 param PolyMod __pow__ >>> from mod_arith import ZMod >>> f = PolyMod('x^4 + 2x^2 +1', 3) >>> q = 3**4 >>> q 81 >>> x = PolyMod('x', p) >>> h = pow(x, q, f) - x # efficient new pow with polynomial modulus! >>> h PolyMod('2x^3 + 2x', 3) >>> f = PolyMod('x^4 + x^2 +2', 3) # better luck this time? >>> h = pow(x, q, f) - x # efficient new pow with polynomial modulus! PolyMod('0', 3) >>> s = 3**(4/2) #On to other part of Rabin test; only 1 prime factor >>> s 9 >>> from xgcd import xgcd, gcd >>> h = pow(x, s, f) - x # efficient new pow with polynomial modulus! >>> gcd(f, h) PolyMod('2', 3) >>> print f #success! No more prime factors to test. Irreducible: x^4 + x^2 + 2 >>>