# HG changeset patch
# User Yann LaigleChapuy <yannlaiglechapuy@gmail.com>
# Date 1283362121 7200
# Node ID a65c53bdf6f5cdccb74598dc60770a2d09e2c01f
# Parent 6508ac3a99e0cfd974d0529733f8f527d7e922e7
#9395 reviewer's patch
diff r 6508ac3a99e0 r a65c53bdf6f5 sage/tests/french_book/numbertheory.py
a

b


30  30  sage: mod(3,p).multiplicative_order() 
31  31  100000000000000000038 
32  32  sage: n=3^100000; a=n1; e=100 
33   sage: timeit('(a^e) % n') # random 
 33  sage: timeit('(a^e) % n') # random long time 
34  34  5 loops, best of 3: 387 ms per loop 
35  35  sage: timeit('power_mod(a,e,n)') # random 
36  36  125 loops, best of 3: 3.46 ms per loop 
… 
… 

94  94  sage: p=previous_prime(2^400) 
95  95  sage: timeit('is_pseudoprime(p)') # random 
96  96  625 loops, best of 3: 1.07 ms per loop 
97   sage: timeit('is_prime(p)') # random 
 97  sage: timeit('is_prime(p)') # random long time 
98  98  5 loops, best of 3: 485 ms per loop 
99  99  sage: [560 % (x1) for x in [3,11,17]] 
100  100  [0, 0, 0] 
… 
… 

114  114  ... s=0 
115  115  ... for p in prime_range(n): s+=1 
116  116  ... return s 
117   sage: timeit('count_primes1(10^5)') # random 
 117  sage: timeit('count_primes1(10^5)') # random long time 
118  118  5 loops, best of 3: 674 ms per loop 
119   sage: timeit('count_primes2(10^5)') # random 
 119  sage: timeit('count_primes2(10^5)') # random long time 
120  120  5 loops, best of 3: 256 ms per loop 
121  121  sage: timeit('count_primes3(10^5)') # random 
122  122  5 loops, best of 3: 49.2 ms per loop 