Artificial intelligent assistant

$p$-adic numbers in SAGE 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)

You 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.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy a7bacb47b8c06c828ca8e75883e99190