On Tue, Oct 21, 2008 at 9:35 PM, Jason Merrill <[EMAIL PROTECTED]> wrote:
>
> sage: 1492.digits(10)
> [2, 9, 4, 1]
>
> Now is there an easy way to take this list and get back the integer
> 1492?

I'm not sure if there is a single function that does it, but you can
use the following one liner which does what you think you should do to
reconstruct the number from its digits:

sage: n = 10; sum([d*n**i for i,d in enumerate(1492.digits(n))])
1492
sage: n = 10; sum([d*n**i for i,d in enumerate(123.digits(n))])
123
sage: n = 3; sum([d*n**i for i,d in enumerate(123.digits(n))])
123

--Mike

--~--~---------~--~----~------------~-------~--~----~
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://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to