Ticket #5496: trac5496_rationals_to_int.patch

File trac5496_rationals_to_int.patch, 1.3 KB (added by spancratz, 3 years ago)

Three small changes throughout the Sage library

  • sage/combinat/combinat.py

    # HG changeset patch
    # User Sebastian Pancratz <sage@pancratz.org>
    # Date 1263776557 28800
    # Node ID 35eeb5638d35ea3e5be154acd3c54233326d169d
    # Parent  21efb0b3fc474972b5c7f617d99173536a3d79d0
    Small 3-line change conversing rationals to integers.
    
    diff -r 21efb0b3fc47 -r 35eeb5638d35 sage/combinat/combinat.py
    a b  
    454454     
    455455    :: 
    456456     
    457         sage: lucas = lambda n:(5/2)*lucas_number1(n,1,-1)+(1/2)*lucas_number2(n,1,-1) 
     457        sage: lucas = lambda n : Integers((5/2)*lucas_number1(n,1,-1)+(1/2)*lucas_number2(n,1,-1)) 
    458458        sage: [[lucas(n),is_prime(lucas(n)),n+1,is_prime(n+1)] for n in range(15)] 
    459459        [[1, False, 1, False], 
    460460         [3, True, 2, True], 
  • sage/rings/arith.py

    diff -r 21efb0b3fc47 -r 35eeb5638d35 sage/rings/arith.py
    a b  
    41484148        x = int(sqrt(m)) 
    41494149        if mod(x,2) == 0: 
    41504150            x = x - 1 
    4151         p = (m-x**2)/2 
     4151        p = (m-x**2) // 2 
    41524152        while not is_prime(p): 
    41534153            x = x - 2 
    4154             p = (m-x**2)/2 
     4154            p = (m-x**2) // 2 
    41554155            if x < 0: 
    41564156            # fall back to brute force 
    41574157                m = m + d