Ticket #9395: trac_9395_review.patch

File trac_9395_review.patch, 1.5 KB (added by ylchapuy, 8 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 b  
    3030sage: mod(3,p).multiplicative_order()
    3131100000000000000000038
    3232sage: n=3^100000; a=n-1; e=100
    33 sage: timeit('(a^e) % n') # random
     33sage: timeit('(a^e) % n') # random long time
    34345 loops, best of 3: 387 ms per loop
    3535sage: timeit('power_mod(a,e,n)') # random
    3636125 loops, best of 3: 3.46 ms per loop
     
    9494sage: p=previous_prime(2^400)
    9595sage: timeit('is_pseudoprime(p)') # random
    9696625 loops, best of 3: 1.07 ms per loop
    97 sage: timeit('is_prime(p)') # random
     97sage: timeit('is_prime(p)') # random long time
    98985 loops, best of 3: 485 ms per loop
    9999sage: [560 % (x-1) for x in [3,11,17]]
    100100[0, 0, 0]
     
    114114...    s=0
    115115...    for p in prime_range(n): s+=1
    116116...    return s
    117 sage: timeit('count_primes1(10^5)') # random
     117sage: timeit('count_primes1(10^5)') # random long time
    1181185 loops, best of 3: 674 ms per loop
    119 sage: timeit('count_primes2(10^5)') # random
     119sage: timeit('count_primes2(10^5)') # random long time
    1201205 loops, best of 3: 256 ms per loop
    121121sage: timeit('count_primes3(10^5)') # random
    1221225 loops, best of 3: 49.2 ms per loop