<?xml version="1.0" ?><UtilityMill><code><![CDATA[
"""
Copyright 2007 - Utility Mill and/or Authors of this program.

This file is part of the Utility Mill Utility Miller_Rabin_Primality_Test (http://www.utilitymill.com/utility/Miller_Rabin_Primality_Test).

Miller_Rabin_Primality_Test's user-editable source code is free software; you can redistribute
it and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

Miller_Rabin_Primality_Test is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

Note: Any license specified in code section below and approved by Utility Mill
supercedes above GPL license.
"""

#import line added for compatibility with code execution change.
#You can remove all but what is needed.
import calendar,datetime,difflib,math,random,re,string,time,urllib

def millerTest(a, i, n):
    if i == 0:
        return 1
    x = millerTest(a, i / 2, n)
    if x == 0:
        return 0
    y = (x * x) % n
    if ((y == 1) and (x != 1) and (x != (n - 1))):
        return 0
    if (i % 2) != 0:
        y = (a * y) % n
    return y
if int(VAL1)<4:
    print 'Minimum allowed value to test is 4'
else:
    if millerTest(random.randint(2, int(VAL1) - 2), int(VAL1) - 1, int(VAL1))==1:
        print VAL1,'is prime.'
    else:
        print VAL1,'is not prime.'
        ]]></code></UtilityMill>
