Simple math question...

Page 2 - Seeking answers? Join the AnandTech community: where nearly half-a-million members share solutions and discuss the latest tech.

dullard

Elite Member
May 21, 2001
25,479
3,976
126
Hold on everybody. This isn't that simple (even though the title implies simplicity). Why are we assuming:
1) That we are/aren't already in a city.
2) That the cities are point locations.
3) That we travel as the bird flies, and not winding roads.
4) That there is only one route from one specific city to another specific city.
5) That one city is not inside another city.
 

pinion9

Banned
May 5, 2005
1,201
0
0
Originally posted by: InlineFive
LOL

Darn you guys...

To let you in on the joke, we are talking about a set of problems called NP.
This one is actually NP-Hard (non-deterministic polynomial hard).

If you were asked to find the shortest route between the 25 cities instead of the number of permutations, the only way you would be able to find it is by calculating EVERY route and choosing the shortest. That means you would need to calculate the distance of all 15,511,210,043,330,985,984,000,000 routes. There is no formula that will give you the answer.

The reason it is called NP-Hard is because if you tell me an answer, I would also need to calculate every route to confirm that it is the shortest route. There is no way for me to plug in the number into a program and instantly get an answer back if it is the shortest route without calculating all other routes.

Who cares though, right?
 

Goosemaster

Lifer
Apr 10, 2001
48,775
3
81
Originally posted by: pinion9
Originally posted by: InlineFive
LOL

Darn you guys...

To let you in on the joke, we are talking about a set of problems called NP.
This one is actually NP-Hard (non-deterministic polynomial hard).

If you were asked to find the shortest route between the 25 cities instead of the number of permutations, the only way you would be able to find it is by calculating EVERY route and choosing the shortest. That means you would need to calculate the distance of all 15,511,210,043,330,985,984,000,000 routes. There is no formula that will give you the answer.

The reason it is called NP-Hard is because if you tell me an answer, I would also need to calculate every route to confirm that it is the shortest route. There is no way for me to plug in the number into a program and instantly get an answer back if it is the shortest route without calculating all other routes.

Who cares though, right?

To matlab, mathcad, maple, and all our other bit-slaves..



:beer:
 

pinion9

Banned
May 5, 2005
1,201
0
0
Originally posted by: dullard
Hold on everybody. This isn't that simple (even though the title implies simplicity). Why are we assuming:
1) That we are/aren't already in a city.
2) That the cities are point locations.
3) That we travel as the bird flies, and not winding roads.
4) That there is only one route from one specific city to another specific city.
5) That one city is not inside another city.

Yes, we have to assume we start somewhere.

What else would they be besides point locations?

It doesn't matter if the road is windy or straight. He is finding permutations of visitation, not distance.

We are NOT assuming that. We are actually assuming that the graph is completely connected and that ANY city can reach any other city.

Fair assumption. It still wouldn't make a difference because we are not asked about distance.


Please look up the travelling salesman problem.
 

GiLtY

Golden Member
Sep 10, 2000
1,487
1
0
For some reason I was thinking about the travelling salesman problem and was going to say just one possible way. But it seems like the problem is probably not asking for the best overall route, so I would join the others and say 25!

--GiLtY
 

dullard

Elite Member
May 21, 2001
25,479
3,976
126
Originally posted by: pinion9
1) Yes, we have to assume we start somewhere.

2) What else would they be besides point locations?

3) It doesn't matter if the road is windy or straight. He is finding permutations of visitation, not distance.

4) We are NOT assuming that. We are actually assuming that the graph is completely connected and that ANY city can reach any other city.

5) Fair assumption. It still wouldn't make a difference because we are not asked about distance.

Please look up the travelling salesman problem.
Lets simplify the problem. Lets look at 2 cities. How many possible routes are there between the cities?

1) Yes, we have to assume we start somewhere. But the posters here have all seemed to assume we aren't starting in any of the 25 cities. My question is "Why are we assuming that"? This one assumption varies the answer substantially and we should write the "why" down with each answer so that people can understand the answer.

Lets assume we are in city #1 and assume that there is always only one road from our current location to the next. To go from city #1 to #2, there is one route. Thus, the answer is 1.

Lets assume we are out of both cities and assume that there is always only one road from our current location to the next. To get to city #1, there is one road. To get to from city #1 to city #2 there is one road. Or we could go first to city #2 and then to city #1. So there are two possible routes (starting->#1->#2 or starting ->#2->#1). The answer is two.

This one assumption in the most simple case doubles the answer. It is a major assumption.

2) Name one city in the world which is a point location. They all have at least some area under them. Need I go further (it ties in with comment 3 below)?

3) It does matter how the roads are. Don't confuse this question with the travelling salesman question. In real life there aren't just one road from point A to point B. There are long windy roads, and there are short direct roads. In reality, you have a very large (non-infinite, but still probably incomprehendible) number of roads to take from city #1 to city #2. To calculate the possible number of routes, we have to include all roads. Heck, this problem is quite difficult to solve even if you only have two cities. How many possible roads are between LA and NYC? The answer is NOT one road. Thus, how many routes are between LA and NYC. I don't know, but it certainly isn't just 1 possible route.

