If you take a look at the code, there is something fishy. Add the
following statements.

def sum_of_squares(p):
    if p.mod(4)==1:
        A=startingA(p)
        print A
        B=1
        temp = A**2+B**2
        print type(A**2+B**2)
        temp
        M=(A**2+B**2)/p
        while M>1:
            [a,b,r]=iterate(A,B,M,p)
            [A,B,M]=[a,b,r]
        return [A,B]
    else:
        print 'no'

For 73 you get

46
<type 'sage.rings.finite_rings.integer_mod.IntegerMod_int'>
Traceback (click to the left of this block for traceback)
...
ZeroDivisionError: Inverse does not exist.

So A^2+B^2 (legitimate syntax in Sage) is a modular integer.  In fact,
you can check that its modulus is 73, and so it's no surprise that
dividing by 73 \equiv 0 will result in a zero-division error.
You'll have to find a way to get the power modulo p without actually
making the thing an integer mod p.

Hope this helps!
- kcrisman


On Jun 22, 7:43 pm, Ken Levasseur <[email protected]> wrote:
> On Jun 22, 4:06 pm, Robert Bradshaw <[email protected]>
> wrote:
>
> > What is startingA ? What is the parent of A?
>
> The full .sws file is athttp://homepage.mac.com/klevasseur/sum_of_squares.sws
>
> Ken

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to