Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Write a function named prime _ factor ( x ) that will find the prime factorization of an integer x . The function will output

Write a function named prime_factor(x) that will find the prime factorization of an integer x. The function
will output a numeric vector. All of the values in the output vector will be prime. The product of the numeric
vector will be the original value x. There should be a check to make sure that the input value is a number
greater than or equal to 2 with no decimal values with appropriate error messages.
If youre stuck on getting started with this, I suggest doing some prime factorizations yourself. For example,
try to find the prime factors of 171 or 364. Note the steps you go through to find these prime factors and
see if you can create code to do it.
You should not need to use the is_prime() function in your prime_factor() function.
(The point of the exercise is to give you practice writing code. Yes, I am aware that solutions to this problem
already exist on the Internet. Dont search for them. While the problem is simple, it is complex enough
that it is incredibly unlikely for students to create identical code solutions. You are free to talk about your
approach and I fully expect many students to take identical approaches, but students writing identical code
is an entirely different matter.)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions