Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32 Type "copyright", "credits" or "license()" for more information. >>> ======================== RESTART: F:\14\primality.py ======================== >>> trial_division(2) 2 is the smallest divisor of 2 False >>> trial_division(3) 3 is prime True >>> N = 57586096570152913699974892898380567793532123114264532903689671329431521032595057735476212721821341837060063575156440993208752824217085409959745236008778839218983091 >>> is_prime(N, True) 57586096570152913699974892898380567793532123114264532903689671329431521032595057735476212721821341837060063575156440993208752824217085409959745236008778839218983091 is composite 38972774611351599291592887197599225474607018236842006135731808567237512898183773063159299205668417796665845570634879911637326671629599347455636609754475830040759699 is a witness, i= 1 False >>> pow(38972774611351599291592887197599225474607018236842006135731808567237512898183773063159299205668417796665845570634879911637326671629599347455636609754475830040759699, N-1, N) 47168511873628868303574511255319970781333828035793051538772328687078843063022010314074522234699733039250257721278922168086623924198793188458315593993512246295672724 >>> is_prime(17, True) True >>> trial_division(N) Traceback (most recent call last): File "", line 1, in trial_division(N) File "F:\14\primality.py", line 19, in trial_division if N%m == 0: # m divides N KeyboardInterrupt >>> N 57586096570152913699974892898380567793532123114264532903689671329431521032595057735476212721821341837060063575156440993208752824217085409959745236008778839218983091 >>> len(str(N)) 164 >>> N+1 57586096570152913699974892898380567793532123114264532903689671329431521032595057735476212721821341837060063575156440993208752824217085409959745236008778839218983092 >>> trial_division(N+1) 2 is the smallest divisor of 57586096570152913699974892898380567793532123114264532903689671329431521032595057735476212721821341837060063575156440993208752824217085409959745236008778839218983092 False >>> pow(200, 560, 561) 1 >>> is_prime(561, True) 561 is composite 477 is a witness, i= 1 False >>> is_prime(561, True) 561 is composite 506 is a witness, i= 1 False >>> ======================== RESTART: F:\14\primality.py ======================== >>> DH_exchange() How many bits for the prime number? 3 p = 5 a large prime g = 4 random 1>> DH_exchange() How many bits for the prime number? 3 p = 7 a large prime g = 3 random 1>> DH_exchange() How many bits for the prime number? 50 p = 661426529041253 a large prime g = 299683150094968 random 1>> DH_exchange() How many bits for the prime number? 1024 p = 156246743341505630640332666183846171143709787570488457215399207788223990839516596333737620723361275262353572842176163699745217632340134444268840668869098326548996863399382068567058988270713935419328400365063774153306184114383805200973611732767703584128269062550097561439580888620028890651569773558748531588333 a large prime g = 7666264780502974349019406144131087368662438502159821657838056702182592458657260982709886850782344761057864570627184491920920248268051121773287792271402821851839019051468661100600148987062807141035147014369339012461793330045597089623229187980190806341970129521129411671716263929667584159762253525339260164947 random 1>> p = 156246743341505630640332666183846171143709787570488457215399207788223990839516596333737620723361275262353572842176163699745217632340134444268840668869098326548996863399382068567058988270713935419328400365063774153306184114383805200973611732767703584128269062550097561439580888620028890651569773558748531588333 >>> p/10**10/60/60/24/365 4.954551729499798e+290 >>>