\(p\)-adic Valuations on Number Fields and Their Subrings and Completions

EXAMPLES:

sage: ZZ.valuation(2)
2-adic valuation
sage: QQ.valuation(3)
3-adic valuation
sage: CyclotomicField(5).valuation(5)                                               # needs sage.rings.number_field
5-adic valuation
sage: GaussianIntegers().valuation(7)                                               # needs sage.rings.number_field
7-adic valuation
sage: Zp(11).valuation()
11-adic valuation
>>> from sage.all import *
>>> ZZ.valuation(Integer(2))
2-adic valuation
>>> QQ.valuation(Integer(3))
3-adic valuation
>>> CyclotomicField(Integer(5)).valuation(Integer(5))                                               # needs sage.rings.number_field
5-adic valuation
>>> GaussianIntegers().valuation(Integer(7))                                               # needs sage.rings.number_field
7-adic valuation
>>> Zp(Integer(11)).valuation()
11-adic valuation

These valuations can then, e.g., be used to compute approximate factorizations in the completion of a ring:

sage: v = ZZ.valuation(2)
sage: R.<x> = ZZ[]
sage: f = x^5 + x^4 + x^3 + x^2 + x - 1
sage: v.montes_factorization(f, required_precision=20)                              # needs sage.geometry.polyhedron
(x + 676027) * (x^4 + 372550*x^3 + 464863*x^2 + 385052*x + 297869)
>>> from sage.all import *
>>> v = ZZ.valuation(Integer(2))
>>> R = ZZ['x']; (x,) = R._first_ngens(1)
>>> f = x**Integer(5) + x**Integer(4) + x**Integer(3) + x**Integer(2) + x - Integer(1)
>>> v.montes_factorization(f, required_precision=Integer(20))                              # needs sage.geometry.polyhedron
(x + 676027) * (x^4 + 372550*x^3 + 464863*x^2 + 385052*x + 297869)

AUTHORS:

  • Julian Rüth (2013-03-16): initial version

REFERENCES:

The theory used here was originally developed in [Mac1936I] and [Mac1936II]. An overview can also be found in Chapter 4 of [Rüt2014].

class sage.rings.padics.padic_valuation.PadicValuationFactory[source]

Bases: UniqueFactory

Create a prime-adic valuation on R.

INPUT:

  • R – a subring of a number field or a subring of a local field in characteristic zero

  • prime – a prime that does not split, a discrete (pseudo-)valuation, a fractional ideal, or None (default: None)

EXAMPLES:

For integers and rational numbers, prime is just a prime of the integers:

sage: valuations.pAdicValuation(ZZ, 3)
3-adic valuation

sage: valuations.pAdicValuation(QQ, 3)
3-adic valuation
>>> from sage.all import *
>>> valuations.pAdicValuation(ZZ, Integer(3))
3-adic valuation

>>> valuations.pAdicValuation(QQ, Integer(3))
3-adic valuation

prime may be None for local rings:

sage: valuations.pAdicValuation(Qp(2))
2-adic valuation

sage: valuations.pAdicValuation(Zp(2))
2-adic valuation
>>> from sage.all import *
>>> valuations.pAdicValuation(Qp(Integer(2)))
2-adic valuation

>>> valuations.pAdicValuation(Zp(Integer(2)))
2-adic valuation

But it must be specified in all other cases:

sage: valuations.pAdicValuation(ZZ)
Traceback (most recent call last):
...
ValueError: prime must be specified for this ring
>>> from sage.all import *
>>> valuations.pAdicValuation(ZZ)
Traceback (most recent call last):
...
ValueError: prime must be specified for this ring

It can sometimes be beneficial to define a number field extension as a quotient of a polynomial ring (since number field extensions always compute an absolute polynomial defining the extension which can be very costly):

sage: # needs sage.rings.number_field
sage: R.<x> = QQ[]
sage: K.<a> = NumberField(x^2 + 1)
sage: R.<x> = K[]
sage: L.<b> = R.quo(x^2 + a)
sage: valuations.pAdicValuation(L, 2)
2-adic valuation
>>> from sage.all import *
>>> # needs sage.rings.number_field
>>> R = QQ['x']; (x,) = R._first_ngens(1)
>>> K = NumberField(x**Integer(2) + Integer(1), names=('a',)); (a,) = K._first_ngens(1)
>>> R = K['x']; (x,) = R._first_ngens(1)
>>> L = R.quo(x**Integer(2) + a, names=('b',)); (b,) = L._first_ngens(1)
>>> valuations.pAdicValuation(L, Integer(2))
2-adic valuation
create_key_and_extra_args(R, prime=None, approximants=None)[source]

