On Wed, Jan 27, 2010 at 9:41 PM, Martin Rubey <[email protected]> wrote: > William Stein <[email protected]> writes: > >> 2010/1/27 Jaakko Seppälä <[email protected]>: >>> True. I was just thinking that why Sage won't use the law of >>> congruences to evaluate the expression. 84977118993*2^520+1 is not too >>> large number to fit into the memory. Therefore one can use laws of >>> congruences to evaluate mod(2^(2^517)+1,84977118993*2^520+1). >> >> No. This is would directly violate one of the most basic rules of how >> the Python programming language works (that expressions are >> evaluated), and make the whole language much, much harder to reason >> and work with. >> I'm very glad that Python doesn't do that. > > I'm not sure whether you saw my answer yet... It shows that you can have > full evaluation (as in Python), and still work modulo n.
William was just saying that the mod function in mod(2^(2^517)+1,84977118993*2^520+1) couldn't easily recognize of the structure in the arguments since they are evaluated before mod sees them. > (I'd be surprised and disappointed if sage cannot do this.) Here is your example in Sage: sage: F = Integers(84977118993*2^520+1) sage: F(2)^(2^517)+1 0 sage: F(2)^(2^516)+1 207830575673500686411447362595659393768941593937702880049854622986883156049131962664562951494983277006774963177214890291645066756995999343954972963541296782130435362337 --Mike -- 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
