Talk:P-Adic numbers, basic

From Rosetta Code

Clarification Regarding Base

The examples use all kinds of different bases, including one example that uses base 10, which is not prime, resulting in an l-adic ring instead of a p-adic field! The specific example shown there happens to work, because the denominator in the fractions used is prime relative to the base, although the task description doesn't give any guidelines. I think a reasonable default guideline could be to copy the examples that use a p-adic field from the FreeBasic solution, which anyway appears to be the one that most other solutions translated. --Adlai (talk) 07:19, 3 March 2021 (UTC)

Clarification Regarding Rational Reconstruction

There's lots that's not clear here, and I can't find much clarifying information from the Internet. So, first let's adopt the notation (using decadic numbers) that a'b is a repeating sequence of a followed by b.

So, e.g. in Decadic, 6'7 = 1/3.

The task says to reconstruct a number:

  • Check if a number is an integer.
  • If not, repeatedly add the fraction to itself until it becomes an integer.
  • the numerator is the weighted sum.


So first off, how do I know if a p-adic number represents an integer; these are finite representations, so 6'7 = 6667 + O(10^4) for example. How do I know if it's 1/3 or 6,667 (an integer)

Step 2 isn't clear also: If I start with 2/7, then repeatedly adding 2/7 will never get me to an integer.

What is the weighted digit sum? I think it's just the base conversion (e.g. treating a 7-adic set of coefficients as a base-7 number.) Is this correct?

Finally Wikipedia shows another method based on Euclid's Algorithm but you need the upper bound on the numerator and denominator (N and D). Is this approach viable without knowing N and D?

Which Wikipedia article(s) are you referring to?     -- Gerard Schildberger (talk) 19:40, 11 August 2021 (UTC)

https://en.wikipedia.org/wiki/Rational_reconstruction_(mathematics) --Davgot (talk) 15:56, 12 August 2021 (UTC)