Question: write a function get factors ( ) ( ) that takes a number x and returns a list object. The list object should contain

 write a function get factors()() that takes a number x and returns a list object. The list  
object should contain a vector of unique prime factors of x and the corresponding exponents.
Additionally, write one helper function is prime()() that returns a logical vector depending on
whether or not the elements in x are prime. A good way to test this function should be:
x <<- sample((x =1=1e4,4, size =1)=1)
y <<- get__factors((x))
this__works <<- prod((y$primes^^y$exponents)==)== x & all((is__prime((y$primes))))
It is a necessary, but not sufficient, condition that this works ==== TRUE for your function to work
as intended. ((It will largely depend on if your is prime()() function is correct.))

Step by Step Solution

3.53 Rating (150 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Lets start by creating the isprime function which chec... View full answer

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!