设数列{an}的前n项和为Sn,已知a1=1,且3Sn^2=an(3Sn-1),n大于等于2.