The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A111201 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

%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

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified April 9 11:03 EDT 2020. Contains 333348 sequences. (Running on oeis4.)