Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What math do I need to convert numbers according to this table?

Tags:

math

Given an X, what math is needed to find its Y, using this table?

x y
0 1
1 0
2 6
3 5
4 4
5 3
6 2

This is a language agnostic problem. I can't just store the array, and do the lookup. The input will always be the finite set of 0 to 6. It won't be scaling later.

like image 776
Uberfuzzy Avatar asked May 03 '10 20:05

Uberfuzzy


People also ask

How do you convert numbers into math?

Step 1 − Divide the decimal number to be converted by the value of the new base. Step 2 − Get the remainder from Step 1 as the rightmost digit (least significant digit) of new base number. Step 3 − Divide the quotient of the previous divide by the new base.

What is the need of number conversions?

Number system conversions deal with the operations to change the base of the numbers. For example, to change a decimal number with base 10 to binary number with base 2. We can also perform the arithmetic operations like addition, subtraction, multiplication on the number system.

What is base 9 math used for?

In number system, base 9 number system is also called Nonary system. In this system, each digit is written as two ternary (base 3) digits. Unlike how octal (base 8) and hexadecimal (base 16) systems are used in place of binary (base 2), base 9 number system can be used to compact representation of ternary.

What is base 11 called?

The undecimal numeral system (also known as the base-11 numeral system) is a positional numeral system that uses eleven as its base.


1 Answers

This:

y = (8 - x) % 7

This is how I arrived at that:

x  8-x  (8-x)%7
----------------
0   8     1
1   7     0
2   6     6
3   5     5
4   4     4
5   3     3
6   2     2
like image 127
Guffa Avatar answered Jan 01 '23 20:01

Guffa