Question: how to do this on matlab? 5 Prime Factorization function primefactors - primefactorization (x, divisor, primeFactors) Input Type Description * 1x1 double A n integer

how to do this on matlab?
how to do this on matlab? 5 Prime Factorization function primefactors -
primefactorization (x, divisor, primeFactors) Input Type Description * 1x1 double A n
integer you wish to perform prime factorization on divisor 1x1 double A

5 Prime Factorization function primefactors - primefactorization (x, divisor, primeFactors) Input Type Description * 1x1 double A n integer you wish to perform prime factorization on divisor 1x1 double A possible positive divisor of x primeFactors 1xM double An array of the current M prime factors of x. prime- Factors is empty the first time your function is called. Output Type 3 Description primeFactors 1xN double An array of all N prime factors of x. See details for an example. Details Prime factorization is the process of separating a composite number into its prime factors. You are to write a recursive function that accepts a positive integer x, a test divisor, and an array of the current prime factors. It should then output the prime factors of the integer x. For example, the prime factors of 72 are (2,2,2,3,3). You are required to do the following: 1. Stop the program if invalid inputs are used. 2. Verify that x is a positive integer greater than 1. 3. Verify that divisor is a positive integer in the range (1,2] 4. Perform the prime factorization of x. 5. The elements in your output array should increase from left to right. Tips Remember that I is not a prime number, and the only even prime number is 2. divisor acts similarly to the persistent variable in the primeCheck problem; however, in this case, it is an input of the function. If the recursion is implemented correctly, then primeFactors should already be sorted. You might find the following algorithm and link to be useful. PrimeFactor (N) U LUULISIUNI IU Implemented correctly, then primeFactors should already be sorted. You might find the following algorithm and link to be useful. Prime Factor (N) Input N> 0 2010 Kardi Teknomo Print N Printp

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!