# Simple yet difficult Math question.

by I_am_learning
Tags: difficult, math, simple
 P: 664 How many five digit numbers are there which have first three digits in ascending order and last three digits in descending order? I thought people from all faculty can ponder on this, that is why I placed it in GD rather than Maths forum. Clarifications (Added after 6 replys had been made): 1. Base 10. (Never thought I would have to answer this too!) 2. strictly ascending and strictly descending. 3. No leading 0s allowed. But since this isn't a home-work question It doesn't really much matter what assumptions you take. I just wanted to see how you would approach it. But the assumptions shouldn't make it too easy, like assuming, Base 2, not-strictly ascending, and No leading 0s.
PF Patron
P: 628
 Quote by I_am_learning How many five digit numbers are there which have first three digits in ascending order and last three digits in descending order? I thought people from all faculty can ponder on this, that is why I placed it in GD rather than Maths forum.
I would consider this a combinatorics problem, which would probably fit within the General Math section, or even computer science. I've solved a similar problem before, but the notes are buried at this point; we're moving, again.
 Mentor P: 4,217 I'm assuming by ascending you mean strictly ascending, so 11111 doesn't count. Once you pick a middle digit, you can pick any two digits to come before it, then any two digits to come after it, as long as all four digits picked are smaller than the middle digit. Random caveat that 0 can't be the first digit of a number, so you can't pick a 0 as one of the two digits to come before. So if I pick for the middle digit 0: No way to do this 1: No way to do this 2: No way to do this (because of the 0 starting the number) 3: I have 2 choose 2 ways to pick the starting digits, and 3 choose 2 ways to pick the ending digits, for a total of 3 ways 4: I have 3 choose 2 ways to pick the starting digits, and 4 choose 2 ways to pick the ending digits, for a total of 18 ways Add up all the results through 9 and get some sort of number
PF Patron
P: 726

## Simple yet difficult Math question.

Let's see how easy it could be... I haven't given this any thought and just started typing.

Let's define the five digit number thusly: ##### = abcde (just for ease of typing). So in the number 13542:
• a = 1
• b = 3
• c = 5
• d = 4
• e = 2

Assuming that a leading zero doesn't make for a valid five-digit number, the definition for a is the closed interval between 1 and 7.

a = [1,7]
b = (a,8]
c = (b,9]
d = [1,c)
e = [0,d)

Ugh... you need summation notation to go any further... does someone with decent Latex experience want to carry on with this one?
 PF Patron HW Helper Sci Advisor P: 2,601 I'll make a few assumptions since your question is ambiguous: * we are using decimal digits * leading zeros are OK, e.g. 01210 qualifies * by "ascending" and "descending" you don't mean "strictly", e.g. 11211 qualifies Try constraining the middle digit to a fixed value, and consider how many possibilities are available for the first two digits. If the middle digit is 0, then the first two digits must be 00. If the middle digit is 1, then the first two digits can be 00, 01, or 11. If the middle digit is 2, then the first two digits can be 00, 01, 02, 11, 12, or 22. If the middle digit is 3, then the first two digits can be 00, 01, 02, 03, 11, 12, 13, 22, 23, or 33. In general, if the middle digit is N, then there are 1+2+...+(N+1) possible combinations for the first two digits, and this sum is equal to $$\sum_{k=1}^{N+1} k = \frac{(N+1)(N+2)}{2}$$ Of course the formula for the number of combinations for the last two digits is the same due to the symmetry of the problem. And, given N, the first two digits can be chosen independently of the last two digits. Therefore for a given N, the total number of combinations is $$\left(\frac{(N+1)(N+2)}{2}\right)^2$$ So we can just sum this formula from N=0 to N=9 to get the total number five digits numbers that meet the criteria: $$\sum_{N=0}^{9}\left(\frac{(N+1)(N+2)}{2}\right)^2$$ This sum can be evaluated by multiplying out the numerator and splitting the sum into pieces involving various powers of N. Or, we can be lazy and use Wolfram Alpha to get the answer, which is 7942.
PF Patron
P: 726
 Quote by jbunniii [...] which is 7942.
Which, itself, satisfies the conditions given (if you allow leading zeros).
Mentor
P: 13,654
 Quote by I_am_learning How many five digit numbers are there which have first three digits in ascending order and last three digits in descending order?
What base?
Are leading zeros allowed? Trailing ones? Strict vs non-strict ascending / descending?

 I thought people from all faculty can ponder on this, that is why I placed it in GD rather than Maths forum.
