On Mar 20, 2007, at 7:11 AM, DanK wrote:

> sage: v=1; w=1; x=1 #Berechnung von Vp,t noch ohne modulo q
> sage: for i in range(1,((p-1)/2)+1):
> ... v=z^i-z^(-i)%q
> ... w=v^(i^expo)
> ... x=(x*w)%q

One serious problem is, that on the line

> ... w=v^(i^expo)

you are doing the modular arithmetic extremely inefficiently. For  
example, when i is 18, then i^expo = 104976, and even if v is as  
small as 2, then you are already dealing with numbers that are  
thousands of digits long, whereas all the modular arithmetic could be  
done mod q. Compare the following:

sage: x = 100
sage: y = 1000000000000000000000000
sage: x^y % 241

(that should keep your computer busy for a while)

but you can also get the result in the following way,

sage: R = Integers(241)
sage: R
  Ring of integers modulo 241
sage: x = 100
sage: y = 1000000000000000000000000
sage: R(x)^y
  15

which is a little faster.


> Traceback (most recent call last):
>     for i in range(1,((p-1)/2)+1):
>   File "/usr/local/sage/local/lib/python2.5/", line 3, in <module>
>
> RuntimeError

Probably the reason you are getting this error is you are trying to  
compute an exponential (as I indicated above) which is making your  
machine run out of memory.

David


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to