# taxi cab number math

## taxi cab number math

I had a few less than optimal solutions that were O(n^2) type solutions. Problems in Number Theory, 2nd ed.

Pair :(" +i+","+j+")"); However, this property was also known as early as 1657 by F. de Bessy (Berndt and Bhargava 1993, Guy 1994). Oxford, England: Clarendon For each of the taxicab numbers, show the number as well as it's constituent cubes. So 1+1728=1729 Monthly 100, 645-656, 1993. 9, 1196-1203, 2003. https://www.cs.auckland.ac.nz/~cristian/taxicab.pdf. https://pi.lacim.uqam.ca/eng/problem_en.html, A Mathematician's Apology, reprinted with a foreword by C. P. Snow, https://mathworld.wolfram.com/TaxicabNumber.html. An Introduction to the Theory of Numbers, 5th ed. When a particular number is multiplied thrice by itself the answer is called a “cube”, e.g. 53, 778-780, 1957. The distance is positive if you ... A cab driver in New York picks up a passenger at Madison Square Garden and asks to travel to a theater which is four blocks north and two blocks east. It can be found here. 32832 has 2 pairs found Leech (1957) found.

which is associated with a story told about Ramanujan by G. H. Hardy (Hofstadter 1989, Kanigel 1991, Snow 1993). Proc.

Unsolved 1989.

Math.

Internat.

When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.

Not. Since the famous conversation between Hardy and Ramanujan, mathematicians have tried to find other interesting numbers that are the smallest number that can be expressed by the sum of two cubes in three/four/five etc. Gödel, Escher, Bach: An Eternal Golden Braid. He went into the room where Ramanujan was lying. My first solution was a simple double loop, using a hash for the summations to control memory with large inputs.

When a particular number is multiplied by itself the answer is called a “square”, e.g. This page was last changed on 8 August 2020, at 07:03. Obvious answer: segment. 139-144, Taxi-cab numbers, among the most beloved integers in math, trace their origins to 1918 and what seemed like a casual insight by the Indian genius Srinivasa Ramanujan.

Here is a Java Solution:

{ Suppose that there's no bias for any particular blue or green taxi to be involved in such incidents. This gives the resuls below in a few seconds. left figure), as well as the robot character Bender's serial number, as portrayed

Show the 2,000 th taxicab number, and a half dozen more; See also
Here a method to generate the triples more in line with this exercise. break; This script can take up a good amount of memory for large numbers. I hadn’t planned on spending time on this, but it kept nagging at me today, since it looked similar to work I did for Goldbach and additive variable length codes. Had some floating point woes with (expt n 1/3), but once I worked those out it works great. I have to say I enjoy seing the Haskell solutions, as they’re remarkably concise.

Wooley, T. D. "Sums of Two Cubes." ( Log Out /  To this, Ramanujan replied that 1729 was a very interesting number — it was the smallest number expressible as the sum of cubes of two numbers in two different ways. Collection of teaching and learning tools built by Wolfram education experts: dynamic textbook, lesson plans, widgets, interactive Demonstrations, and more. public static void isTaxicabNumber(int inputNumber, int order)

Am. Therefore this version is about 2 times faster compared to a version with a step of 1. Change ), Programming Praxis – Taxicab Numbers « Bonsai Code, http://bonsaicode.wordpress.com/2012/11/09/programming-praxis-taxicab-numbers/, JavaScript, CSS: interview questions | EugeneBichel's Blog.

A taxicab number is the smallest number that can be expressed as the sum of two positive cubes in n distinct ways. Sloane defines a slightly different type of taxicab numbers, namely numbers which are sums of two cubes in two or more ways, the first few of which are 1729, 4104, Sloane, N. J. But also: 9x9x9=729; 10x10x10=1000. A taxicab number is the name given by mathematicians to a series of special numbers: 2, 1729 etc.

Would it work just to plug in cubes instead of primes into a modified find_pairs function?

"The Sixth Taxicab Number Is 24153319581254312065344." Ramanujan: Twelve Lectures on Subjects Suggested by His Life and Work, 3rd ed. N cannot be as large as 10000 on my machine due to MemoryError. }

https://listserv.nodak.edu/cgi-bin/wa.exe?A2=ind0803&L=nmbrthry&T=0&F=&S=&P=1059. al. "Ramanujan Numbers and the Taxicab Problem." Phil.

... (OEIS A011541). The full version is here. 1729 has 2 pairs found It dropped the time for Ta(2)/500k from 11s to 0.02s. }

Indeed it does. When Ramanujan heard that Hardy had come in a taxi he asked him what the number of the taxi was.

Bull.

This time, we are looking for a very special sort of number, a Taxicab […], Here’s my crack at it in Racket: Taxicab numbers. Plouffe, S. "Taxicab Numbers." New York: Cambridge University Press, p. 37, 1993. Weisstein, Eric W. "Taxicab Number." Butler, B. math.

