Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

CSE 260 Homework 8 Solutions: Integer Division, Modulo Arithmetic, and Base Conversions - , Assignments of Discrete Structures and Graph Theory

Solutions to homework 8 of cse 260, which covers topics such as integer division, modulo arithmetic, and base conversions. Examples and exercises to help students understand these concepts. The solutions involve calculating the sequence of a recursive function, identifying relatively prime numbers, and performing arithmetic operations in modulo arithmetic and base conversions.

Typology: Assignments

Pre 2010

Uploaded on 07/28/2009

koofers-user-12y
koofers-user-12y 🇺🇸

10 documents

1 / 2

Toggle sidebar

Related documents


Partial preview of the text

Download CSE 260 Homework 8 Solutions: Integer Division, Modulo Arithmetic, and Base Conversions - and more Assignments Discrete Structures and Graph Theory in PDF only on Docsity! CSE 260 Homework 8- Integer Division -Answer 1. Section 2.4: 42 (hint: example 20 on page 159), 46, 47 42. For each pair (i, j)(Z+×Z+) one can order the pairs the same way as in figure 2 of page 159. 46. Part 1: Set of all computer programs in a particular programming lan- guage is countable (problem 45). A programs can be thought of binary strings which is a subset of all possible binary strings.. All binary strings are countable. Therefore, subset is countable. Part 2: Associate the real number 0.d1d2...dn... to the function f with f(n) = dn. For example, if the real is 0.234 . . . then the function will be f(1)= 2 f(2)=3 f(3)=4 and so on. Thus the set of real numbers (between 0 and 1) maps into a subset of the functions. Section 3.4: 27, 28, 31 28: We just calculate using the formula. We are given x0 = 3. Then x1=(4.3+1) mod 7=13 mod 7=6; x2=(4.6+1) mod 7=25 mod 7=4; x3=(4.4+1) mod 7 = 17 mod 7=3. At this point the sequence must continue to repeat 3, 6, 4, 3, 6, 4, . . . forever. 2. Which positive integers less than 30 are relatively prime to 30. {7, 11, 13, 17, 19, 23, 29} 3. The mod function is defined as: mod p : Z → Z(p), mod(x,p)=x mod p, and Z(p) = {0, 1, 2, ...p− 1} We can define add and multiplication in modulo arithmetic as follows: a +p b = (a + b) mod p and a ∗p b = (a.b) mod p, where a, bZ(p) An important modulo arithmetic is in Z(2) as follows: For example, 1+21=(1+1) mod 2=2 mod 2=0 and 1∗21=(1.1) mod 2= 1 mod 2=1
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved