RadixMagic

Here's the trick, think of any two numbers, first number must be greater than zero.
Add the numbers together and remember the sum.
I will use 11 and 11.
So the sum is 22.
Now concatenate the two original numbers by placing them right next to each other.
Using the numbers 11 and 11 we get 1111.
Now subtract the sum you arrived at previously from the concatenated number.
We now have 1111 - 22 = 1089.
Now split apart the answer into single numbers, 1, 0, 8, and 9 and sum them together.
We end up with: 1 + 0 + 8 + 9 = 18.
Continue to split and sum the answer until you have a single number left.
We get 1 + 8 = 9. it will always be the number 9.
I wondered if this would behave the same if I did this using another number base, say octal or hex.
That was the inspiration for this page and for the most part it does and returns 1 less than the specified number base.
There is a condition that causes it to fail, JavaScript fails to return the correct answer during the subtraction step.
  1. Enter any two numbers, Number 1 must be greater than zero.
  2. Choose a number base (radix) you wish to operate in.
  3. Press the Calculate button.
When the calculate button is pressed, the following operations will be performed:

  • Convert the two numbers from base 10 to the specified base.
  • Add the two numbers together to get a sum: c = a + b
  • Concatenate the numbers a and b together to create a new number: d = ab
  • Subtract c from d and store the result in e: e = d - c
  • Sum together the individual numbers that make up e, and store the result in e: e = e[n] + e[n+1]
  • Continue summing e until e is a single number.
The answer should always be 1 less than the chosen number base.

Number 1
Number 2
Base (radix)


No comments:

Post a Comment