Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
9 views
560.valuation(2)
4
1979.valuation(3)
0
100000000000.valuation(5)
11
randrange(1,1105) #most likely we will get a different number each time
752
randrange(1,1105)
1065
gcd(1105,1103)
1
gcd(1105,919) #more often than not, it will be relatively prime, consider totient formula.
1
def finding(n): a=(randrange(2, n)) print (a) if gcd(a,n)==1: print "run Miller2" else: print "run valuation test again"
finding(15)
11 run Miller2
def Miller2(n, a): #a and n found above k=(n-1).valuation(2) q=(n-1)/2^k if (a^q, n)!=1: #this is the first part of the code. c=0 for i in range(0, k): if Mod(a^(q*2^i), n)!=-1: c=c+1 if c==k: print 'composite' else: print 'test is inconclusive' else: print 'test is inconclusive'
Miller2(15, 11)
composite
finding(561)
70 run Miller2
Miller2(561,70)
composite
finding(1105)
223 run Miller2
Miller2(1105,223)
composite
finding(294409)
191033 run Miller2
Miller2(294409,191033)
composite
finding(8675309)
7509281 run Miller2
Miller2(8675309,7509281)
test is inconclusive
finding(118901521)
18801468 run Miller2
Miller2(118901521,18801468)
composite
finding(104395303)
42564411 run Miller2
Miller2(104395303,42564411)
test is inconclusive
#Good job. 24/25 (comments on the proof are in the print-out from your email.) - Adriana.