Question: 2 Prime factorization Write a function to find the prime factors of an input number, not 0 . The function should take an integer and

2 Prime factorization
Write a function to find the prime factors of an input number, not 0. The function
should take an integer and output a vector whose entries are the prime factors of the
input. These entries can be repeated ie. if you multiply all the entries you should get the
original number. If the input equals to 0, print an error and output the empty vector [
]. If the input equals to 1, output just the number 1. Do not use the Matlab function
factor() to solve this problem.
Then in the main script, test the function with the following inputs: 256,79,1000,3.
Hint: You may want to reuse the function is_prime from Oct 7 notes to help determine
the output for prime numbers. If you decide to use it, make sure to make a function file
for is_prime and include it with your folder and submission (this will increase the total
of files to be submitted to 5: 4 function files and 1 main script).
Please solve in Mathlab with explanation and comment each line and screetshot of working code plus make it easy to copy.
2 Prime factorization Write a function to find

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 Programming Questions!