# Ticket #9395: trac_9395_review.patch

File trac_9395_review.patch, 1.5 KB (added by ylchapuy, 9 years ago)

apply on top of trac_9395.patch

• ## sage/tests/french_book/numbertheory.py

```# HG changeset patch
# User Yann Laigle-Chapuy <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 sage: mod(3,p).multiplicative_order() 100000000000000000038 sage: n=3^100000; a=n-1; e=100 sage: timeit('(a^e) % n') # random sage: timeit('(a^e) % n') # random long time 5 loops, best of 3: 387 ms per loop sage: timeit('power_mod(a,e,n)') # random 125 loops, best of 3: 3.46 ms per loop sage: p=previous_prime(2^400) sage: timeit('is_pseudoprime(p)') # random 625 loops, best of 3: 1.07 ms per loop sage: timeit('is_prime(p)') # random sage: timeit('is_prime(p)') # random long time 5 loops, best of 3: 485 ms per loop sage: [560 % (x-1) for x in [3,11,17]] [0, 0, 0] ...    s=0 ...    for p in prime_range(n): s+=1 ...    return s sage: timeit('count_primes1(10^5)') # random sage: timeit('count_primes1(10^5)') # random long time 5 loops, best of 3: 674 ms per loop sage: timeit('count_primes2(10^5)') # random sage: timeit('count_primes2(10^5)') # random long time 5 loops, best of 3: 256 ms per loop sage: timeit('count_primes3(10^5)') # random 5 loops, best of 3: 49.2 ms per loop