On Jan 15, 2009, at 4:10 PM, [email protected] wrote: > That's interesting because I calculated M37 = 2^3021377-1 (909526 > digits) on a 2.6 GHz pentium 4 using my own C++ class to represent > large ints and it about 2 hours. > > I calculated the same thing on www.sagenb.org and it took about 6 > minutes!
Yeah, sagenb.org can get pretty loaded down some times. This is on my laptop (2.33 GHz Intel Core 2 Duo) sage: time M37 = 2^3021377-1 CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s Wall time: 0.00 s sage: time len(str(M37)) CPU times: user 1.06 s, sys: 0.03 s, total: 1.08 s Wall time: 1.09 s 909526 Note that the bulk of the time is spent getting the (decimal) string representation of M37. Of course, if I only wanted the number of digits, I could more quickly do sage: time RIF(M37).log(10) CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s Wall time: 0.00 s 909525.1052092525? I wonder if doing this via the notebook took so long because of the overhead of sending the data back (most browsers don't do well with nearly a MB of text in a cell...). Sage uses gmp in the background to do it's big integer arithmetic and is both very tightly coded and has a wide range of asymptotically fast algorithms, which shouldn't impact this case, but for another example: sage: time a = M37^2 CPU times: user 0.09 s, sys: 0.01 s, total: 0.10 s Wall time: 0.10 s > Well, I suppose 4 Xeon cores is a mini cluster of sorts. Yeah, it's not bad for a desktop :). - Robert --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sage-edu" group. 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-edu?hl=en -~----------~----~----~----~------~----~------~--~---
