"Glossary"... kind of important
--------------------------
x ⇔ the 8-digit number.
Dn ⇔ Digit.
z ⇔ place-value exponent of a given Dn. (Dn x 10z)
n ⇔ number label of any digit Dn.
m ⇔ 9 - n. Specifies to what multiple x should be rounded down to given n.
R(x) or any variations thereof ⇔ Round down function. Can be given in terms of the truncation function, T(x). SEE A.
T(x) or any variations thereof ⇔ Truncation function. Can be given in terms of the floor function.
--------------------------
NOTE: I use the "round down" function here, which may or may not be the same thing as ROUNDDOWN in Excel. Probably not, I don't know the slightest thing about Excel.
--------------------------
This is how Wikipedia defined roundm(x), where round(x) is defined as "rounding x to the nearest multiple of m" or "round x to the nearest mth":
"Divide x by m, let the result be y;
Round y to an integer value, call it q;
Multiply q by m to obtain the rounded value."
So rounding 15 with m = 10, or rounding 15 to the 10ths place:
Divide x = 15 by m = 10... y = 1.5.
Round y = 1.5 to the nearest integer... q = 2.
Multiply q = 2 by m = 10... 20.
And...
A
This is how I'll define my round down function Rm(x), which means "round down x to the nearest mth's":
Divide x by m, let the result be y;
Truncate y to 0 decimal places, call it q;
Multiply q by m to obtain the rounded value.
So if you want to do this for 00123456 for m = 104, you would divide first:
00123456/(104) = 0012.3456
then truncate:
T(0012.3456) = 0012
then multiply by m = 10^4
0012 * 10^4 = 00120000.
So R104(00123456) = 00120000.
You'll see where I'm going with this.
But basically: R_{10^m}(x) = m*T(\frac{x}{m})
I believe in Excel-language that would be m*TRUNC(whatevercellhas[x/m], 0)
--------------------------
NOW:
Most importantly, we know that x has 8 digits:
{D1|D2|D3|D4|D5|D6|D7|D8} ... which I will denote like so for the sake of organization.
Expanded, it looks like this:
D1*107 + D2*106 + D3*105 + ... + D8*100
First off, D8 can be extracted as a single digit by taking x, and rounding down x to the place value to the left of D8 -- otherwise stated as rounding x down to the nearest multiple of 101 and written as
R101(x)).
The operation returns this number:
{D1|D2|D3|D4|D5|D6|D7|0|}
Which when subtracted from x, or {D1|D2|D3|D4|D5|D6|D7|D8|}, returns {D8}.
So written concisely,
D8 = x - R101(x).
Obviously this only extracts a single-digit number in the sole case of D8, (ex: 12345678 - 12345000 = 678 doesn't work), and for everything else it extracts every digit to the right of that one.
So we need to cut off some numbers. For m = 1, it returns one digit, and for m = 2 it returns two. We only want the left-most digit, so we can cut it off by dividing by 10m-1 (note that after taking the difference of x and rounded x, there remains only m digits, so removing m-1 of them is appropriate) and truncating the decimals:
T(\frac{x-R_{10^m}(x)}{10^{m-1}}) = Dn
Now, note that:
D8 -> uses m = 1 for extraction of digit
D7 -> uses m = 2 for extraction of digit
.
.
.
D1 -> uses m = 8 for extraction of digit
So for any digit Dn, m + n = 9.
Also note that:
D8 is raised to the 100 in x.
D7 is raised to the 101 in x.
.
.
.
D1 is raised to the 107 in x.
So for any digit Dn, n + z = 8, where z is the original power it was raised to.
n = 9 - m
n = 8 -z
z = m - 1.THIS IS SUPER IMPORTANT THIS IS SUPER IMPORTANT THIS IS SUPER IMPORTANT
f(x) is the sum of all the digits times 10 raised to the original power z x 2...
In other words:
f(x) = \sum_{n=1}^{8} Dn^{2z}
Don't believe me? Try it out yourself. Every digit, in essence, is shifted up twice its original place (where ones-place = 0, tens-place = 1, hundreds-place = 2, etc.)
It's great that it worked out so easily, or else our f(x) would be terribly ugly.
THIS IS SUPER IMPORTANT THIS IS SUPER IMPORTANT THIS IS SUPER IMPORTANT
Now we simply compile everything we know:
As I already showed, T(\frac{x-R_{10^m}(x)}{10^{m-1}}) = Dn.
We can substitute that in, and write it all in terms of m using the the relation:
z = m - 1.
This is it:
f(x) = \sum_{m=1}^{8} T\left (\frac{x-R^-_{10^m}(x)}{10^{m-1}} \right )10^{2(m-1)}
"Glossary"... added here again for convenience
--------------------------
x ⇔ the 8-digit number.
Dn ⇔ Digit.
z ⇔ place-value exponent of a given Dn. (Dn x 10z)
n ⇔ number label of any digit Dn.
m ⇔ 9 - n. Specifies to what multiple x should be rounded down to given n.
R(x) or any variations thereof ⇔ Round down function. Can be given in terms of the truncation function, T(x).
T(x) or any variations thereof ⇔ Truncation function. Can be given in terms of the floor function.
--------------------------
I'm pretty sure I've made some dumb mistake somewhere, but you get the general idea. Round, subtract, truncate, multiply it by double the magnitude of the original, rinse and repeat 7 more times, add 'em all up from D1 to D8. Also, I'm not sure what kind of math this is categorized under, but it sure was fun working it out.