Create a unique key identifying the valuation of R with respect to prime.

EXAMPLES:

sage: QQ.valuation(2)  # indirect doctest
2-adic valuation
>>> from sage.all import *
>>> QQ.valuation(Integer(2))  # indirect doctest
2-adic valuation
create_key_and_extra_args_for_number_field(R, prime, approximants)[source]

Create a unique key identifying the valuation of R with respect to prime.

EXAMPLES:

sage: GaussianIntegers().valuation(2)  # indirect doctest                   # needs sage.rings.number_field
2-adic valuation
>>> from sage.all import *
>>> GaussianIntegers().valuation(Integer(2))  # indirect doctest                   # needs sage.rings.number_field
2-adic valuation
create_key_and_extra_args_for_number_field_from_ideal(R, I, prime)[source]

Create a unique key identifying the valuation of R with respect to I.

Note

prime, the original parameter that was passed to create_key_and_extra_args(), is only used to provide more meaningful error messages

EXAMPLES:

sage: # needs sage.rings.number_field
sage: GaussianIntegers().valuation(GaussianIntegers().number_field().fractional_ideal(2))  # indirect doctest
2-adic valuation
>>> from sage.all import *
>>> # needs sage.rings.number_field
>>> GaussianIntegers().valuation(GaussianIntegers().number_field().fractional_ideal(Integer(2)))  # indirect doctest
2-adic valuation
create_key_and_extra_args_for_number_field_from_valuation(R, v, prime, approximants)[source]

Create a unique key identifying the valuation of R with respect to v.

Note

prime, the original parameter that was passed to create_key_and_extra_args(), is only used to provide more meaningful error messages

EXAMPLES:

sage: GaussianIntegers().valuation(ZZ.valuation(2))  # indirect doctest     # needs sage.rings.number_field
2-adic valuation
>>> from sage.all import *
>>> GaussianIntegers().valuation(ZZ.valuation(Integer(2)))  # indirect doctest     # needs sage.rings.number_field
2-adic valuation
create_key_for_integers(R, prime)[source]

Create a unique key identifying the valuation of R with respect to prime.

EXAMPLES:

sage: QQ.valuation(2)  # indirect doctest
2-adic valuation
>>> from sage.all import *
>>> QQ.valuation(Integer(2))  # indirect doctest
2-adic valuation
create_key_for_local_ring(R, prime)[source]

Create a unique key identifying the valuation of R with respect to prime.

EXAMPLES:

sage: Qp(2).valuation()  # indirect doctest
2-adic valuation
>>> from sage.all import *
>>> Qp(Integer(2)).valuation()  # indirect doctest
2-adic valuation
create_object(version, key, **extra_args)[source]

Create a \(p\)-adic valuation from key.

EXAMPLES:

sage: ZZ.valuation(5)  # indirect doctest
5-adic valuation
>>> from sage.all import *
>>> ZZ.valuation(Integer(5))  # indirect doctest
5-adic valuation
class sage.rings.padics.padic_valuation.pAdicFromLimitValuation(parent, approximant, G, approximants)[source]

Bases: FiniteExtensionFromLimitValuation, pAdicValuation_base

A \(p\)-adic valuation on a number field or a subring thereof, i.e., a valuation that extends the \(p\)-adic valuation on the integers.

EXAMPLES:

sage: v = GaussianIntegers().valuation(3); v                                    # needs sage.rings.number_field
3-adic valuation
>>> from sage.all import *
>>> v = GaussianIntegers().valuation(Integer(3)); v                                    # needs sage.rings.number_field
3-adic valuation
extensions(ring)[source]

Return the extensions of this valuation to ring.

EXAMPLES:

sage: v = GaussianIntegers().valuation(3)                                   # needs sage.rings.number_field
sage: v.extensions(v.domain().fraction_field())                             # needs sage.rings.number_field
[3-adic valuation]
>>> from sage.all import *
>>> v = GaussianIntegers().valuation(Integer(3))                                   # needs sage.rings.number_field
>>> v.extensions(v.domain().fraction_field())                             # needs sage.rings.number_field
[3-adic valuation]
class sage.rings.padics.padic_valuation.pAdicValuation_base(parent, p)[source]

