I know of nothing built in to Sage, but this is easy to write. The following 
seems to work, even if it isn't very elegant:

def factrep(nn):
    n=nn
    i=1
    while factorial(i)<=n:
        i+=1
    i-=1
    ans=[]
    while i>0:
        d=n//factorial(i)
        ans.append(d)
        n-=d*factorial(i)
        i-=1
    return ans

Tony Wickstead

From: [email protected] [mailto:[email protected]] On 
Behalf Of Juan Grados
Sent: 13 November 2013 21:45
To: sage-support
Subject: [sage-support] Factorial Carry Value in Python

Let be s between 1 and l!-1 an integer value then s can expressed uniquely than:

s = u1*(l-1)! + u2*(l-2)!+ ... ul*0

Is there any function to find the values u1, u2, ..., ul in SAGE or python?

--
---------------------------------------------------------------------
MSc. Juan del Carmen Grados Vásquez
Laboratório Nacional de Computação Científica
Tel: +55 24 2233-6260
(http://www.lncc.br/)
http://juaninf.blogspot.com
---------------------------------------------------------------------
--
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To post to this group, send email to 
[email protected]<mailto:[email protected]>.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to