Loading [MathJax]/extensions/asciimath2jax.js

2019-04-10-142343.sagews

AuthorDaniel Dugger
Date2019-04-11T02:46:07
Project5e6cf52d-f63d-44b8-9877-1034299babba
Location2019-04-10-142343.sagews
Original file2019-04-10-142343.sagews
1+1
2
55^11
13931233916552734375
55^500
1518255094678865783335576122572232370642869059478846815609562564234688935511618278051119723612452162421280335715310483080784611083838811776143172046890625754427591224793817690139797307639430739686983749609947973675866625470364030173903143786575709326168357240889113173252578537478545637838244704646071277175356487888983778613952986528511991295111458093030377453207446419971269567941658996259308159435349055469250047489139996993494319179398245309447286624594256675142656714834248702729141858692465986767434513592905239426363512746344790904750656631674840178506538009972578453153702562490384795194495308644493532349245766316844401450866113647292743040148192457609207124884576863274736476873382161106038119353487385614310301777645190828536397482088256612181565621887846413415196979798988678104580586306721868670523108081261255287845203520991077539292746223509311676025390625
is_prime(1001)
False
a=randint(10^10,10^11)
a
13110234759
is_prime(a)
False
def find_a_prime(lower,upper,trials):     #find a prime between upper and lower, using "trials" at the number of attempts    i=1    while i<=trials:        a=randint(lower,upper)             #a=random integer between the two bounds        if is_prime(a):                    # if a is prime, return it            return a        i=i+1                              #increase the counter and go back and do it again    return "Not found"
find_a_prime(10^108,10^109,60)
9787503257639341668606169272651867649814524196912465920683191532342652040441538845243311553555982169790436341L
def show_powers(x,p):   # show powers of x in Z/p    i=0    list=[]    while i<p:          #        list.append ( [i, (x^i)%p] )   #add point (i,x^i) to list        i=i+1    graph=points(list)   # Plot all the points in "list" in a graph    show(graph)           # Display the graph    return
show_powers(2,1009)
def power(n,k,p): # Finds n^k mod p using the naive method    i=0    temp=1    while i<k:       temp=(temp*n)%p       i=i+1    return temp
def fpower(n,k,p):   # Finds n^k using Fast Powering    if k==0:       return 1    if k==1:       return n    if k%2==0:       temp=fpower(n,k/2,p)       temp=(temp^2)%p       return temp    temp=fpower(n,(k-1)/2,p)    temp=(n*temp*temp)%p    return temp
fpower(55,2000000017,101)
59