Fractions to Infinite P-adic Sequences

Turn a rational number into its p-adic digit expansion. This is the same fraction, but viewed in a metric where divisibility by p controls closeness.

Press "Compute expansion".

What this means

Every rational a/b can be written as p^k * (d0 + d1 p + d2 p^2 + ...) where each di is in {0,...,p-1}.

The expansion is usually infinite to the left in Euclidean intuition, but is convergent in the p-adic metric. This is one of the core geometric shifts behind p-adic machine learning.