<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16481" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2><FONT size=2>
<P><BR>Let f(n) be the sum of all permutes of n.</P>
<P>Let</P>
<P>    s(n) = sum of digits of n.<BR>    d(n) = 
number of digits of n.<BR>    c_n(k) = number of occurences of 
digit k in n.<BR>    p(n) = PROD(k = 0..9; 
c_n(k)!).<BR>    r(n) = n-digit rep-1 number = 
(10^n-1)/n.<BR>    t(n) = ((s(n)(d(n)-1)!)/p(n)).</P>
<P>Then f(n) = t(n) r(d(n)).</P>
<P><BR>For example, if n = 314159, we get</P>
<P>    s(n) = 23<BR>    d(n) = 
6<BR>    c_n = (0, 2, 0, 1, 1, 1, 0, 0, 0, 
1)<BR>    p(n) = PROD(k = 0..9; c_n(k)!) = 
2<BR>    r(d(n)) = r(6) = 111111<BR>    t(n) = 
(23*120)/2 = 1380</P>
<P>and</P>
<P>    f(314159) = 1380*11111 = 153333180</P>
<P><BR>A combinatorial argument shows that when we add the permutes of n, the 
same number of each digit will appear in each column of the sum. This means 
that</P>
<P>    f(n) = (sum of each column) * (d(n)-digit rep-1 
number)<BR>         = (sum of each 
column) * r(d(n))</P>
<P>from which we conclude</P>
<P>    t(n) = sum of each column</P>
<P>implying that t(n) is integer and r(d(n)) | f(n).</P>
<P><BR>Using this knowledge, we can explore why f(n) = 29997 is insoluble while 
f(n) = 2997 is not.</P>
<P>Let n have d(n) digits. Then n <= 9 r(d(n)) and has at most d(n)! 
permutes. This means that</P>
<P>    [1] f(n) <= 9 r(d(n)) d(n)!</P>
<P>Suppose f(n) = 29997. We know that r(d(n)) | f(n), and the only rep-1 numbers 
that divide 29997 are r(1) = 1, r(2) = 11 and r(4) = 1111, implying d(n) = 1, 2 
or 4. From [1],</P>
<P>    d(n) = 1  =>  f(n) <= 
9<BR>    d(n) = 2  =>  f(n) <= 
198<BR>    d(n) = 4  =>  f(n) <= 239976</P>
<P>Given f(n) = 29997, we must have d(n) = 4 and r(d(n)) = 1111.</P>
<P>This means that</P>
<P>    t(n) = f(n)/r(d(n)) = 29997/1111 = 27.</P>
<P>so that</P>
<P>    ((s(n)(d(n)-1)!)/p(n)) = 27.</P>
<P>Since d(n) = 4, we have</P>
<P>    6 s(n)/p(n) = 27<BR>    => s(n) = 
9(p(n)/2).</P>
<P>Since p(n) and s(n) are both integer, p(n) must be even to make the right 
side integer. This means 9 | s(n) <= 9 d(n) = 36. This means that s(n) = 9, 
18, 27 or 36.</P>
<P>Suppose s(n) = 9. Then p(n) = 2. By the definition of p(n), p(n) = 2 iff 
exactly one digit appears twice in n and all others once (or not at all). So we 
are looking for a 4-digit n with a single repeated digit and digit sum 9. Many 
such numbers exist, 1008 being the smallest, and indeed f(1008) = 29997.</P>
<P><BR>But now look at f(n) = 2997.  Following similar logic to the above, 
we find that d(n) = 3 and t(n) = 27 giving</P>
<P>    ((s(n)(d(n)-1)!)/p(n)) = 27<BR>    => 2 
s(n)/p(n) = 27<BR>    => s(n) = 27(p(n)/2).</P>
<P>Again, p(n) must be even, so 27 | s(n). But s(n) <= 9 d(n) = 27, so s(n) = 
27 forcing n = 999 and f(n) = 999. Hence f(n) = 2997 is insoluble.</P>
<P> </P>
<P> </P></FONT></FONT></DIV></BODY></HTML>