A073929 a(1) = 1, a(n) = smallest number not included earlier such that the n-th partial sum (n>1) is divisible by n+1.
1, 2, 5, 7, 3, 10, 4, 13, 15, 6, 18, 20, 8, 23, 9, 26, 28, 11, 31, 12, 34, 36, 14, 39, 41, 16, 44, 17, 47, 49, 19, 52, 54, 21, 57, 22, 60, 62, 24, 65, 25, 68, 70, 27, 73, 75, 29, 78, 30, 81, 83, 32, 86, 33, 89, 91, 35, 94, 96, 37, 99, 38, 102, 104, 40, 107, 109, 42, 112, 43
Offset: 1
Keywords
Examples
4 divides 1+2+5, but does not divide 1+2+3 or 1+2+4, so a(3)=5.
Links
- R. J. Cano, Table of n, a(n) for n = 1..10000
Crossrefs
Programs
-
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 *)
-
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
Extensions
Corrected and edited by John W. Layman and Sascha Kurz, Aug 21 2002
Offset corrected by R. J. Cano, May 07 2018
Comments