id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > quiz2023_12_13_SLHL_taxicab
prev  |  next  |  chance

NOTE: This problem uses ONE of the possible definitions of a taxicab number. There is another definition as well, but use the definition I provide below! In mathematics, the nth taxicab number, typically denoted Ta or Taxicab, is defined as the smallest integer that can be expressed as a sum of two positive integer cubes in n distinct ways. The most famous taxicab number is 1729 = Ta = 1³ + 12³ = 9³ + 10³, also known as the Hardy-Ramanujan number. This number is the n=2 taxicab number because it can be expressed as the sum of two cubes in exactly two different ways. Note that the n=1 taxicab number is quite trivial and is 2 because 1³+1³=2. In fact, the first few taxicab numbers are: 2, 1729, 87539319, 6963472309248, 48988659276962496. Some of these were very difficult to figure out! In fact, it was over 40 years between the discovery that Ta(3)=87539319 and the discovery that Ta(5)=48988659276962496. It has since been discovered that Ta(6)=24153319581254312065344. This is currently the largest known value of a taxicab number, although it has been proven that there is no upper limit to the number of taxicab numbers (we just don't know any past Ta(6)). Write a method that returns a string representing the nth taxicab number for 1<=n<=6. If n<1 return a string that says "not defined". If n>6 return a string that says "unknown". Look at the test data for examples. NOTE: There are many different ways to solve this problem. They are ALL acceptable! You do NOT have to do this a certain way.


quiz2023_12_13_SLHL_taxicab(-5) → "not defined"
quiz2023_12_13_SLHL_taxicab(0) → "not defined"
quiz2023_12_13_SLHL_taxicab(1) → "2"

...Save, Compile, Run (ctrl-enter)

public String quiz2023_12_13_SLHL_taxicab(int n) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 220

Copyright Nick Parlante 2017 - privacy