Bases: DiscreteValuation

Abstract base class for \(p\)-adic valuations.

INPUT:

  • ring – an integral domain

  • p – a rational prime over which this valuation lies, not necessarily a uniformizer for the valuation

EXAMPLES:

   sage: ZZ.valuation(3)
   3-adic valuation

   sage: QQ.valuation(5)
   5-adic valuation

For `p`-adic rings, ``p`` has to match the `p` of the ring. ::

   sage: v = valuations.pAdicValuation(Zp(3), 2); v
   Traceback (most recent call last):
   ...
   ValueError: prime must be an element of positive valuation
change_domain(ring)[source]

Change the domain of this valuation to ring if possible.

EXAMPLES:

sage: v = ZZ.valuation(2)
sage: v.change_domain(QQ).domain()
Rational Field
>>> from sage.all import *
>>> v = ZZ.valuation(Integer(2))
>>> v.change_domain(QQ).domain()
Rational Field
extensions(ring)[source]

Return the extensions of this valuation to ring.

EXAMPLES:

sage: v = ZZ.valuation(2)
sage: v.extensions(GaussianIntegers())                                      # needs sage.rings.number_field
[2-adic valuation]
>>> from sage.all import *
>>> v = ZZ.valuation(Integer(2))
>>> v.extensions(GaussianIntegers())                                      # needs sage.rings.number_field
[2-adic valuation]
is_totally_ramified(G, include_steps=False, assume_squarefree=False)[source]

Return whether G defines a single totally ramified extension of the completion of the domain of this valuation.

INPUT:

  • G – a monic squarefree polynomial over the domain of this valuation

  • include_steps – boolean (default: False); where to include the valuations produced during the process of checking whether G is totally ramified in the return value

  • assume_squarefree – boolean (default: False); whether to assume that G is square-free over the completion of the domain of this valuation. Setting this to True can significantly improve the performance.

ALGORITHM:

This is a simplified version of sage.rings.valuation.valuation.DiscreteValuation.mac_lane_approximants().

EXAMPLES:

sage: # needs sage.libs.ntl
sage: k = Qp(5,4)
sage: v = k.valuation()
sage: R.<x> = k[]
sage: G = x^2 + 1
sage: v.is_totally_ramified(G)                                              # needs sage.geometry.polyhedron
False
sage: G = x + 1
sage: v.is_totally_ramified(G)
True
sage: G = x^2 + 2
sage: v.is_totally_ramified(G)
False
sage: G = x^2 + 5
sage: v.is_totally_ramified(G)                                              # needs sage.geometry.polyhedron
True
sage: v.is_totally_ramified(G, include_steps=True)                          # needs sage.geometry.polyhedron
(True, [Gauss valuation induced by 5-adic valuation, [ Gauss valuation induced by 5-adic valuation, v((1 + O(5^4))*x) = 1/2 ]])
>>> from sage.all import *
>>> # needs sage.libs.ntl
>>> k = Qp(Integer(5),Integer(4))
>>> v = k.valuation()
>>> R = k['x']; (x,) = R._first_ngens(1)
>>> G = x**Integer(2) + Integer(1)
>>> v.is_totally_ramified(G)                                              # needs sage.geometry.polyhedron
False
>>> G = x + Integer(1)
>>> v.is_totally_ramified(G)
True
>>> G = x**Integer(2) + Integer(2)
>>> v.is_totally_ramified(G)
False
>>> G = x**Integer(2) + Integer(5)
>>> v.is_totally_ramified(G)                                              # needs sage.geometry.polyhedron
True
>>> v.is_totally_ramified(G, include_steps=True)                          # needs sage.geometry.polyhedron
(True, [Gauss valuation induced by 5-adic valuation, [ Gauss valuation induced by 5-adic valuation, v((1 + O(5^4))*x) = 1/2 ]])

We consider an extension as totally ramified if its ramification index matches the degree. Hence, a trivial extension is totally ramified:

