I am here to tax your mathematical prowess. Notice that 1+1+2 is 4, which 5-1. Notice that 1+1+2+3 is 7, which is 8-1. And 1+1+2+3+5 is 12, which is 13-1. So what do 5, 8, and 13 have in common? They're also three numbers in the sequence. 1+1+2 is 5-1, and 5 is the 2nd number after 2. 1+1+2+3 is 8-1, and 8 is the 2nd number after 3. 1+1+2+3+5 is 13-1, and 13 is the 2nd number after 5. Do you see the pattern?

So I'd like any able mathematicians out there to develop a proof, which states that F[1] + F[2] + ... + F[k] = F[k+2] - 1 for all k > 0.

(So maybe this isn't a Perl quiz, but this problem is directly related to a specific anomoly in Huffman encoding, which is a simple means of compressing files. It turns out that Huffman coding is very inefficient for files whose character frequencies are the Fibonacci sequence.)

(If that last paragraph made no sense, nevermind. Just try the proof. It's fun.)

Suppose F[1]+F[2]+...+F[k] = F[k+2]-1 for some k>0. We can safely assume this since at least for k=1,1+1+2=4=5-1.

We want to show that F[1]+F[2]+...+F[k]+F[k+1] = F[k+3]-1 ie. that the formula still holds. But, F[k+3]-1=F[k+2]+F[k+1]-1 from the definition of Fibonacci numbers. So, F[1]+F[2]+...+F[k]+F[k+1]=F[k+3]-1 becomes F[1]+F[2]+...+F[k]+F[k+1]=F[k+1]+F[k+2]-1 which reduces to F[1]+F[2]+...+F[k]=F[k+2]-1 which by our assumption is true.

So since the truth of the statement for F[k] implies the truth of the statement for F[k+1] and the statement is true for F[1], by mathemagical induction, the statement must be true for all k>0.