OFFSET
1,2
COMMENTS
a(n) = A002251(n) for 2 < n < 10000. - Georg Fischer, Oct 19 2018
LINKS
R. J. Cano, Table of n, a(n) for n = 1..10000
EXAMPLE
4 divides 1+2+5, but does not divide 1+2+3 or 1+2+4, so a(3)=5.
MAPLE
s := {1}:summe := 1:a[1] := 1:for j from 2 to 1000 do b := (j+1)-(summe mod (j+1)); i := 0:while(true) do if nops(s union {b+i*(j+1)})-nops(s)=1 then break; fi; i := i+1; od:a[j] := b+i*(j+1):s := s union {b+i*(j+1)}:summe := summe+a[j]:od:c := seq(a[k], k=1..1000);
MATHEMATICA
Nest[Append[#, Block[{k = 2}, While[Nand[FreeQ[#, k], Mod[Total@ # + k, Length@ # + 2] == 0], k++]; k]] &, {1}, 69] (* Michael De Vlieger, May 10 2018 *)
PROG
(PARI) vecA073929(n)={my(w=1, s=List(vector(100*n, u, u)), t); for(m=2, n, for(i=m, #s, if(!((w+s[i])%(m+1)), t=s[i]; w+=t; listpop(s, i); listinsert(s, t, m); break))); Vec(s)[1..n]} \\ R. J. Cano, May 07 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Amarnath Murthy, Aug 19 2002
EXTENSIONS
Corrected and edited by John W. Layman and Sascha Kurz, Aug 21 2002
Offset corrected by R. J. Cano, May 07 2018
STATUS
approved