There is a simple procedure which applies to these types of problems (and which can be proven with help from the arithmetic-geometric inequality).

For the first part we use the "first large then equal" procedure. This means that are three numbers will be 7**, 8**, and 9**. Now the digits 4,5,6 get distributed so as to make our three number as close to each other as possible, i.e. 76*, 85*, 94*. The same goes for the remaining three digits, and we get 763, 852, 941.

For the second part we use the "first small then different" procedure. Our three numbers will be of the form 1**, 2**, 3**. We now place the three digits so as to make our three numbers as unequal as possible; this gives 14*, 25*, 36*. Finishing, we get 147, 258, 369.

Now, prove that these procedures work for generalizations of this problem.

lib/config.php:156: Notice: Undefined variable: accept

lib/DbaDatabase.php:134: Warning: dba_replace() [<a href='function.dba-replace'>function.dba-replace</a>]: You cannot perform a modification to a database without proper access