Computer Number Systems

ACSL tests your ability to convert between bases and do arithmetic in non-decimal systems. You need to be fast - there’s no time for fumbling through long division on contest day. This lesson gives you the shortcuts that actually matter.

The four bases you need

BaseNameDigits used
Binary,
Octal-
Decimal-
Hex-, -

Memorize these hex values - you’ll use them constantly:

HexDecimalBinary

Powers you must know cold

ValueValue

The fast shortcut: binary as the bridge

This is the single most important trick for ACSL number systems. Never convert between octal and hex through decimal. Use binary as a bridge instead.

  • Each octal digit = exactly binary digits
  • Each hex digit = exactly binary digits

Example: Convert to octal.

Step 1 - Expand each hex digit to bits:

3    A    F
0011 1010 1111

Step 2 - Regroup into chunks of from the right:

001 110 101 111
 1   6   5   7

Answer: . No decimal math needed.

Example: Convert to hex.

Step 1 - Expand each octal digit to bits:

5   7   3   0
101 111 011 000

Step 2 - Regroup into chunks of from the right:

1011 1101 1000
 B    D    8

Answer: .

Decimal to other bases

The repeated division method - divide by the target base, read remainders bottom-to-top.

Example: Convert to octal.

2024 / 8 = 253 remainder 0
 253 / 8 =  31 remainder 5
  31 / 8 =   3 remainder 7
   3 / 8 =   0 remainder 3

Reading bottom-to-top: .

Try it: trace the repeated division method

Code
1Convert 2024 (decimal) to octal:232024 / 8 = 253  remainder 04 253 / 8 =  31  remainder 55  31 / 8 =   3  remainder 76   3 / 8 =   0  remainder 378Read remainders bottom-to-top: 3750
Variables
NameValue
n2024
base8
Output
Divide by 8 repeatedly
Step 1 of 6

Speed tip: For hex, divide by . Remember that remainders - become -.

Other bases to decimal

Multiply each digit by its place value and sum.

Example: Convert to decimal.

Arithmetic in other bases

The key insight: it works exactly like decimal arithmetic, but you carry/borrow at the base value instead of .

Hex addition

Example:

Work right to left:

  9876
+  ABC
------
  • , so write , carry
  • , so write , carry
  • , so write , carry
  • , so write

Answer:

Hex subtraction

Example:

Work right to left, borrowing when needed:

  • : can’t (), so borrow from next column: . The becomes .
  • : can’t (), so borrow from next column: . The becomes .

Answer:

Speed tip for subtraction: If you make an error borrowing, check by adding your answer to the smaller number. You should get the larger number back.

Octal multiplication

Example:

Work like decimal multiplication, but carry at 8 instead of 10:

  • , so write , carry
  • , plus carry , so write , carry
  • Write the final carry:

Answer:

Verify: , and . Converting : r , r , r . That gives . Correct.

Note: ACSL does not test division in other bases.

Common ACSL traps

  1. Forgetting leading zeros when regrouping binary. in binary needs to be padded to when converting to hex.
  2. Confusing octal and . These digits don’t exist in octal. If your answer has an or , you forgot to carry.
  3. Going through decimal for octal-to-hex. This wastes time and invites errors. Always use the binary bridge.
  4. Mixing up the direction of remainders. Remainders are read bottom-to-top (last remainder is the most significant digit).

Contest strategy

  • Binary-octal-hex conversions through binary: ~15 seconds each
  • Decimal conversions: ~30 seconds each
  • Base arithmetic: ~45 seconds each, verify with a quick sanity check
  • If a problem asks you to convert between octal/hex, and one answer choice has an or in octal, eliminate it immediately