Difference between revisions of "W1031 Positive Integers"

From Coder Merlin
(Created page with "thumb|Binary counter == Research == == Background ==")
 
Line 2: Line 2:
== Research ==
== Research ==


[[File:Binary counter.gif|thumb|Binary counter]]
== Background ==
== Background ==
The process of transforming information from a source format into another, particularly for storage or transmission, is termed '''encoding'''.  The opposite process, transforming the stored form to the original format, is termed '''decoding'''.
Because modern-day computers are digital and store data as a series of bits, where each bit can possess only the value of one or zero, ''all data'' that we store must ultimately be represented in this format.
Positive integers may be encoded simply by relying on the binary number system.  Given ''n'' bits, we can encode any number from zero through <math>2^n-1</math>.
[[File:Egg.jpg|thumb|left|100px|An Egg]]
<blockquote>
''It is allowed on all hands, that the primitive way of breaking eggs before we eat them, was upon the larger end: but his present Majesty's grandfather, while he was a boy, going to eat an egg, and breaking it according to the ancient practice, happened to cut one of his fingers. Whereupon the Emperor his father published an edict, commanding all his subjects, upon great penalties, to break the smaller end of their eggs.'' - Jonathan Swift, Gulliver's Travels
</blockquote>

Revision as of 14:30, 19 June 2019

Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder
Binary counter

Research[edit]

Binary counter

Background[edit]

The process of transforming information from a source format into another, particularly for storage or transmission, is termed encoding. The opposite process, transforming the stored form to the original format, is termed decoding. Because modern-day computers are digital and store data as a series of bits, where each bit can possess only the value of one or zero, all data that we store must ultimately be represented in this format.

Positive integers may be encoded simply by relying on the binary number system. Given n bits, we can encode any number from zero through .

An Egg

It is allowed on all hands, that the primitive way of breaking eggs before we eat them, was upon the larger end: but his present Majesty's grandfather, while he was a boy, going to eat an egg, and breaking it according to the ancient practice, happened to cut one of his fingers. Whereupon the Emperor his father published an edict, commanding all his subjects, upon great penalties, to break the smaller end of their eggs. - Jonathan Swift, Gulliver's Travels