1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
AysviL [449]
3 years ago
15

Assume the availability of a function is_prime. Assume a variable n has been associated with positive integer. Write the stateme

nts needed to find out how many prime numbers (starting with 2 and going in increasing order with successively higher primes [2,3,5,7,11,13,...]) can be added before exceeding n. Associate this number with the variable k.
Computers and Technology
1 answer:
vivado [14]3 years ago
6 0

Answer:

def main():

   n = int(input('Enter the value of the variable n:'))

   k=2;

   totalSum = 0

   print('The list of the prime numbers are as follows:')

   while k <= n:

       totalSum = totalSum+is_prime(k)

       k=k+1

   print('Total sum of the prime numbers:',totalSum)

def is_prime(k):

   primeNumber = 0      

   i=1

   while i<=int(k):

       if (k % i) == 0:

           primeNumber = primeNumber + 1

       i=i+1

   if(primeNumber==2):      

       print(k)

       return k;

   else:        

       return 0;

main()

Explanation:

  • Run the while loop until k is less than n.
  • Determine if the variable k is prime then add it to the totalSum variable.
  • Increment the value of k by 1.
  • Create a function isPrime to check whether the number is prime  or not by determining the factors of k which can be found using the modulus operator.
  • Call the main function at the end.

You might be interested in
Choose the words that make the following sentence true.<br> Primary memory is
ki77a [65]

Answer:

Primary memory is computer memory that is accessed directly by the CPU

Explanation:

8 0
3 years ago
The following method public String removeFromString(String old, String frag) removes all occurences of the string frag from the
Mashutka [201]

private static String removeFromString(String old, String frag)

{

int i = old.indexOf(frag);

while (i> -1) {

String rest = old.substring(i + frag.length());

System.out.println("rest = " + rest);

old = old.substring(0, i);

System.out.println("rest = " + old);

old = old + rest;

System.out.println("rest = " + old);

i = old.indexOf(frag);

System.out.println("i = "+ i);

}

return old;

}

Here the index of first occurrence is obtained outside the “while loop” and if this loop runs until index value is >-1. It extracts the rest of the characters other than “frag” from the index and all the characters for which the given set of characters are removed.

4 0
3 years ago
Zoom Vacuum, a family-owned manufacturer of high-end vacuums, has grown exponentially over the last few years. However, the comp
Sati [7]

Answer:

The best advice for Zoom Vacuum is  to start with a Transaction Processing System(TPS). This system will process all the day to day transactions of the system. It is like a real time system where users engage with the TPS and generate, retrieve and update the data. it would be very helpful in lowering the cost of production and at the same time manufacture and produce standard quality products.

Although, TPS alone would not be sufficient enough. so Management Information System(MIS) would be needed, that can get the data from the TPS and process it to get vital information.

This MIS will bring about information regarding the sales and inventory data about the current and well as previous years.

With the combination of TPS as well as MIS is a minimum requirement for a Zoom Vacuum to become successful in the market.

Explanation:

Solution

When we look at the description of the Zoom Vacuum manufacturing company closely, we see that the business is currently a small scale business which is trying to become a small to mid scale business. This claim is supported by the fact that there is only one manufacturing plant and three warehouses. And here, we also need to have the knowledge of the fact that small business major aim is to keep the cost low and satisfy the customers by making good products. So we need to suggest what information system is best suited for small scale business enterprises.

The best recommendation would be to start with a Transaction Processing System(TPS). This system will process all the day to day transactions of the system. It is like a real time system where users interact with the TPS and generate, retrieve and modify the data. This TPS would be very helpful in lowering the cost of production and at the same time manufacture and produce standard quality products . Also TPS can help in communicating with other vendors.

But TPS along would not be sufficient. Also Management Information System(MIS) would be required that can get the data from the TPS and process it to get vital information. This MIS will help in generating information regarding the sales and inventory data about the current and well as previous years. Also MIS can create many types of graphical reports which help in tactical planning of the enterprise.

So a combination of TPS as well as MIS is a minimum requirement for a Zoom Vacuum to become successful in the market.

7 0
3 years ago
Select the correct answer. One of the functions of a data warehouse is to change table names to meaningful names. Which name is
Marianna [84]

Answer:

A. weekrep101

Explanation:

hope this worked and notice the update

6 0
3 years ago
What should you do when you are working on an unclassified system and receive an email.
koban [17]

Answer:

Don't respond to it. Either leave it there, or just delete it. It is most likely spam or a scammer trying to get your information. Don't respond, please.

3 0
2 years ago
Other questions:
  • g The reciprocal Fibonacci constant ψ is defined by the infinite sum: ψ=∑n=1 [infinity] 1 Fn Where Fn are the Fibonacci numbers
    7·1 answer
  • Web storage stores data in the browser in
    5·1 answer
  • In a video, a motionless image is called
    7·2 answers
  • Design and implement a class Country that stores the name of the country, its population, its area, and the population density (
    6·1 answer
  • What sugar is used in a DNA molecule​
    7·2 answers
  • To say the internet has helped democratize knowledge means that
    11·1 answer
  • Type two statements that use rand() to print 2 random integers between (and including) 100 and 149. End with a newline.
    15·1 answer
  • Write a code that takes numbers from the user as a list. (User can enter as many numbers as he wants). Then, find mean and stand
    15·1 answer
  • Where can formatting features be found ?! Need help asp !‍♀️
    9·1 answer
  • Every time a key is pressed on the keyboard, the _______________ chip in the keyboard notices which key has been pressed.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!