function combinations_performance(Emax) 

nu  = [29 35 40	45 55 56 58	59 68 72 74	80 83 85 89	90 93 96 99 101 104 106	109	118	125	130	131	132	137	139	145	148	154	155	170	197];


%while loops
tic
N=length(nu);
erg = [];
temp=zeros(1,N);
E=0;
counter=1;
while E<Emax%1
    while E<Emax
        while E<Emax
            while E<Emax
                while E<Emax
                    while E<Emax
                        while E<Emax
                            while E<Emax
                                while E<Emax
                                    while E<Emax
while E<Emax%11
    while E<Emax
        while E<Emax
            while E<Emax
                while E<Emax
                    while E<Emax
                        while E<Emax
                            while E<Emax
                                while E<Emax
                                    while E<Emax    
while E<Emax%21
    while E<Emax
        while E<Emax
            while E<Emax
                while E<Emax
                    while E<Emax
                        while E<Emax
                            while E<Emax
                                while E<Emax
                                    while E<Emax 
while E<Emax%31
    while E<Emax
        while E<Emax
            while E<Emax        
                while E<Emax           
                    while E<Emax                              
                        erg(counter,1:N)=temp;
                        counter=counter+1;
                        temp(1)=temp(1)+1;               
                        E=sum(temp.*nu);
                    end
                    temp(1)=0;
                    temp(2)=temp(2)+1;
                    E=sum(temp.*nu);
                end
                temp(2)=0;
                temp(3)=temp(3)+1;
                E=sum(temp.*nu);
            end
            temp(3)=0;
            temp(4)=temp(4)+1;
            E=sum(temp.*nu);
        end
        temp(4)=0;
        temp(5)=temp(5)+1;
        E=sum(temp.*nu);       
    end
    temp(5)=0;
    temp(6)=temp(6)+1;
    E=sum(temp.*nu);       
end%31    

    temp(6)=0;
    temp(7)=temp(7)+1;
    E=sum(temp.*nu);       
                                    end

    temp(7)=0;
    temp(8)=temp(8)+1;
    E=sum(temp.*nu);       
                                end
    temp(8)=0;
    temp(9)=temp(9)+1;
    E=sum(temp.*nu);       
                            end
    temp(9)=0;
    temp(10)=temp(10)+1;
    E=sum(temp.*nu);       
                        end
    temp(10)=0;
    temp(11)=temp(11)+1;
    E=sum(temp.*nu);       
                    end
    temp(11)=0;
    temp(12)=temp(12)+1;
    E=sum(temp.*nu);       
                end
    temp(12)=0;
    temp(13)=temp(13)+1;
    E=sum(temp.*nu);       
            end
    temp(13)=0;
    temp(14)=temp(14)+1;
    E=sum(temp.*nu);       
        end
    temp(14)=0;
    temp(15)=temp(15)+1;
    E=sum(temp.*nu);       
    end 
    temp(15)=0;
    temp(16)=temp(16)+1;
    E=sum(temp.*nu);       
end %21
    temp(16)=0;
    temp(17)=temp(17)+1;
    E=sum(temp.*nu);       
                                    end

    temp(17)=0;
    temp(18)=temp(18)+1;
    E=sum(temp.*nu);       
                                end
    temp(18)=0;
    temp(19)=temp(19)+1;
    E=sum(temp.*nu);       
                            end
    temp(19)=0;
    temp(20)=temp(20)+1;
    E=sum(temp.*nu);       
                        end
    temp(20)=0;
    temp(21)=temp(21)+1;
    E=sum(temp.*nu);       
                    end
    temp(21)=0;
    temp(22)=temp(22)+1;
    E=sum(temp.*nu);       
                end
    temp(22)=0;
    temp(23)=temp(23)+1;
    E=sum(temp.*nu);       
            end
    temp(23)=0;
    temp(24)=temp(24)+1;
    E=sum(temp.*nu);       
        end
    temp(24)=0;
    temp(25)=temp(25)+1;
    E=sum(temp.*nu);       
    end
    temp(25)=0;
    temp(26)=temp(26)+1;
    E=sum(temp.*nu);       
end%11
    temp(26)=0;
    temp(27)=temp(27)+1;
    E=sum(temp.*nu);       
                                    end

    temp(27)=0;
    temp(28)=temp(28)+1;
    E=sum(temp.*nu);       
                                end
    temp(28)=0;
    temp(29)=temp(29)+1;
    E=sum(temp.*nu);       
                            end
    temp(29)=0;
    temp(30)=temp(30)+1;
    E=sum(temp.*nu);       
                        end
    temp(30)=0;
    temp(31)=temp(31)+1;
    E=sum(temp.*nu);       
                    end
    temp(31)=0;
    temp(32)=temp(32)+1;
    E=sum(temp.*nu);       
                end
    temp(32)=0;
    temp(33)=temp(33)+1;
    E=sum(temp.*nu);       
            end
    temp(33)=0;
    temp(34)=temp(34)+1;
    E=sum(temp.*nu);       
        end
    temp(34)=0;
    temp(35)=temp(35)+1;
    E=sum(temp.*nu);       
    end
    temp(35)=0;
    temp(36)=temp(36)+1;
    E=sum(temp.*nu);       
end%1
t=toc

%recursive
tic
erg2=combinations(nu,Emax);
t=toc

%keyboard
