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
xenn [34]
3 years ago
7

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. SUBMIT
Computers and Technology
1 answer:
My name is Ann [436]3 years ago
5 0

Answer:

def main():

   # Accept data from the user

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

   k=2;

   sum=0

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

   # This loop runs from k to n

   while k<=n:

       # Call is_prime() method,

       # to check whether k is a prime or not

       sum=sum+is_prime(k)

       k=k+1

   print('Sum of the prime numbers:',sum)

# is_prime() Method

def is_prime(k):

   prime=0        

   i=1

   # Check k is a prime or not

   while i<=int(k):

       # Find the factors of k

       if (k % i) == 0:

           prime=prime+1

       i=i+1

   # If k as two factors

   if(prime==2):        

       print(k)

       return k;

   # If k as more than two factors

   else:        

       return 0;

# Call the main() method

main()

Explanation:

You might be interested in
Select all that apply.
Molodets [167]

The Big Five Factor: neuroticism, extraversion, openness, and conscientiousness.

3 0
3 years ago
Explain why the intangibility of Software System poses special problems for Software Project Management
Murljashka [212]
<span>Intangible system is that system whose services are not visible</span>
4 0
3 years ago
Element primer a partir del qual es generarà l'energia central solar fotovoltaica
Juliette [100K]
No speak a Spanish ............
7 0
3 years ago
In which of the following stages of the development process is a team MOST likely to interview a potential user of an app?
choli [55]

Answer: C. Prototyping

Explanation:

The Prototyping phase of App development involves making a prototype of the app in question and then releasing it to a few potential users so that they can experience the concept of the app and its workability.

The potential user is then interviewed to find out their thoughts on the direction that the app is taking to find out if it is the right one. The prototype will obviously be rudimentary but it is a great opportunity to find out how potential users view the app's concept.

4 0
3 years ago
I am a receptionist for a large corporation what career cluster is this in?
RSB [31]
Business and administration
4 0
3 years ago
Read 2 more answers
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
  • Why ois my printer not printing pictjures?
    9·1 answer
  • If your vehicle catches fire while you are driving, you should:
    5·2 answers
  • Which of the following was one of the first internet search engines? A. archie B. google C. Yahoo D.ask
    7·1 answer
  • Which object waits for and responds toan event from a GUI component?
    9·1 answer
  • Technologies are having a negative impact on businesses.
    8·1 answer
  • hello my friend is doing a give away at 100 followers would you follow him for a chance to win 2000 vbucks his name is ZoVa_Velo
    15·2 answers
  • Tradegy deals with _____
    14·1 answer
  • HELP PLEASE 100 POINTS
    8·2 answers
  • Software licensed as proprietary
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!