Question: # Project 6 Description Write a program that prints the result of A + B + C, where these are defined as follows: A =

# Project 6 Description Write a program that prints the result of A + B + C, where these are defined as follows:

A = count of all numbers, between 1 and N (inclusive), that are NOT divisible by 7

B = count of all prime numbers between 1 and N (inclusive)

C = count of all numbers, between 1 and N (inclusive), that are divisible by ALL of the values represented by the letters of your unique word

Here N is your unique 5 digit number. As usual, a=1, b=2, c=3, ..., z=26, and so if your word is "decaded", then C should be the count of all numbers, between 1 and N, divisible by ALL the numbers: 4,5,3, and 1 (60 is such a number, in this case)

Rules/Recommendations: 1. Ideally you should define and use functions to compute A, B, and C. I will put suggested dummy functions in main.py

2. The output is a number that is the result of adding A, B, and C.

3. Prime numbers are numbers that are divisible by exactly 2 numbers: 1 and the number itself. For C, you should define a function that counts exactly how many numbers the given numbers is divisible by. As an example: the number 27 has exactly 4 divisors (also called factors) -- they are 1, 3, 9, and 27. On the other hand, the number 30 has 8 divisors (factors): 1, 2, 3, 5, 6, 10, 15, and 30

4. You are free to use isPrime() and any other functions/algorithms we discussed in previous class.

5. Please do not use any lists, tuples, maps, dictionaries, or any external libraries.

def isDivisibleBy(num, divisor): ''' function returns True if num is divisible by divisor ''' if num % divisor == 0: return True else: return False

def isOdd(num): ''' function returns True if num is odd ''' if isDivisibleBy(num,2): return False else: return True

def isPrime(num):

for i in range(2,num): if num % i == 0: return False return True

# count all numbers between A and B that are odd divisible by N A = 87655 B = A + 5000 N = ?

count = 0

for i in range(A,B+1): if isPrime(i): count += 1

print(count)

I started the code but i'm not sure how to finish it. Please help.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!