Of course if we assume we travel as the bird flies, then there is just one road between each city. So while, you might not actually travel straight, the effect is the exact same as if you assumed we travel as the bird flies.

Yes, I do realize calarification of the OP's problem would normally lead to this assumption. But as it is written it can be interpretted differently.

4) This ties in with comment (3).

5) Yes it would make a difference. Suppose city #9 annexed in a strange way as it developed such that it completely surrounds city #4. Now suppose we are in city #4 and want to do this problem. From city #4 we can ONLY travel to city #9. This cuts the possible number of routes down signficantly because we cannot travel from #4 to #25 or any other city but #9.

And to conclude, I think you failed to see my attempt at humor and you turned my post into a serious post.
 

pinion9

Banned
May 5, 2005
1,201
0
0
Originally posted by: dullard
Lets simplify the problem. Lets look at 2 cities. How many possible routes are there between the cities?

1) Yes, we have to assume we start somewhere. But the posters here have all seemed to assume we aren't starting in any of the 25 cities. My question is "Why are we assuming that"? This one assumption varies the answer substantially and we should write the "why" down with each answer so that people can understand the answer.

Lets assume we are in city #1 and assume that there is always only one road from our current location to the next. To go from city #1 to #2, there is one route. Thus, the answer is 1.

Lets assume we are out of both cities and assume that there is always only one road from our current location to the next. To get to city #1, there is one road. To get to from city #1 to city #2 there is one road. Or we could go first to city #2 and then to city #1. So there are two possible routes. The answer is two.

If I am told to visit one city, I generally would not count the city I am in. The assumption is that you are in no city and pick one of the 25 as a starting point. Otherwise it would be 24! and would decrease the answer by a factor of 25.

As for your other responses, I see your point. however, with these problems you can assume simplification. No annexed cities, etc.

At any rate, yes, I thought you were serious. Oh well.
 

dullard

Elite Member
May 21, 2001
25,479
3,976
126
Originally posted by: pinion9
At any rate, yes, I thought you were serious. Oh well.
I just wanted to present an extreme version of this "simple" problem because I often find it hilarious to watch people try to comprehend the extremes.

How many correct ways are there to spell the word that defines common name of this animal? Many people will say there is only one correct answer, "cat". Then I ask "how many languages are there"? And I love to see their expressions.

But I admit I have an odd sense of humor.
 

Goosemaster

Lifer
Apr 10, 2001
48,775
3
81
Originally posted by: pinion9
Originally posted by: dullard
Lets simplify the problem. Lets look at 2 cities. How many possible routes are there between the cities?

1) Yes, we have to assume we start somewhere. But the posters here have all seemed to assume we aren't starting in any of the 25 cities. My question is "Why are we assuming that"? This one assumption varies the answer substantially and we should write the "why" down with each answer so that people can understand the answer.

Lets assume we are in city #1 and assume that there is always only one road from our current location to the next. To go from city #1 to #2, there is one route. Thus, the answer is 1.

Lets assume we are out of both cities and assume that there is always only one road from our current location to the next. To get to city #1, there is one road. To get to from city #1 to city #2 there is one road. Or we could go first to city #2 and then to city #1. So there are two possible routes. The answer is two.

If I am told to visit one city, I generally would not count the city I am in. The assumption is that you are in no city and pick one of the 25 as a starting point. Otherwise it would be 24! and would decrease the answer by a factor of 25.

As for your other responses, I see your point. however, with these problems you can assume simplification. No annexed cities, etc.

At any rate, yes, I thought you were serious. Oh well.




The way I see it, is you get 24! and multiply it by 25 since you have 25 other starting points but the possibilty after hat initial point stays the same
 

cKGunslinger

Lifer
Nov 29, 1999
16,408
57
91
Originally posted by: So
It's a simple question, doctor....would you eat the moon if it was made of ribs?

Bwahahaha!

"I would. Then I'd wash it down with a nice, cool Bud!"
 

pinion9

Banned
May 5, 2005
1,201
0
0
Originally posted by: Goosemaster



The way I see it, is you get 24! and multiply it by 25 since you have 25 other starting points but the possibilty after hat initial point stays the same

Ahhh... so you are saying it is 25*24!
Well, I stand corrected
 

silverpig

Lifer
Jul 29, 2001
27,703
11
81
Originally posted by: InlineFive
Hey all,

I have a math question for you, yes it's a homework problem but I can't figure out the first portion.

There is a person who wants to visit 25 cities but take the shortest route between the cities and only visit each city once. How many possible routes are there?

25x25?

I can't get my brain around this...

Thanks.

This seems like a terrible question. It really depends on the geometry. Let's say for example that 12 of the cities are in California, and 13 are in New York. The 25! answer would include the "shortest route" of going from NY to Cali, then back to NY, then back to Cali... etc, which obviously isn't the shortest route.

