A mixed-radix number is somewhat like having a different base for each digit.
The primary objective of this paper is stating mixed-radix representation’s of
e and
π, and converting them to more useful bases.
Example of mixed-radix number:
a0+21(a1+31(a2+41(a3+…)))
Which expands to
a0+21a1+3⋅21a2+4⋅3⋅21a3+…
When
ai=1 for all
i, this is the well-known power series for
e.
The goal of this manipulation is to extract base-10 digits from this mixed-radix form, one digit at a time.
We first take this recursion to some specific depth.
5 in this example.
From right to left, we consecutively reduce the inner values mod the outer divisor, moving out the quotient in the process.
An example is more clear:
61(10+…)=610+6…=1+64+6…=1+61(4+…)distributedivide and take remainderfactor
This method of distributing the divisor,
diving with remainder, and factoring is repeated:
Why? Well, it is reasonable to assume that, because we limited the recursion to a finite number of levels,
the remaining levels begin to become significant as the powers of
10 rise.
Looking at the last reasonable result, we see at the end:
4+103(…)
Let’s call
(…) to be
r , we see
r=71(1+81(…))
Which expands to
r=7!1+8!1+…
Multiplying in the
103 creates a value less than
1, and so it does not effect the calculations.
103r=103(7!1+8!1+…)≈0.227
However, when the power of ten is increased to
104, we see:
104(7!1+8!1+…)≈2.267
Which is greater than one and will likely cause a deleterious effect when it is missing from the calculations.
So, the question is: how many terms does the recursion need to be expanded to to obtain
d digits?
Instead of thinking about the algorithm as algebraic manipulations on a recursive equation,
I find it easier to think of as an array of numbers.
The first step of the above example becomes:
Inside the array, there are 5 slots (columns). Each slot represents a level of recursion.
More slots => more digits extractable.
Let
d represent the number of digits being extracted, and
s represent the number of slots.
A calculation using
s slots will yield
d digits when the following is true:
1>10d(x=s+2∑∞x!1)
Infinite sums are cumbersome so instead a simpler form is desired.
So long as the value of the sum overestimated, a simpler form will still work.
The following form is valid according to Desmos and WolframAlpha, so I’ll trust those sites on that.
(s+1)!1>x=s+2∑∞x!1
Substituting this simpler expression in:
(s+1)!>10d
Solve for digits:
ln(10)ln((s+1)!)>d
Plotting this, we see
The linear approximation of
d≤s−3
Fits well under the entire domain.
This approximation becomes poorer as more slots are added, but never overestimates.
When
s=70,
d≤≈100
A polynomial or piecewise approximation could provide improvement.
The original paper provides a different approximation entirely.
I have not reviewed that approximation.
When in one of the previous examples the result of
2.7180… was obtained, only 5 slots were used,
and so only two digits after the decimal place should have been expected with confidence to be correct.
Back again to thinking of the problem algorithmically:
invqr021070131041241030351021461014
Where:
iniviqiriq0=i+2=⌊(vi+qi+1)/ni⌋=(vi+qi+1)modni=nth digit of eindexdivisorvaluequotientremainder
To find the second digit, update the table such that:
This implementation seems very similar to the Algol 60 one provided in the paper.
I’m not familiar with the array syntax and semantics in Algol 60, so there may be variation there.