Question: MATLAB Write code to produce a prime factorization of the number 7418880. A prime factorization contains a set of prime numbers, in increasing order, such

MATLAB

Write code to produce a prime factorization of the number 7418880. A prime factorization contains a set of prime numbers, in increasing order, such that the product of those prime numbers is the desired number (here, 7418880). The MATLAB function factor produces prime factorizations in exactly the format required; DO NOT USE THIS FUNCTION IN YOUR CODE, but feel free to use it to check your work. Your code should be flexible enough to prime-factorize other numbers that are not prime (e.g., replacing 7418880 with 4, whose prime factors are [2 2], or 108, whose prime factors are [2 2 3 3 3]). The function primes produces all prime numbers less than or equal to its input, and could be very helpful for solving this problem. Store your answer as a row vector called pf (2 points).

HINT: To check if a number x divides evenly into another number y, use the conditional y/x==floor(y/x), which returns true only if y/x is a whole number.

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!