function x=successione(a1,as)
% Sintassi x=successione(a1,as)
% Calcola la successione
% 
%      a(n+1)= 3*a(n)-1 
%
% partendo da a(1)=a1, fino a quando a(n) < as 
%
a(1)=a1;
n=1;
while a(n) < as
    a (n+1) = 3*a(n)-1;  
        n = n+1;
end

x = a;
