Integer representations

CSE 20 Spring 2021
Homework 1
Topics Integer representations
Reading
 Section 4.1: pages 237-240 (up to but not including Modular Arithmetic);
 Section 4.2: pages 245-253 (up to but not including Modular Exponentiation).
Key Concepts Base expansion, decimal expansion, binary expansion, hexadecimal expansion,
octal expansion, DIV, MOD, integer algorithm for addition and multiplication.
In this class, unless the instructions explicitly say otherwise, you are required to justify all
your answers.
1. (15 points) (for these problems, please show your work.)
(a) (7)b + (7)b = (13)b what are the possible bases that this could be?
(b) Convert (A109B)16 to binary. (How could you do this without converting to decimal? Remember
how we did it in class.)
(c) Convert (14220)7 into binary.
(d) Convert (14220)7 into octal. (Hint use your previous answer for help.)
(e) (27)b  (27)b = (561)b. What are the possible bases that this could be?
2. (20 points) Color in computer is often represented as a 3-tuple (R; G;B) such that R; G;B are each
an integer ranging from 0 to 255.
The R value is the red component, the G value green component and B, the blue component. For
example: (0; 0; 0) represents black and (255; 255; 255) represents white.
A hex color is an integer n that has a base 16 xed-width 6 expansion:
n = (r1r2g1g2b1b2)16
where (r1r2)16 is the red component, (g1g2)16, the green component, and (b1b2)16, the blue component.
(a) How many bits are required to store each hex color?
(b) What is the red, green, and blue values each in base 10 of the hex color: (8AA4F3)16
(c) What is the hex color that corresponds to the (R; G;B) values of (205; 16; 110)?
(d) Convert the (base 10) integer 1234567 into hex color (a base 16 number with a xed-width of 6.)
(e) 12-bit color was used in the 80s on a few di erent computers. It is an integer n that has a base
16 xed-width 3 expansion:
n = (rgb)16:
Consider the conversion from hex color to 12-bit color:
Convert a given hex color: (r1r2g1g2b1b2)16 to the 12-bit color: (r1g1b1)16.
i. Convert the hex color (4ED739)16 to 12-bit color.
ii. What is the 12-bit color that corresponds to the (hex color) (R; G;B) values of (45; 154; 89)?
3. (12 points) We can represent values between 0 and 1 using fractional binary numbers. This is most
commonly done by placing the binary bits to the right of the decimal point (or in this case binary
point. A fractional binary number: (0:b?1b?2 : : : b?k)2 is equal to b?1=2 + b?2=22 + : : : + b?k=2k.
For example: 1/2 is written as (0:1)2 in fractional binary. 5=32 is written as (0:00101)2 = 0=2 + 0=4 +
1=8 + 0=16 + 1=32.
1
Here is an algorithm for converting a decimal 0 < n < 1 into a binary fraction (0:b?1b?2; : : :)2:
1. Initialize v = n.
2. Initialize i = 1.
3. Let p be the \whole number part” of 2v. (note p can only be 0 or 1).
4. Set b?i = p.
5. Set v = 2v ? p.
6. Set i = i + 1
7. Go back to step 3.
For Example: to convert 0.375 to binary decimal:
 Multiply by 2 to get: 2(0.375) = 0.75
 The whole number part is 0 so set b?1 = 0.
 Multiply 0.75 by 2: 2(0.75) = 1.5
 The whole number part is 1 so set b?2 = 1.
 Multiply (the fractional part) 0.5 by 2: 2(0.5) = 1.
 The whole number part is 1 so set b?3 = 1.
 The fractional part of 1 is 0.0 so all remaining bits will be zero.
The result is that 0:375 = 0:011.
(a) Convert the following numbers into fractional binary. (note that there may be in nite repeating
sequences of bits so only compute the rst 8 bits after the point.)
(Please show your work. You can neatly handwrite your work for this problem.)
 5/11
 1/9
 0.98765
 0.12345
(b) Try some more examples and conjecture as to which fractional binary numbers terminate and
which fractional binary numbers have in nite repeating expansions. (not for credit)
4. (20 points 24 points)
The dozenal society thinks that it would be better if we (as a society) adopted the base 12 system
(duodecimal system). Let’s explore some of the properties of this system. We will be writing base 12
numbers in italics and base 10 numbers regularly. So (33)10 = 33 and (33)12 = 33, but 33 = 29 and
33 = 39.
They also have their own way of counting. The familiar numerals are the same: 1 : \one”, 2 : \two”,
3: \three”, 4 : \four”, 5 : \ ve”, : \six”, 7 :\seven”, 8 :\eight”, 9 :\nine”
but then the next two numbers are X : \dek” and E: \el”.
Then the number 10 is called \do” (short for dozen), 20 is \two do”, E0 is \el do” and the number
100 is called \gro” (short for gross) and 1000 is called \mo” (I don’t know why).
So, for example, the number 13X9 would be said as: \mo, three gro, dek do, nine”
(a) One of the advantages to the duodecimal system is that multiplication rules for 2,3,4,6 will be
easy.
i. Write out the rst 12 multiples of 2,3,4,6 in duodecimal. ( no justi cation necessary but
remember to put your answers in italics.)
ii. Write out a general rule for how to write out the multiples of 2,3,4,6 in duodecimal.
2
iii. Knowing when something is divisible by a number is also important. For each 2,3,4,6 give a
simple rule for how to tell if a number in duodecimal is divisible by each of these numbers.
iv. I hope you see that there are some nice properties to duodecimal. But what are we losing?
The multiples of 5 are not so pretty anymore. Write out the rst 12 multiples of 5 in dozenal.
( no justi cation necessary but remember to put your answers in italics.)
(b) How is gradeschool arithmetic a ected?
i. Perform \gradeschool” addition to add the two duodecimal numbers 8X695 + E403X. (Show
your work. You can hand-write this part.)
(c) Fractional quantities are also possible in duodecimal. Instead of a decimal point \.”, duodecimal
folks use a duodecimal semicolon \;”
For example, 1 twelfth in duodecimal is 0;1 and is called one \edo” and one half in duodecimal
is 0;6 (because there are six twelfths in a half.)
i. Write out the fractions 1/3, 1/4, 1/6, 1/8, 1/9 in duodecimal. (for each, give a brief expla-
nation of how you computed them.)
ii. Which fraction corresponds to the duodecimal expansion: 0; 39 (show your work how to get
the answer and simplify as much as possible)
iii. Which fraction corresponds to the duodecimal expansion: 0; 48 (show your work how to get
the answer and simplify as much as possible)
(d) In order to transition from decimal to duodecimal we would have to convert all of our numbers.
(show your work:)
i. Convert 2021 to duodecimal.
ii. Convert 210 to duodecimal.
iii. Convert 104 to duodecimal.
5. (10 points) Suppose you are working the door at a stadium. It is your job to count the number of
people who enter. You decide to buy a tally counter which is a mechanical device that will add 1 to
the running total every time you press the lever.
You work at a basketball stadium and you can expect a maximum of 80000 people to come in for a
busy event. The tally counter in the picture has 5 wheels each with 10 digits, so it should work out
for you since it can count from 00000 to 99999. (You could also use any tally counter with 5 or more
wheels. But 4 wheels is not enough.)
The Tally Counter Manufacturer (TCM) allows you to customize your own tally counter with as many
wheels as you wish. Each wheel costs $10. So, in order to save money, you buy a tally counter with 5
wheels which costs a total of $50.
TCM also makes wheels for their tally counters of sizes (2,3,4,5,6,7,8,9) and charges $n per wheel with
n digits. For example, you could buy a tally counter where each wheel has only 5 digits (0,1,2,3,4) and
each one of these wheels would cost $5. Since you know how to read integers in any base, you decide
to explore your options.
(a) Compute the prices of the cheapest possible tally counters with at least 80000 capacity using
wheels of sizes: (you do not have to show your work for this problem.)
2, 3, 4, 5, 6, 7, 8, 9, 10
where each wheel of size n costs $n.
(b) What wheel size gives you the best price? (Give your reasoning.)

Order any type of Service We Provide

We are the best assignment service that can satisfy student’s demands in different scientific fields. We perform tasks of any kind. Our specialists provide diverse custom assignment writing services to students from all over the world every day. You can contact us for assistance with:

  • Essays of any type (application, scholarship, argumentative, personal, informative, persuasive, compare and contrast, narrative, analytical, cause and effect, critical, process, descriptive, expository essays);
  • Homework,
  • Assignments,
  • Reviews of all types (for a book, an article, or a film),
  • Reports,
  • Annotated bibliography,
  • Projects,
  • Thesis,
  • Term papers,
  • Presentations,
  • Lab works,
  • Research papers,
  • Speeches,
  • Critical thinking,
  • Capstone projects;
  • plan;
  • Coursework’s;
  • Dissertations.

The list is far from complete!

Representatives of our student assignment service are connoisseurs of the peculiarities of presentation in regards to academics. Your college assignment will never turn out an untoward surprise! Whether you need research for high school, an undergraduate program, or a Master’s or Doctoral degree, you will get exactly what you are looking for to sound smart and well-informed.

If you are pressed for time, request our experts!

We are your academic saver. It is a perfect solution for people who need academic help but has no professionals nearby to provide it. Just redirect your home tasks to us and forget about any educational issues. With us, you will get 100% plagiarism-free content delivered on time by an experienced specialist in a particular field.

Main Advantages of Collaboration with Us

When you order professional assignments here, you will get:

Original custom papers. We value your academic reputation. Just as well, we value the years of thorough work on our reputation for reliability and never compromise the originality of delivered papers. We will never endanger both. Every custom assignment is written from zero – the only possible first stage of work on the order is research. We apply the latest plagiary checking tools on the final stage, so plagiarism has no chance to emerge in your college assignment writing.

Control over the order completion. To make the process of collaboration comfortable and efficient, we offer our clients to choose the writer themselves taking into account all the requirements and the budget. For you to save nerves, having entrusted your fateful task to some qualified “stranger”, we enable communication with the assigned writer in the process of order completion.

Affordable assistance. . help with college assignments. We are eager to help you start investing in your career growth today. That is why our service is so affordable. We don’t charge to pay for the latest marketing tricks or advertisements – we choose the best experts in the labor market who write great custom papers in any area, level of complexity, and time frame. Our client’s grateful feedback is a top advertising trick.

On-time delivery. The quality of a paper is only valued when it is delivered within the determined time frame – you will get your custom assignment writing service in time and have a couple of days to revise it and ask for changes in case they are needed. And you will still have time to learn the material.

Protection. We value your trust and take all measures needed to keep your private and banking details safe. We offer only well-tested payment methods. Due to the system of encryption and protected servers, no third party can have access to your data.

Custom support 24/7. We do our best to make the process of collaboration comfortable for the customer. Our “write my assignment” help is always here for you to provide a solution to your problems, give you a prompt answer to any question, and offer clarification as to any issue related to the services. Feel free to contact us anytime!

If you feel that your dissatisfaction with student life is growing every day and you just feel exhausted, don’t hesitate to change the situation for the better today. Order your first assignment from reliable custom assignment services today to evaluate the advantages.

Having seen the difference once, you won’t want to go back to your previous lifestyle. You deserve to find fulfilment in other spheres of your life, have hobbies, spend time with close people but continue making progress. It is possible when you have a professional helper. Don’t put off your life for someday after graduation!

Order your paper now! 

 

 

 

Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more
Open chat
1
You can contact our live agent via WhatsApp! Via + 1 929 473-0077

Feel free to ask questions, clarifications, or discounts available when placing an order.

Order your essay today and save 20% with the discount code GURUH