sage: R.<x> = QQ[]
sage: v = QQ.valuation(2)
sage: v.is_totally_ramified(x)
True
>>> from sage.all import *
>>> R = QQ['x']; (x,) = R._first_ngens(1)
>>> v = QQ.valuation(Integer(2))
>>> v.is_totally_ramified(x)
True
is_unramified(G, include_steps=False, assume_squarefree=False)[source]

Return whether G defines a single unramified extension of the completion of the domain of this valuation.

INPUT:

  • G – a monic squarefree polynomial over the domain of this valuation

  • include_steps – boolean (default: False); whether to include the approximate valuations that were used to determine the result in the return value

  • assume_squarefree – boolean (default: False); whether to assume that G is square-free over the completion of the domain of this valuation. Setting this to True can significantly improve the performance.

EXAMPLES:

We consider an extension as unramified if its ramification index is 1. Hence, a trivial extension is unramified:

sage: R.<x> = QQ[]
sage: v = QQ.valuation(2)
sage: v.is_unramified(x)
True
>>> from sage.all import *
>>> R = QQ['x']; (x,) = R._first_ngens(1)
>>> v = QQ.valuation(Integer(2))
>>> v.is_unramified(x)
True

If G remains irreducible in reduction, then it defines an unramified extension:

sage: v.is_unramified(x^2 + x + 1)
True
>>> from sage.all import *
>>> v.is_unramified(x**Integer(2) + x + Integer(1))
True

However, even if G factors, it might define an unramified extension:

sage: v.is_unramified(x^2 + 2*x + 4)                                        # needs sage.geometry.polyhedron
True
>>> from sage.all import *
>>> v.is_unramified(x**Integer(2) + Integer(2)*x + Integer(4))                                        # needs sage.geometry.polyhedron
True
lift(x)[source]

Lift x from the residue field to the domain of this valuation.

INPUT:

EXAMPLES:

sage: v = ZZ.valuation(3)
sage: xbar = v.reduce(4)
sage: v.lift(xbar)
1
>>> from sage.all import *
>>> v = ZZ.valuation(Integer(3))
>>> xbar = v.reduce(Integer(4))
>>> v.lift(xbar)
1
p()[source]

Return the \(p\) of this \(p\)-adic valuation.

EXAMPLES:

sage: GaussianIntegers().valuation(2).p()                                   # needs sage.rings.number_field
2
>>> from sage.all import *
>>> GaussianIntegers().valuation(Integer(2)).p()                                   # needs sage.rings.number_field
2
reduce(x)[source]

Reduce x modulo the ideal of elements of positive valuation.

INPUT:

  • x – an element in the domain of this valuation

OUTPUT: an element of the residue_field()

EXAMPLES:

sage: v = ZZ.valuation(3)
sage: v.reduce(4)
1
>>> from sage.all import *
>>> v = ZZ.valuation(Integer(3))
>>> v.reduce(Integer(4))
1
restriction(ring)[source]

Return the restriction of this valuation to ring.

EXAMPLES:

sage: v = GaussianIntegers().valuation(2)                                   # needs sage.rings.number_field
sage: v.restriction(ZZ)                                                     # needs sage.rings.number_field
2-adic valuation
>>> from sage.all import *
>>> v = GaussianIntegers().valuation(Integer(2))                                   # needs sage.rings.number_field
>>> v.restriction(ZZ)                                                     # needs sage.rings.number_field
2-adic valuation
value_semigroup()[source]

Return the value semigroup of this valuation.

EXAMPLES:

sage: v = GaussianIntegers().valuation(2)                                   # needs sage.rings.number_field
sage: v.value_semigroup()                                                   # needs sage.rings.number_field
Additive Abelian Semigroup generated by 1/2
>>> from sage.all import *
>>> v = GaussianIntegers().valuation(Integer(2))                                   # needs sage.rings.number_field
>>> v.value_semigroup()                                                   # needs sage.rings.number_field
Additive Abelian Semigroup generated by 1/2
class sage.rings.padics.padic_valuation.pAdicValuation_int(parent, p)[source]

Bases: pAdicValuation_base

A \(p\)-adic valuation on the integers or the rationals.

EXAMPLES:

sage: v = ZZ.valuation(3); v
3-adic valuation
>>> from sage.all import *
>>> v = ZZ.valuation(Integer(3)); v
3-adic valuation
inverse(x, precision)[source]

Return an approximate inverse of x.

The element returned is such that the product differs from 1 by an element of valuation at least precision.

