Problem 52769. Easy Sequences 22: Sum of Proper Fractions
Let 'F' be the set of all proper fractions in lowest term, whose denominator is less than or equal 'd'. So, for d = 10, we have:
Note that '2/4' and '3/9' are not included because they are not in their lowest term, while '7/7' and '8/5' are not included because they are not proper fractions.
Write a function 'S(d)', which is the integer part of the sum of 'F(d)'. For the case above, the sum of elements of 'F(10)' is exactly '15.5'. Therefore S(10) = 15.
Solution Stats
Problem Comments
-
2 Comments
David Hill
on 23 Sep 2021
Could not figure out how to speed up my code. Ended up having to use a lookup table to speed it up sufficiently.
Ramon Villamangca
on 28 Sep 2021
Hi,
There is a shortcut using Mobius Inversion...
Solution Comments
Show commentsProblem Recent Solvers8
Suggested Problems
-
Replace NaNs with the number that appears to its left in the row.
3025 Solvers
-
1639 Solvers
-
Getting the indices from a matrix
668 Solvers
-
Find out the Gray Code for a Given Binary Number
106 Solvers
-
Easy Sequences 10: Sum of Cumsums of Fibonacci Sequence
43 Solvers
More from this Author116
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!