Cody

Problem 2369. Tribute to Ramanujan

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

78.95% Correct | 21.05% Incorrect
Last solution submitted on Sep 15, 2016

Problem Comments

Solution Comments

Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!

Join the 15-year community celebration.

Play games and win prizes!

Learn more