INPUT:

  • x – an element in the domain of this valuation

  • precision – a rational or infinity

EXAMPLES:

sage: v = ZZ.valuation(2)
sage: x = 3
sage: y = v.inverse(3, 2); y
3
sage: x*y - 1
8
>>> from sage.all import *
>>> v = ZZ.valuation(Integer(2))
>>> x = Integer(3)
>>> y = v.inverse(Integer(3), Integer(2)); y
3
>>> x*y - Integer(1)
8

This might not be possible for elements of positive valuation:

sage: v.inverse(2, 2)
Traceback (most recent call last):
...
ValueError: element has no approximate inverse in this ring
>>> from sage.all import *
>>> v.inverse(Integer(2), Integer(2))
Traceback (most recent call last):
...
ValueError: element has no approximate inverse in this ring

Unless the precision is very small:

sage: v.inverse(2, 0)
1
>>> from sage.all import *
>>> v.inverse(Integer(2), Integer(0))
1
residue_ring()[source]

Return the residue field of this valuation.

EXAMPLES:

sage: v = ZZ.valuation(3)
sage: v.residue_ring()
Finite Field of size 3
>>> from sage.all import *
>>> v = ZZ.valuation(Integer(3))
>>> v.residue_ring()
Finite Field of size 3
simplify(x, error=None, force=False, size_heuristic_bound=32)[source]

Return a simplified version of x.

Produce an element which differs from x by an element of valuation strictly greater than the valuation of x (or strictly greater than error if set.)

INPUT:

  • x – an element in the domain of this valuation

  • error – a rational, infinity, or None (default: None), the error allowed to introduce through the simplification

  • force – ignored

  • size_heuristic_bound – when force is not set, the expected factor by which the x need to shrink to perform an actual simplification (default: 32)

EXAMPLES:

sage: v = ZZ.valuation(2)
sage: v.simplify(6, force=True)
2
sage: v.simplify(6, error=0, force=True)
0
>>> from sage.all import *
>>> v = ZZ.valuation(Integer(2))
>>> v.simplify(Integer(6), force=True)
2
>>> v.simplify(Integer(6), error=Integer(0), force=True)
0

In this example, the usual rational reconstruction misses a good answer for some moduli (because the absolute value of the numerator is not bounded by the square root of the modulus):

sage: v = QQ.valuation(2)
sage: v.simplify(110406, error=16, force=True)
562/19
sage: Qp(2, 16)(110406).rational_reconstruction()
Traceback (most recent call last):
...
ArithmeticError: rational reconstruction of 55203 (mod 65536) does not exist
>>> from sage.all import *
>>> v = QQ.valuation(Integer(2))
>>> v.simplify(Integer(110406), error=Integer(16), force=True)
562/19
>>> Qp(Integer(2), Integer(16))(Integer(110406)).rational_reconstruction()
Traceback (most recent call last):
...
ArithmeticError: rational reconstruction of 55203 (mod 65536) does not exist
uniformizer()[source]

Return a uniformizer of this \(p\)-adic valuation, i.e., \(p\) as an element of the domain.

EXAMPLES:

sage: v = ZZ.valuation(3)
sage: v.uniformizer()
3
>>> from sage.all import *
>>> v = ZZ.valuation(Integer(3))
>>> v.uniformizer()
3
class sage.rings.padics.padic_valuation.pAdicValuation_padic(parent)[source]

Bases: pAdicValuation_base

The \(p\)-adic valuation of a complete \(p\)-adic ring.

INPUT:

  • R – a \(p\)-adic ring

EXAMPLES:

sage: v = Qp(2).valuation(); v  # indirect doctest
2-adic valuation
>>> from sage.all import *
>>> v = Qp(Integer(2)).valuation(); v  # indirect doctest
2-adic valuation
element_with_valuation(v)[source]

Return an element of valuation v.

INPUT:

EXAMPLES:

sage: R = Zp(3)
sage: v = R.valuation()
sage: v.element_with_valuation(3)
3^3 + O(3^23)

sage: # needs sage.libs.ntl
sage: K = Qp(3)
sage: R.<y> = K[]
sage: L.<y> = K.extension(y^2 + 3*y + 3)
sage: L.valuation().element_with_valuation(3/2)
y^3 + O(y^43)
>>> from sage.all import *
>>> R = Zp(Integer(3))
>>> v = R.valuation()
>>> v.element_with_valuation(Integer(3))
3^3 + O(3^23)

