Write a recursive function (using Matlab) moreFactors(a,b,fact) that does the following: 1. Takes as an input 3...

70.2K

Verified Solution

Question

Electrical Engineering

Write a recursive function (using Matlab)moreFactors(a,b,fact) that does the following:
1. Takes as an input 3 positive integers.
2. Of the two integers a and b, the function returns theinteger that has the most factors fact.
3. If both integers a and b have the same amount of factorsfact, the function will return the larger integer.
Test your function with the following:
>> result=moreFactors(24,32,3)
result = 24
(24 = 3^1 · 2^3 , 32 = 2^5 )
>> result=moreFactors(32,24,3)
result = 24
>> result=moreFactors(80,168,2)
result = 80
(80 = 2^4 · 5, 168 = 2^3 · 3 · 7)
>> result=moreFactors(100,50,5)
result = 100
(100 = 2^2 · 5^2 , 50 = 2 · 5^2 )
Note: function must be recursive!

Answer & Explanation Solved by verified expert
3.8 Ratings (481 Votes)
Code for the function is given in the following imageThe results    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students