When a patient visits a hospital,
a host of information about that patient is recorded. This may
include her address, insurance data, history of surgery, or allergies
to medication. In an effort to organize data, particularly information
that *needs* to be addressed, some hospitals rely on the
following coding system.

The hosptial maintains a list of all data that might need to be addressed (we could consider this a master list of important patient information). The list might look something like this . . .

When a patient arrives, each item on the list is either categorized as YES (we have this piece of information) or NO (we do not have this information). This series of yes/no answers, henceforth called the categorized master list, is then condensed into a number as follows:

The patient number begins with a value of zero.

If the first item on the list is categorized as NO, then is added to the patient number.

This continues for the remaining items on the list. If the ith item is NO, then is added to the patient number.

An example:

This patient has received NO on items 2, 5, and 12. Thus the patient's number will be

**THE PROBLEM: Hospital administrators
are looking for an easy (and inexpensive) way to convert a patient
number into a list of items to be addressed AND from the list
to a patient number.**

So, the goal is to figure out a general way to convert between the patient number and 'categorized master list.'

To accomplish this task it may be useful to first examine particular examples.

Since items 5, 6, 9, and 12 are flagged as NO the patient number will be

So, when we are given a specific categorized list, finding the patient number is a relatively simple process.

Now lets take the patient number we just found, 2066, and find the item numbers associated with the patient's categorized list.

To do this, we might need to first examine what a number written in base 10 represents. Let's look at the number 365 (written in base 10). This number means the following:

Thus to write a number, N, in base 2 we must figure out the largest power of 2 that is less than N. Then we can calculate how N can be decomposed as the sum of powers of 2. Take a look at an example below.

Therefore, the base 2 version of 99 is 1100011 (). Consequently, a patient having number 99 would be missing information in slots 7, 6, 2, and 1.

The original hospital problem asked for a simple method of using the patient number to determine what items need attention and, alternatively, to quickly calculate the patient number from a completed master list. Solving this problem is actually a matter of creating a user-friendly method of converting between decimal and binary numbers.

This spreadsheet offers a way of quickly converting between patient number and pertinent item numbers (or category numbers).

To convert a patient number to category numbers, the spreadsheet computes the log base 2 of the patient number. By rounding this number down, one finds the largest power of 2 that can be formed from the patient number. In an interative process, the log base 2 of the remaining amount is computed until zero is reached. The spreadsheet keeps track of the powers of 2 used and records these as the 'Unknown Categories.'

Designing the spreadsheet to generate a patient number from a list of Cateogry Numbers is a simpler task. The file must sum the results of raising 2 to the power of each Category Number.

A final question remains as to how the lenght of the patient number veries with the number of item numbers, or information slots, on the master list. An exploration of that question can be found here.