Count the ways to write 1/n as the sum of two unit fractions - MATLAB Cody - MATLAB Central

Problem 59841. Count the ways to write 1/n as the sum of two unit fractions

Difficulty:Rate
The number 1/2 can be written as 1/3+1/6 and 1/4+1/4, and the number 1/9 can be written as 1/18+1/18, 1/12+1/36, and 1/10+1/90. That is, 1/2 can be written as the sum of two unit fractions (those with a numerator of 1) in two ways, and 1/9 can be written as the sum of two unit fractions in three ways.
Write a function to count the ways 1/n can be written as the sum of two unit fractions.

Solution Stats

76.92% Correct | 23.08% Incorrect
Last Solution submitted on Jul 26, 2024

Problem Comments

Solution Comments

Show comments
R2025a Pre-release highlights
This topic is for discussing highlights to the current R2025a Pre-release.
14
6

Problem Recent Solvers6

Suggested Problems

More from this Author290

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Go to top of page