140,916 views
38 votes
38 votes
How to convert 798 in the base of 2

User Roberthuttinger
by
2.6k points

1 Answer

12 votes
12 votes

Subtract the largest power of 2 from 798 such that the difference is not negative.

2⁹ = 512 and 2¹⁰ = 1024, so the largest power of 2 smaller than 798 is 2⁹, and

798 = 512 + 286 = 2⁹ + 286

Repeat this process with the remainder, 286.

2⁸ = 256, so

286 = 256 + 30 = 2⁸ + 30

⇒ 798 = 2⁹ + 2⁸ + 30

2⁴ = 16 and 2⁵ = 32, so

30 = 16 + 14 = 2⁴ + 14

⇒ 798 = 2⁹ + 2⁸ + 2⁴ + 14

2³ = 8, so

14 = 8 + 6 = 2³ + 6

⇒ 798 = 2⁹ + 2⁸ + 2⁴ + 2³ + 6

2² = 4, so

6 = 4 + 2 = 2² + 2¹

⇒ 798 = 2⁹ + 2⁸ + 2⁴ + 2³ + 2² + 2¹

or more completely,

798 = 1×2⁹ + 1×2⁸ + 0×2⁷ + 0×2⁶ + 0×2⁵ + 1×2⁴ + 1×2³ + 1×2² + 1×2¹ + 0×2⁰

Then the base-2 representation of 798 is

11 0001 1110₂

User Haysclark
by
3.1k points