Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

You are given the digits from $1$ to $9$. You can form two numbers by concatenating them, for example, $975123$ and $864$, and then take the product of the two resulting numbers. Find how to maximize the product.

To give you a hint, the answer is $87531\cdot9642$.

share|improve this question

1 Answer 1

You could simply try them all. Since the digits should be listed in decreasing order from left to right, there are only 512 possibilities to check. In Mathematica,

possibilities = Map[FromDigits[Reverse[#]] &,
  {#, Complement[Range[9], #]} & /@ Subsets[Range[9]], {2}];
First[Reverse[SortBy[{#, Times @@ #} & /@ possibilities, Last]]]

{{87531, 9642}, 843973902}

share|improve this answer
    
surely I wanted an analytic solution. :) –  Qiang Li Jan 11 '12 at 22:10
    
Well, the problem looks very Project Euler-ish where the objective is to find a solution using a combination of programming and cleverness. –  Mark McClure Jan 11 '12 at 22:14
    
I agree. But the result looks very informative in the sense that there is some rule here. But I am not sure how to formulate. –  Qiang Li Jan 12 '12 at 1:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.