[247⋅3667−23]
For (a1,a2,…,an) satisfying the condition of the problem, let us put A0=1 and
S(a1,a2,…,an)=A1+A2+⋯+An.
Lemma 1. For (a1,a2,…,an) which yields the maximum possible value of S(a1,a2,…,an), we must have ai≥ai+1 for each i satisfying 1≤i≤n−1.
Proof of Lemma 1. Suppose there exists a k with 1≤k≤n−1, for which ak<ak+1. Let us define an n-tuple of positive integers (b1,b2,…,bn) by setting
bi=ai if i=k,k+1;bk=ak+1,bk+1=ak.
Since b1+b2+⋯+bn=2008, (b1,b2,…,bn) satisfies the condition of the problem. To prove the Lemma, therefore, it is enough to show that S(a1,a2,…,an)<S(b1,b2,…,bn). Let us put Bi=b1b2…bi for each i. It is clear that Ai=Bi holds for each i=k. We also have
Bk−Ak=(ak+1−ak)Ak−1>0,
and therefore, the Lemma is proved.
Lemma 2. If (a1,a2,…,an) with a1+a2+⋯+an=2008 gives the maximum possible value to S(a1,a2,…,an), then ai≤3 must hold for each i, 1≤i≤n.
Proof of Lemma 2. Suppose there exists a k with 1≤k≤n, for which ak≥4. We may assume that a1≥4 in view of Lemma 1. Let us define an n+1 tuple (c1,c2,…,cn+1) by setting
c1=a1−2;c2=2;ci=ai−1 (for 2<i≤n+1).
Since c1+c2+⋯+cn+1=2008, to prove the Lemma it is enough to show that S(a1,a2,…,an)<S(c1,c2,…,cn+1). Let us set Q=A1A2+A3+⋯+An. Then we have
S(a1,a2,…,an)=a1+Qa1.
We also have
S(c1,c2,…,cn+1)=(a1−2)+2(a1−2)+2Q(a1−2).
From these identities and from the fact that a1≥4 it follows that
S(c1,c2,…,cn+1)=S(a1,a2,…,an)=(2a1−6)+Q(a1−4)>0,
which establishes the claim of the Lemma.
Lemma 3. There exists a combination (n,a1,a2,…,an) giving S(a1,a2,…,an) the maximum value and having the additional property that 1 appears among a1,a2,…,an at most once.
Proof of Lemma 3. Suppose S(a1,a2,…,an) attains the maximum possible value, and suppose there are two or more 1's among a1,a2,…,an. We may assume that an−1=an=1 in view of Lemma 1. Let us define an n−1 tuple (d1,d2,…,dn−1) by
di=ai(i<n−1);dn−1=2.
Then, d1+d2+⋯+dn−1=2008. For each k with 1≤k≤n−1, let Dk=d1d2…dk. We then have Ak=Dk when 1≤k≤n−2. We also have Dn−1=2An−2. Furthermore, from the fact that an−1=an=1 it follows that An−1=An=An−2. Consequently, we have S(a1,a2,…,an)=S(d1,d2,…,dn−1). This shows that if there are two or more 1's among a1,a2,…,an, then we can introduce d1,d2,…,dn−1 to reduce the number of 1's among a1,a2,…,an while keeping the maximality of the value S(a1,a2,…,an). We can reduce the number of 1's further, if necessary, by starting with d1,d2,…,dn−1 and going through the same procedure. Thus, there is a combination (n;a1,a2,…,an) of positive integers which give the maximum value of S(a1,a2,…,an) with the additional property that 1 appears among a1,a2,…,an at most once.
Lemma 4. There exists a combination (n;a1,a2,…,an) of positive integers which gives the maximum value for S(a1,a2,…,an) and for which there are at most three 2's among a1,a2,…,an.
Proof of Lemma 4. Suppose there exists an n tuple a1,a2,…,an which gives the maximum value for S(a1,a2,…,an) and there are 4 or more 2's among a1,a2,…,an. In view of Lemma 1, we may assume that there exists a k with 1≤k≤n−3 such that ak=ak+1=ak+2=ak+3=2. Introduce an n−1 tuple (e1,e2,…,en−1) by defining
ei=ai(i<k);3=ai+k;i=k,k+1;i>k+1.
If k>1 call P=A1+A2+⋯+Ak−1. If k=1, let P=0. Also, if k<n−3 let Q=Ak+3Ak+4+Ak+5+⋯+An, and Q=0 if k=n−3. Then, we have
S(a1,a2,…,an)=P+2Ak−1+4Ak−1+8Ak−1+16Ak−1+16QAk−1.
We also have
S(e1,e2,…,en−1)=P+3Ak−1+9Ak−1+18Ak−1+18QAk−1.
It follows from these identities that we have
S(e1,e2,…,en−1)−S(a1,a2,…,an)=2QAk−1≥0.
Since e1+e2+⋯+en−1=2008, the combination (n−1;e1,e2,⋯,en−1) satisfies the condition of the problem, and since S(a1,a2,⋯,an) has the maximum value, S(e1,e2,⋯,en−1) also takes the maximum value. Therefore, if there are 4 or more 2's among a1,a2,⋯,an, then we can reduce the number of 2's without losing the maximality of the value S(a1,a2,⋯,an). This proves the assertion of this Lemma.
Now going back to the problem, we note that, in view of Lemmas 1, 2, 3, 4, it is enough to check the following 3 cases in order to determine the maximum value of S(a1,a2,⋯,an):
(1)a1=a2=⋯=a669=3,a670=1.
(2)a1=a2=⋯=a667=3,a668=a669=a670=2,a671=1.
(3)a1=a2=⋯=a668=3,a669=a670=2.
Let X=3+32+⋯+3667 and Y=3667. Then
In the case (1): S(a1,a2,⋯,an)=X+3Y+9Y+9Y=X+21Y,
In the case (2): S(a1,a2,⋯,an)=X+2Y+4Y+8Y+8Y=X+22Y,
In the case (3): S(a1,a2,⋯,an)=X+3Y+6Y+12Y=X+21Y,
so that we have the desired maximum value to be X+22Y=247⋅3667−23.