>>> # needs sage.libs.ntl
>>> K = Qp(Integer(3))
>>> R = K['y']; (y,) = R._first_ngens(1)
>>> L = K.extension(y**Integer(2) + Integer(3)*y + Integer(3), names=('y',)); (y,) = L._first_ngens(1)
>>> L.valuation().element_with_valuation(Integer(3)/Integer(2))
y^3 + O(y^43)
lift(x)[source]

Lift x from the residue_field() to the domain of this valuation.

INPUT:

  • x – an element of the residue field of this valuation

EXAMPLES:

sage: R = Zp(3)
sage: v = R.valuation()
sage: xbar = v.reduce(R(4))
sage: v.lift(xbar)
1 + O(3^20)
>>> from sage.all import *
>>> R = Zp(Integer(3))
>>> v = R.valuation()
>>> xbar = v.reduce(R(Integer(4)))
>>> v.lift(xbar)
1 + O(3^20)
reduce(x)[source]

Reduce x modulo the ideal of elements of positive valuation.

INPUT:

  • x – an element of the domain of this valuation

OUTPUT: an element of the residue_field()

EXAMPLES:

sage: R = Zp(3)
sage: Zp(3).valuation().reduce(R(4))
1
>>> from sage.all import *
>>> R = Zp(Integer(3))
>>> Zp(Integer(3)).valuation().reduce(R(Integer(4)))
1
residue_ring()[source]

Return the residue field of this valuation.

EXAMPLES:

sage: Qq(9, names='a').valuation().residue_ring()                           # needs sage.libs.ntl
Finite Field in a0 of size 3^2
>>> from sage.all import *
>>> Qq(Integer(9), names='a').valuation().residue_ring()                           # needs sage.libs.ntl
Finite Field in a0 of size 3^2
shift(x, s)[source]

Shift x in its expansion with respect to uniformizer() by s “digits”.

For nonnegative s, this just returns x multiplied by a power of the uniformizer \(\pi\).

For negative s, it does the same but when not over a field, it drops coefficients in the \(\pi\)-adic expansion which have negative valuation.

EXAMPLES:

sage: R = ZpCA(2)
sage: v = R.valuation()
sage: v.shift(R.one(), 1)
2 + O(2^20)
sage: v.shift(R.one(), -1)
O(2^19)

sage: # needs sage.libs.ntl sage.rings.padics
sage: S.<y> = R[]
sage: S.<y> = R.extension(y^3 - 2)
sage: v = S.valuation()
sage: v.shift(1, 5)
y^5 + O(y^60)
>>> from sage.all import *
>>> R = ZpCA(Integer(2))
>>> v = R.valuation()
>>> v.shift(R.one(), Integer(1))
2 + O(2^20)
>>> v.shift(R.one(), -Integer(1))
O(2^19)

>>> # needs sage.libs.ntl sage.rings.padics
>>> S = R['y']; (y,) = S._first_ngens(1)
>>> S = R.extension(y**Integer(3) - Integer(2), names=('y',)); (y,) = S._first_ngens(1)
>>> v = S.valuation()
>>> v.shift(Integer(1), Integer(5))
y^5 + O(y^60)
simplify(x, error=None, force=False)[source]

Return a simplified version of x.

Produce an element which differs from x by an element of valuation strictly greater than the valuation of x (or strictly greater than error if set.)

INPUT:

  • x – an element in the domain of this valuation

  • error – a rational, infinity, or None (default: None), the error allowed to introduce through the simplification

  • force – ignored

EXAMPLES:

sage: R = Zp(2)
sage: v = R.valuation()
sage: v.simplify(6)
2 + O(2^21)
sage: v.simplify(6, error=0)
0
>>> from sage.all import *
>>> R = Zp(Integer(2))
>>> v = R.valuation()
>>> v.simplify(Integer(6))
2 + O(2^21)
>>> v.simplify(Integer(6), error=Integer(0))
0
uniformizer()[source]

Return a uniformizer of this valuation.

EXAMPLES:

sage: v = Zp(3).valuation()
sage: v.uniformizer()
3 + O(3^21)
>>> from sage.all import *
>>> v = Zp(Integer(3)).valuation()
>>> v.uniformizer()
3 + O(3^21)