I have an answer but I'm a bit leery to post it as this looks like a homework question in disguise. My answer is different from the above ones, but that's because I made different assumptions on what is / is not allowed.
 P: 218 are trailing zeros allowed ? is the ascending/descending condition strict ? I'm getting this for the different possibilities: strict, no leading 0: 2142 strict, accepting leading 0:2892 not strict, no leading 0: 6237 not strict, accepting leading 0: 7942
 P: 422 1. Base 10 2. strictly ascending and strictly descending. 3. No leading 0s allowed. I only get 7: 12321 23432 34543 45654 56765 67876 78987
 Mentor P: 13,654 bahamagreen, you apparently don't know what "strictly ascending" means. It does not mean consecutive, which is how you took it. The sequence 1,2,2 is an ascending sequence. In an ascending sequence, each element but the last is less than or equal to the following element. The sequences 1,2,3 and 1,2,4 are not only ascending sequences, they are also strictly ascending sequences.
 P: 172 I assume this is supposed to be done by hand? Using a computer this wouldn't be that difficult. That said, I would start by breaking the problem up into: 1. how many ordered pairs (a,b) with a < b (with 0 < a,b < 10) 2. how many ordered pairs (b,a) with b > a (with 0<= a,b < 10) 3. for a given x between 3 and 9, how many pairs from the first set satisfy x > b 4. how many pairs from the second set satisfy x > b 5. the product of 3 and 4 It wasn't difficult to work out by hand that (1) = 8+7+6+5+4+3+2+1 and (2) = 9+8+7+6+5+4+3+2+1. (there are 8 numbers strictly greater than 1, 7 numbers strictly greater than 2, and so on). That's where I would start, but my problem solving approach has been "tainted" by computer science lately. I think (4) should be easy to work out as well. (The number should be (x-1) + (x -2) ... + (x - x)) Edit: here I'm being handwavy with the term "numbers". I think anyone with the intelligence to realize that I haven't been precise should also be smart enough to figure out what I mean.
Mentor
P: 13,654
 Quote by DimReg I assume this is supposed to be done by hand?
Heavens no. This kind of problem is why symbolic math tools were invented. Set things up properly, let the tool do the work, make sure the answer makes sense. (Sometimes they don't make sense, sometimes you don't get an answer. Mathematica et al need a good deal of handholding.)

Now that we've had a clarification from the OP the problem isn't that hard. For a middle digit n≥3, there are (n-2)(n-1)/2 possible strictly ascending sequences for the first three digits (including that middle digit) and (n-1)n/2 strictly descending sequences for the last three digits (once again including the middle digit). These are independent choices, so altogether there are (n-2)(n-1)^2n/2 solutions given that the middle digit is n. Now sum from n=3 to n=9 (or to B-1 to generalize to base B).

Could I do this by hand? Yes. With lots of mistakes along the way. Would I want to? No. I'd make lots of mistakes along the way. Why torture myself when I can do it just as I wrote it with a tool such as Wolfram Alpha?
P: 422
 Quote by D H bahamagreen, you apparently don't know what "strictly ascending" means. It does not mean consecutive, which is how you took it. The sequence 1,2,2 is an ascending sequence. In an ascending sequence, each element but the last is less than or equal to the following element. The sequences 1,2,3 and 1,2,4 are not only ascending sequences, they are also strictly ascending sequences.
You are correct, I didn't know.

So 1, 1, 1, 1, 1, 1 is an ascending sequence; I suppose it a decsending one too?
 P: 97 $$\sum_{m=3}^{9}\frac{(m-1)(m-2)}{2}·\frac{m(m-1)}{2}=2142$$ Took me more to typeset it than to figure it out
P: 172
 Quote by D H Heavens no. This kind of problem is why symbolic math tools were invented. Set things up properly, let the tool do the work, make sure the answer makes sense. (Sometimes they don't make sense, sometimes you don't get an answer. Mathematica et al need a good deal of handholding.) Now that we've had a clarification from the OP the problem isn't that hard. For a middle digit n≥3, there are (n-2)(n-1)/2 possible strictly ascending sequences for the first three digits (including that middle digit) and (n-1)n/2 strictly descending sequences for the last three digits (once again including the middle digit). These are independent choices, so altogether there are (n-2)(n-1)^2n/2 solutions given that the middle digit is n. Now sum from n=3 to n=9 (or to B-1 to generalize to base B). Could I do this by hand? Yes. With lots of mistakes along the way. Would I want to? No. I'd make lots of mistakes along the way. Why torture myself when I can do it just as I wrote it with a tool such as Wolfram Alpha?
I'm trained as a physicist, when I say "by hand" I mean not brute force with a computer. Ie, your second paragraph. I had in mind a brute force computation that would test every 5digit number, and count up the desired solutions. Easy for a computer, and brainless for a programmer.
P: 664
 Quote by D H Heavens no. This kind of problem is why symbolic math tools were invented. Set things up properly, let the tool do the work, make sure the answer makes sense. (Sometimes they don't make sense, sometimes you don't get an answer. Mathematica et al need a good deal of handholding.) Now that we've had a clarification from the OP the problem isn't that hard. For a middle digit n≥3, there are (n-2)(n-1)/2 possible strictly ascending sequences for the first three digits (including that middle digit) and (n-1)n/2 strictly descending sequences for the last three digits (once again including the middle digit). These are independent choices, so altogether there are (n-2)(n-1)^2n/2 solutions given that the middle digit is n. Now sum from n=3 to n=9 (or to B-1 to generalize to base B). Could I do this by hand? Yes. With lots of mistakes along the way. Would I want to? No. I'd make lots of mistakes along the way. Why torture myself when I can do it just as I wrote it with a tool such as Wolfram Alpha?