MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Given a positive number x, write a MATLAB script that will tell you how many ways that the reciprocal of that number can be written as a sum of two reciprocals of integers. For example, 1/10 can be written as:

- 1/11 + 1/110
- 1/12 + 1/60
- 1/14 + 1/35
- 1/15 + 1/30
- 1/20 + 1/20

The order of the fractions does not matter, so 1/11+1/110 is the same as 1/110+1/11. Therefore, two_fractions(10)=5. You do not need to output the fraction pairs themselves, only the total number of sums. Good luck!

8 correct solutions
13 incorrect solutions

Last solution submitted on Jul 12, 2014

2 players like this problem

1 Comment

Alfonso Nieto-Castanon
on 8 Oct 2013

There might be some general issue with your jailbreaking protections, but in any way if you really want to disallow 'freepass' solutions to your problem simply add at the beginning of your testsuite the lines: try, freepass.disable; end. Hope this helps!

4 Comments