login
a(1)=1 then a(n)=a(n-1)+n if n is already in the sequence, a(n)=a(n-1)+n+1 otherwise.
0

%I #3 Mar 30 2012 18:39:24

%S 1,4,8,12,18,25,33,41,51,62,74,86,100,115,131,148,166,184,204,225,247,

%T 270,294,319,344,371,399,428,458,489,521,554,587,622,658,695,733,772,

%U 812,853,894,937,981,1026,1072,1119,1167,1216,1266,1317,1368,1421,1475

%N a(1)=1 then a(n)=a(n-1)+n if n is already in the sequence, a(n)=a(n-1)+n+1 otherwise.

%F a(n)=(1/2)*(n^2+3*n-sqrt(3n)-sqrt(n))+o(n^(1/2))

%e 2 is not in the sequence thus a(2)=a(1)+2+1=4 which is in the sequence thus a(4)=a(3)+4 but 3 is not in the sequence thus a(3)=a(2)+4=8 and a(4)=12

%o (PARI) an=vector(100);a(n)=if(n<0,0,an[n]);an[1]=1; for(n=2,1000,an[n]=if(setsearch(Set(vector(n-1,i,a(i))),n),a(n-1)+n,a(n-1)+n+1))

%K nonn

%O 1,2

%A _Benoit Cloitre_, Oct 24 2005