I had this function in a worksheet at sagenb.com
def Z(D,t,dhat):
quot=D/dhat
sum=0
for l in divisors(quot):
a=l*dhat
print a, t, GCD(a,t)
sum=sum+GCD(a,t)
return sum
and Z(3,3,1) returns
1 3 1
3 3 1
2
which means GCD(3,3)=1
I know that in order to solve the problem I had to put quot=ZZ(D/dhat)
instead of quot=D/dhat
(I took me a while, though).
I didn't have that problem in the Shell
sage: def Z(D,t,dhat):
....: quot=D/dhat
....: sum=0
....: for l in divisors(quot):
....: a=l*dhat
....: print a, t, GCD(a,t)
....: sum=sum+GCD(a,t)
....: return sum
....:
sage: Z(3,3,1)
1 3 1
3 3 3
4
so I see a difference here.
cheers
tincho
--~--~---------~--~----~------------~-------~--~----~
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
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---