Tribute to Ramanujan - MATLAB Cody - MATLAB Central

Problem 2369. Tribute to Ramanujan

Difficulty:Rate

The nth taxicab number, denoted as T(n), is defined as the smallest number that can be expressed as a sum of two positive algebraic cubes in n distinct ways (source: wikipedia).

Example:

           T(1) = 2 = 1^3 + 1^3
           T(2) = 1729 = 1^3 + 12^3 = 9^3 + 10^3

Return the value of n if the given number is a taxicab number. Return 0 if not. If the input is 1729, output would be 2, since 1729 is smallest number that can be expressed as a sum of two cubes in two (n=2) distinct ways.

Avoid look up table solution. Test suit might expand.

Solution Stats

53.13% Correct | 46.88% Incorrect
Last Solution submitted on May 07, 2025

Problem Comments

Solution Comments

Show comments
PIVlab surpasses 100K all-time File Exchange downloads
During the past twelve months, PIVlab, a MATLAB Community Toolbox for particle...
2
4
LLMs with MATLAB updated to support the latest OpenAI Models
Large Languge model with MATLAB, a free add-on that lets you access...
2
4

Problem Recent Solvers32

Suggested Problems

More from this Author44

Problem Tags

Community Treasure Hunt

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

Start Hunting!
Go to top of page