Rotational Symmetry | 860 0000 098

If the starting number has an odd amount of digits, then the middle digit has three possible choices: 0, 1, and 8. All digits to the left can freely be 0, 1, 6, 8, or 9. In the case that the given number has an even amount of digits, all digits left of the middle can freely be 0, 1, 6, 8, or 9. This is because all of the digits to the right will be uniquely identified by the digits on the left. With this, it is trivial to calculate the difference between two numbers where both numbers have the same amount of digits.

In the case that numbers a and b have an even number of digits, they can be treated as base 5 numbers and subtracted.

In the case that numbers a and b have an odd number of digits n, the difference can be calculated by doing (b_0*3^0+b_1*5+b_2*5^2+...+b_floor(n/2)*5^(n/2))-(a_0*3^0+a_15+a_25^2+...+a_floor(n/2)*5^(n/2)) where b_0 is the middle digit and increasing the index refers to going to the digit to the left.

ex: 1800 000 0081 - 1000 000 0001 -> 180000-100000 -> (0*3^0 + 0*5 + 0*5^2 + 0*5^3 + 4*5^4 + 1*5^5) - (0*3^0 + 0*5 + 0*5^2 + 0*5^3 + 0*5^4 + 1*5^5) = 4*5^4 = 2500

I really hope I did my math right... Also, my notation is bad but whatever

/r/counting Thread Parent