{ It has nothing to do with taxis, but the name comes from a well-known conversation that took place between two famous mathematicians: Godfrey Hardy and Srinivasa Ramanujan. Segmented code Press, 1979. Now it’d be interested to optimize a bit and see how long it takes to calculate Ta(6).

We expect 85 cases to involve blue

A taxi cab company charges \$8.00 per …

Here’s a PHP script that checks all the numbers up to 2000 thus confirming the postulation.

https://pi.lacim.uqam.ca/eng/problem_en.html. Amer. Integer Sequences 2, #99.1.9, 1999.

65728 has 2 pairs found. A.; and Rosenstiel, C. R. "The Four Least Solutions in Distinct Positive Integers of the Diophantine Equation ."
Another example of a cube is 8, because it is 2x2x2. Compute and display the lowest 25 taxicab numbers (in numeric order, and in a human-readable format). ( Log Out /  Let’s remove tabs first for proper formatting: Oops, lines 9 and 10 in my previous comment can be collapsed into one line by using a two-argument version of xrange. My code is much less elegant, but it’s fun to work on. It was also part of the designation of the spaceship Nimbus BP-1729 appearing in What I normally use this for is to find the smallest encoding of a pair for a given arbitrary number. 1x1x1=1; 12x12x12=1728. Godfrey Hardy was a professor of mathematics at Cambridge University. Kanigel, R. The Man Who Knew Infinity: A Life of the Genius Ramanujan. Res.

Extra credit. 40033 has 2 pairs found Here’s one that is supposedly asked at Google: The mathematician G. H. Hardy was on his way to visit his collaborator Srinivasa Ramanujan who was in the hospital.

Given a basis and a target value, _find_pairs returns a list of all the pairs that sum to the value. 143604279 [(111, 522), (359, 460), (408, 423)]

Wilson, D. W. "The Fifth Taxicab Number is 48988659276962496." A taxicab number is the name given by mathematicians to a series of special numbers: 2, 1729 etc. Snow, C. P. Foreword to A Mathematician's Apology, reprinted with a foreword by C. P. Snow Knowledge-based programming for everyone. Berndt, B. C. and Bhargava, S. "Ramanujan--For Lowbrows."

The nth taxicab number Ta(n) is the smallest number representable in n ways as a sum of positive cubes.

Hardy and Wright (Theorem 412, 1979) show that the number of such sums can be made arbitrarily large but, updating Guy (1994) with Wilson's result, the least example is not known for six or more equal sums. https://euler.free.fr/taxicab.htm.

Here they (hopefully) are Appl. The numbers derive their name from the Hardy-Ramanujan number Ta(2) = 1729 (1) = 1^3+12^3 (2) = 9^3+10^3, (3) which is associated with a story told about Ramanujan by G. H. Hardy (Hofstadter 1989, Kanigel 1991, Snow 1993). I have had a lot of fun with this exercise. 46683 has 2 pairs found Hardy had gone out to Putney by taxi, as usual his chosen method of conveyance. Greenwald, S. "Dr. Sarah's Futurama --Mathematics in the Year 3000."

1994. Hardy remarked to Ramanujan that he traveled in a taxi cab with license plate 1729, which seemed a dull number. 8, Hardy remarked to Ramanujan that he traveled in a taxi cab with license plate 1729, which seemed a dull number. Given an arbitrary positive integer, how would you determine if it can be expressed as a sum of two cubes?

Hardy, G. H. Ramanujan: Twelve Lectures on Subjects Suggested by His Life and Work, 3rd ed. Or better yet, Ta(7).

https://www.durangobill.com/Ramanujan.html, https://www.cs.auckland.ac.nz/~cristian/taxicab.pdf, https://www.mathsci.appstate.edu/~sjg/futurama/. Both men were mathematicians and liked to think about numbers. The nice thing about this version is that it is possible to step up with x with a step of 2, as long you make sure that the sum of the triples of x and y are odd (even) if n is odd (even).

This one precomputes cubes and cube roots of interest, but only calls math.pow() once. Mar.

https://www.durangobill.com/Ramanujan.html. break; In this example it works reasonably well for Ta(2), but running it to 500k or more shows it’s obviously slowing down, and it would be a long wait for Ta(3). […] today’s Programming Praxis exercise, our goal is to prove that 1729 is the smallest number that can be […].

It has nothing to do with taxis, but the name comes from a well-known conversation that took place between two famous mathematicians: Godfrey Hardy and Srinivasa Ramanujan.

Monthly 100, 331-340, 1993. This property of 1729 was mentioned by the character Robert the sometimes insane mathematician, played by Anthony Hopkins, in the 2005 film Proof. Change ), You are commenting using your Facebook account. Sci. if (inputNumber == Math.pow(i,3) + Math.pow(j,3)) https://www.mathsci.appstate.edu/~sjg/futurama/. 39312 has 2 pairs found

Still too slow for practically looking for larger values, but far, far faster than what I started out with. 27+8=35, so 35 is the “sum of two cubes” (“. Meyrignac, J. Hardy said that it was just a boring number: 1729. S.; Calude, E.; and Dinneen, M. J. A taxicab number is the smallest number that can be expressed as the sum of two positive cubes in n distinct ways. §D1 in Unsolved System.out.println(inputNumber +" is a Taxicab Number. To this, Ramanujan replied that 1729 was a very interesting number — it was the smallest number expressible as the sum of cubes of two numbers in two different ways. A bit of logic programming in core.logic: (defn cubo [a r] (fresh [a1] (*fd a a a1) (*fd a a1 r))), (defn taxi-cab [n]

There are other numbers that can be shown to be the sum of two cubes in more than one way, but 1729 is the smallest of them.

Guy, R. K. "Sums of Like Powers. Dropping the segment size can make it use much less memory at a little speed expense.

Rosenstiel, E.; Dardis, J. Timing on my system for Ta(2) to 500k is basically the same as the two-liner Pari code on the OEIS page — about 11s.

A. Sequences A001235 and A011541 in "The On-Line Encyclopedia So 729+1000=1729 for (int j = i+1; i inputNumber) So far, the following six taxicab numbers are known (sequence A011541 in the OEIS): From Simple English Wikipedia, the free encyclopedia, Explanation of the Hardy-Ramanujan's number, https://simple.wikipedia.org/w/index.php?title=Taxicab_number&oldid=7059668, Creative Commons Attribution/Share-Alike License.

We haven’t done a coding interview question for a while. Your task is to write a function that returns all the ways a number can be written as the sum of two non-negative cubes; use it to verify the truth of Ramanujan’s statement. 2004; right figure).