Answer in Discrete Mathematics for oata #179577

Assignment 1

Due: 6th April 2021 at 5.00 p.m.

Total: 70 marks

1. Using the theorem divisibility, prove the following

a) If a|b , then a|bc ∀a,b,c∈ℤ ( 5 marks)

b) If a|b and b|c , then a|c (5 marks)

2. Using any programming language of choice (preferably python), implement the following algorithms

a) Modular exponentiation algorithm (10 marks)

b) The sieve of Eratosthenes (10 marks)

3. Write a program that implements the Euclidean Algorithm (10 marks)

4. Modify the algorithm above such that it not only returns the gcd of a and b but also the Bezouts coefficients x and y, such that + =1 (10 marks)

5. Let m be the gcd of 117 and 299. Find m using the Euclidean algorithm (5 marks)

6. Find the integers p and q , solution to 1002 +71 = (5 marks)

7. Determine whether the equation 486 +222 =6 has a solution such that , ∈ If yes, find x and y. If not, explain your answer. (5 marks)

8. Determine integers x and y such that (421,11) = 421 + 11 . (5 marks)

1. a)

There is an integer “k” such that “ak=b”



So: “a|bc”

b) There are integers “k” and “m” such that:




So: “a|c”


 # Simple python code that first calls pow() 
# then applies % operator.
a = 2
b = 100
p = (int)(1e9+7)
# pow function used with %
d = pow(a, b) % p
print (d)

Output: “976371285”


# Python algorithm compute all primes smaller than or equal to
# n using Sieve of Eratosthenes
def SieveOfEratosthenes(n):
    # Create a boolean array "prime[0..n]" and initialize
    # all entries it as true. A value in prime[i] will
    # finally be false if i is Not a prime, else true.
    prime = [True for i in range(n + 1)]
    p = 2
    while (p * p <= n):
        # If prime[p] is not changed, then it is a prime
        if (prime[p] == True):
            # Update all multiples of p
            for i in range(p * 2, n + 1, p):
                prime[i] = False
        p += 1
    prime[0]= False
    prime[1]= False
    # Print all prime numbers
    for p in range(n + 1):
        if prime[p]:
            print p, #Use print(p) for python 3

3.Euclidean Algorithm to compute the greatest common divisor.

from math import *

def euclid_algo(x, y, verbose=True):
	if x < y: # We want x >= y
		return euclid_algo(y, x, verbose)
	while y != 0:
		if verbose: print('%s = %s * %s + %s' % (x, floor(x/y), y, x % y))
		(x, y) = (y, x % y)
	if verbose: print('gcd is %s' % x) 
	return x


 # function for extended Euclidean Algorithm 
def gcdExtended(a, b): 
    # Base Case 
    if a == 0 :  
        return b,0,1
    gcd,x1,y1 = gcdExtended(b%a, a) 
    # Update x and y using results of recursive 
    # call 
    x = y1 - (b//a) * x1 
    y = x1 
    return gcd,x,y









6.If “m=gcd(1002,71)”




























Calculate the price
Make an order in advance and get the best price
Pages (550 words)
*Price with a welcome 15% discount applied.
Pro tip: If you want to save more money and pay the lowest price, you need to set a more extended deadline.
We know how difficult it is to be a student these days. That's why our prices are one of the most affordable on the market, and there are no hidden fees.

Instead, we offer bonuses, discounts, and free services to make your experience outstanding.
How it works
Receive a 100% original paper that will pass Turnitin from a top essay writing service
step 1
Upload your instructions
Fill out the order form and provide paper details. You can even attach screenshots or add additional instructions later. If something is not clear or missing, the writer will contact you for clarification.
Pro service tips
How to get the most out of your experience with TheBestPaperWriters
One writer throughout the entire course
If you like the writer, you can hire them again. Just copy & paste their ID on the order form ("Preferred Writer's ID" field). This way, your vocabulary will be uniform, and the writer will be aware of your needs.
The same paper from different writers
You can order essay or any other work from two different writers to choose the best one or give another version to a friend. This can be done through the add-on "Same paper from another writer."
Copy of sources used by the writer
Our college essay writers work with ScienceDirect and other databases. They can send you articles or materials used in PDF or through screenshots. Just tick the "Copy of sources" field on the order form.
See why 20k+ students have chosen us as their sole writing assistance provider
Check out the latest reviews and opinions submitted by real customers worldwide and make an informed decision.
Architecture, Building and Planning
The assignment was well written and the paper was delivered on time. I really enjoyed your services.
Customer 452441, September 23rd, 2022
Excellent services will definitely come back
Customer 452441, September 23rd, 2022
The paper was EXCELLENT. Thank you
Customer 452449, September 23rd, 2022
English 101
Very good job. I actually got an A
Customer 452443, September 25th, 2022
Thanks a lot the paper was excellent
Customer 452453, October 26th, 2022
Business Studies
Job well done. Finish paper faster than expected. Thank you!
Customer 452451, October 3rd, 2022
excellent loved the services
Customer 452443, September 23rd, 2022
Business Studies
Thank you!
Customer 452451, November 27th, 2022
Job well done and completed in a timely fashioned!
Customer 452451, November 18th, 2022
Customer reviews in total
Current satisfaction rate
3 pages
Average paper length
Customers referred by a friend
15% OFF your first order
Use a coupon FIRST15 and enjoy expert help with any task at the most affordable price.
Claim my 15% OFF Order in Chat