function r = learning(upper, c, repetitions)
    r=0;
    i=0;
    z = 0+0j; 
    while true
        z = z^2 + c;
        i = i + 1;
        if i > repetitions
            r = 0;
            break
        end
        if abs(z) > upper
            r=i;
            break
        end
    end
end