how to create a program that prime number include arraylist , and if not print the prime factors of the number.

Answers

Answer 1
Answer:

Answer:

import math

# Python program for presenting all the prime numbers till an agreed numeral

prime=[]

def findprimeinanarray(n):

   print("Prime numbers admid", 1, "and", n, "are:")

   j=0

   flag=0

   for n in range(1, n + 1):

  # all prime numbers are greater than

      if n > 1:

         for i in range(2, n):

          if (n % i) == 0:

              flag=0

              break

          else:

              flag=1

      if flag==1:

          prime.insert(j,n)

          j=j+1

      else:

          continue

   print(prime[:])        

# A Python function for printing all the prime functions and a Python program to print prime factor

prime1=[]

j=0

# A function to print all the prime factors of a given number if it is not prime

def primeFact(num):

while num % 2==0:

    prime1.insert(2,0)

    num = num/2

 

# num should be odd at this breakpoint

# so we need a shift of 2 ( i = i + 2)

for i in range(3,int(math.sqrt(num))+1,2):

 

 # while i divides num , print i ad divide num

 while num % i== 0:

  num = num /i

 if  num >2:

     j=j+1

     prime1.insert(num,j)

 

 

print(prime1[:])

 

# program to test the coderint

n=600

findprimeinanarray(7)  

k = 45

primeFact(k)

Explanation:

import math

# Python program for presenting all the prime numbers till an agreed numeral

prime=[]

def findprimeinanarray(n):

   print("Prime numbers admid", 1, "and", n, "are:")

   j=0

   flag=0

   for n in range(1, n + 1):

  # all prime numbers are greater than

      if n > 1:

         for i in range(2, n):

          if (n % i) == 0:

              flag=0

              break

          else:

              flag=1

      if flag==1:

          prime.insert(j,n)

          j=j+1

      else:

          continue

   print(prime[:])        

# A Python function for printing all the prime functions and a Python program to print prime factor

prime1=[]

j=0

# A function to print all the prime factors of a given number if it is not prime

def primeFact(num):

while num % 2==0:

    prime1.insert(2,0)

    num = num/2

 

# num should be odd at this breakpoint

# so we need a shift of 2 ( i = i + 2)

for i in range(3,int(math.sqrt(num))+1,2):

 

 # while i divides num , print i ad divide num

 while num % i== 0:

  num = num /i

 if  num >2:

     j=j+1

     prime1.insert(num,j)

 

 


Related Questions

7 features of QBASIC
Give me 3 companies that utilize audio/video technology also give me 3 complete sentences (a research/evidence about that company using audio/video) THANKYOU>>
What is a trend line on a scatter plot? (1 point)Oa visual representation of the relationship between two variablesOa line connecting only the highest and lowest values on a graphO a line connecting all of the data points on a scatter plotany line of data on a graph
Why do we need to use pseudo-language option when we localize application
an online game is played with two dice.explain why decomposition will be used in creating the algorithm for the game

What car is the fastest car in the world? I know what car it is but i'll give you a try

Answers

a labergine I guess I hope
Veyron super sport with a top speed of 267 mph recorded at volkswagen's ehra-lessein test track.

The related Veyron Grand Sport Vitesse is also the worlds fastest open-topped car, with a top speed of 254 mph.


List 10 programs or applications on your computer other than any Microsoft office programs

Answers

Dropbox
Mozilla Firefox, Google Chrome
Gmail, Mozilla Thunderbird
CDburnerXP
Putty, Netflix,
Paint.net, Filezilla

What is the term for an element on a Webpage that contains data and procedures for how that item will react when activated

Answers

Answer:

It is an object.  And this is because an object has the data and procedures that defines how it is going to react when it is going to be activated. The data is the details about the object, and it explains what the object actually is. And the procedures are the details of the functions that the particular objects can perform. Like for a hospital, data can be mentioning list of medication services they provide, and procedure can be like registering for any medication service, the complete process.

Explanation:

The answer is self explanatory.  

How do we call a very small video,that is repeating unlimitedely

Answers

A very small video that is continuous is called a GIF, which stands for Graphics Interchange Format.

 
It's called Gif, after its usual file extenstion. GIF stands for Graphics Interchange Format.

How old do you have to be to get paid to wave at liberty tax in Abilene tx

Answers

There are no age requirements that Liberty Tax Service has. The only restrictions are employment age laws by the government.

Answer:

I don't think there's an age limit for that...

Explanation:

What is Microsoft Word an application used for word-processing, an example of?

Answers

Microsoft word is an example of a graphical word program