So assuming that there is a unique shortest route between the cities, then I would say the answer is 2. One for going from city A -> Y and one for going from city Y -> A.
 

pinion9

Banned
May 5, 2005
1,201
0
0
Originally posted by: silverpig
Originally posted by: InlineFive
Hey all,

I have a math question for you, yes it's a homework problem but I can't figure out the first portion.

There is a person who wants to visit 25 cities but take the shortest route between the cities and only visit each city once. How many possible routes are there?

25x25?

I can't get my brain around this...

Thanks.

This seems like a terrible question. It really depends on the geometry. Let's say for example that 12 of the cities are in California, and 13 are in New York. The 25! answer would include the "shortest route" of going from NY to Cali, then back to NY, then back to Cali... etc, which obviously isn't the shortest route.

So assuming that there is a unique shortest route between the cities, then I would say the answer is 2. One for going from city A -> Y and one for going from city Y -> A.

:roll: Please tell me you aren't serious.

It is a good question because you still have the possibility to travel all routes. Yes, you can use heuristics to come up with better answers (such as visiting all cities in NY first) BUT the fact remains that all other routes do exist.
 

JoeFahey

Platinum Member
Jan 15, 2005
2,163
1
0
Wow, so (!) means that you multiply by the numbers lower than itself to 1? I am still in High School, and have never seen it yet, but thats cool to know. Thanks.
 

Goosemaster

Lifer
Apr 10, 2001
48,775
3
81
Originally posted by: JoeFahey
Wow, so (!) means that you multiply by the numbers lower than itself to 1? I am still in High School, and have never seen it yet, but thats cool to know. Thanks.

yes...the cheaters way of remembering it is that when you finally get an answer after multiplying everything out, all those numbers are factors of that answer
 

Skeeedunt

Platinum Member
Oct 7, 2005
2,777
3
76
Originally posted by: pinion9
Originally posted by: silverpig
Originally posted by: InlineFive
Hey all,

I have a math question for you, yes it's a homework problem but I can't figure out the first portion.

There is a person who wants to visit 25 cities but take the shortest route between the cities and only visit each city once. How many possible routes are there?

25x25?

I can't get my brain around this...

Thanks.

This seems like a terrible question. It really depends on the geometry. Let's say for example that 12 of the cities are in California, and 13 are in New York. The 25! answer would include the "shortest route" of going from NY to Cali, then back to NY, then back to Cali... etc, which obviously isn't the shortest route.

So assuming that there is a unique shortest route between the cities, then I would say the answer is 2. One for going from city A -> Y and one for going from city Y -> A.

:roll: Please tell me you aren't serious.

It is a good question because you still have the possibility to travel all routes. Yes, you can use heuristics to come up with better answers (such as visiting all cities in NY first) BUT the fact remains that all other routes do exist.

I didn't really understand that either... there may be 25! possible routes, but really only 2 where he takes the shortest route between the cities and only visits each city once. Is that part not supposed to relevant to the question?
 

DrPizza

Administrator Elite Member Goat Whisperer
Mar 5, 2001
49,601
166
111
www.slatebrookfarm.com
There is a person who wants to visit 25 cities but take the shortest route between the cities and only visit each city once. How many possible routes are there?

Another way to interpret this is he wants the shortest total trip route... In which case, there'd be 2... one forwards, and one backwards.

Otherwise, did anyone mention
25*24*23*22*. . . *5*4*3*2*1*0!
 

DrPizza

Administrator Elite Member Goat Whisperer
Mar 5, 2001
49,601
166
111
www.slatebrookfarm.com
Originally posted by: Goosemaster
Originally posted by: JoeFahey
Wow, so (!) means that you multiply by the numbers lower than itself to 1? I am still in High School, and have never seen it yet, but thats cool to know. Thanks.

yes...the cheaters way of remembering it is that when you finally get an answer after multiplying everything out, all those numbers are factors of that answer

As long as you went that far... one more step:

Add one to that product and it's a prime number - when you attempt to divide it, you'll always end up with a remainder of 1. This is used (a little more formally) to prove that there are an infinite number of primes. If you want to make a LOT of money (isn't the reward like a million dollars for the proof?), prove the twin primes conjecture: That there are an infinite number of pairs of prime numbers that are 2 apart. (or has it already been proven?)
 

Soccer55

Golden Member
Jul 9, 2000
1,660
4
81
Originally posted by: DrPizza
As long as you went that far... one more step:

Add one to that product and it's a prime number - when you attempt to divide it, you'll always end up with a remainder of 1. This is used (a little more formally) to prove that there are an infinite number of primes. If you want to make a LOT of money (isn't the reward like a million dollars for the proof?), prove the twin primes conjecture: That there are an infinite number of pairs of prime numbers that are 2 apart. (or has it already been proven?)

Are you thinking of the Millennium Problems, DrPizza? Or is there another similar reward out there for solving the Twin Primes Conjecture (which is still an open problem AFAIK)?

-Tom
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |