The standard output in SAGE for $p$-adic numbers is in the series representation:
sage: x = Zp(7)(12495)
sage: x
3*7^2 + 7^3 + 5*7^4 + O(7^22)
Is there a way to change it to a "sequence" representation, like
(..., 12495, 490, 147, 0, 0)
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It only takes a minute to sign up.
Sign up to join this communityYou could use the .list()
method to get the coefficients.
sage: x = Zp(7)(12495)
sage: x
3*7^2 + 7^3 + 5*7^4 + O(7^22)
sage: x.list()
[0, 0, 3, 1, 5]
and cook up something from there:
sage: xx = x.list()
sage: xx
[0, 0, 3, 1, 5]
sage: [sum(xx[k]*7^k for k in xrange(k+1)) for k in xrange(len(xx))]
[0, 0, 147, 490, 12495]
but you can get the residues you want directly with this command
sage: [x.residue(k+1) for k in xrange(x.precision_absolute())]
[0,
0,
147,
490,
12495,
12495,
...
12495,
12495]
There doesn't seem to be a residue_list
method which would give the whole list all at once.
Note that you can discover the methods available for the object x
by typing
sage: x.
and hitting the TAB key.