2008/10/22 Timothy Clemans <[EMAIL PROTECTED]>:
>
> def from_digits(lis):
>     return ZZ(''.join([str(i) for i in lis[::-1]]))
>

Or even

sage: n = 150
sage: dig = n.digits()
sage: PolynomialRing(ZZ,'x')(dig)(2)
150

but I agree that this should be a provided function.

NB trac ticket #2796 may soon change the default base in digits from 2 to 10.

John Cermona

> On Wed, Oct 22, 2008 at 12:35 AM, 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?
>>
>> Regards,
>>
>> JM
>> >
>>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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