L2 [
        n_]  :=  L2[n]  =   If [n  ≤  5,  
          n * 1.165, 
0.06 (L2[n - 1]  +  
                  3)  +  
0.015 (L2[n - 1]  +  
                  4)  + 
0.025 (L2[n - 1]  +  
                  5)  + 
0.9^5 * (L2[n - 5]  +  
                  2)  + 
 
            0.9*0.06 (L2[n - 2] + 
                  4) + 
0.9*0.015 (L2[n - 2] + 
                  5) + 
0.9*0.025 (L2[n - 2] + 
                  6) + 
 
            0.9^2*0.06 (L2[n - 3] + 
                  5) + 
0.9^2*0.015 (L2[n - 3] + 
                  6) + 
0.9^2*0.025 (L2[n - 3] + 
                  7) + 
 
            0.9^3*0.06 (L2[n - 4] + 
                  6) + 
0.9^3*0.015 (L2[n - 4] + 
                  7) + 
0.9^3*0.025 (L2[n - 4] + 
                  8) + 
 
            0.9^4*0.06 (L2[n - 5] + 
                  7) + 
0.9^4*0.015 (L2[n - 5] + 
                  8) + 
0.9^4*0.025 (L2[n - 5] + 
                  9)]

L2[5]

ListPlot[Table [L2[n]/n,  {n, 1, 500}]]

L2

Share []

<<  huffman-demo-zell-2.m