%I
%S 1,3,5,9,13,18,25,33,41,51,61,72,85,99,113,128,145,163,181,200,221,
%T 243,265,288,313,339,365,393,421,450,481,513,545,578,613,649,685,722,
%U 761,801,841,882,925,969,1013,1058,1105,1153,1201,1250,1301,1353,1405
%N Average of the nth group, if positive integers are rearranged in groups of k=1,2,3,... numbers whose sum is a multiple of k.
%C The lexicographically earliest possibility satisfying the requirement is to be considered. This practically means that the kth group consists of the k1 smallest numbers not yet used, followed the next smallest unused number which completes their sum to a multiple of k.  _M. F. Hasler_, May 07 2010
%C Original definition (The given example seems wrong from "23" on. [Z. Seidov & MFH]): Rearrange the natural numbers in groups so that the nth group contains n terms and the sum is a multiple of n: (1), (2, 4), (3, 5, 7), (6, 8, 9, 13), (10, 11, 12, 14, 23), (15, 16, 17, 18, 19, 29), (20, 21, 22, 24, 25, 26, 30), (27, 28, 31, 32, 33, 34, 35, 36), ... Sequence gives sum of the terms/ n for the nth group (the average of the group).
%C In the kth group the first (k1) terms are partly all the numbers not included earlier followed by numbers in increasing order and then the kth term is chosen so that the sum is a multiple of k.
%e From _M. F. Hasler_, May 07 2010: (Start)
%e Below the groups are given inside /*...*/, followed by the average a(n):
%e /*[1]*/ 1,
%e /*[2, 4]*/ 3,
%e /*[3, 5, 7]*/ 5,
%e /*[6, 8, 9, 13]*/ 9,
%e /*[10, 11, 12, 14, 18]*/ 13,
%e /*[15, 16, 17, 19, 20, 21]*/ 18,
%e /*[22,23, 24, 25, 26, 27, 28]*/ 25,
%e /*[29, 30, 31, 32, 33, 34, 35, 40]*/ 33,
%e /*[36, 37, 38, 39, 41, 42, 43, 44, 49]*/ 41,
%e /*[45, 46, 47, 48, 50, 51, 52, 53, 54, 64]*/ 51,
%e /*[55, 56, 57, 58, 59, 60, 61, 62, 63, 65, 75]*/ 61,
%e /*[66, 67, 68, 69, 70, 71, 72, 73, 74, 76, 77, 81]*/ 72, ... (End)
%o (PARI) {v=vector(10000); print1(v[1]=1); for(n=2,80, s=0;i=1; for(k=1,n1, while(v[i],i++); s+=i; v[i]=1); i=ceil(s/n)*ns; while(! iv[i], i+=n); s+=i; v[i]=1; print1(","s/n))}
%o (PARI)
%o /* Removing the code involving "show" considerably speeds up the computation */
%o A074133(n,show=0 /* 1:print terms 1..n, 2:print all groups */)={
%o my(t, u=0, lu=1 /* least unused */); for(k=1, n, my(v=[]); s=sum( i=1,k1,
%o t=lu; while(bittest(u,t), t++); show>1 & v=concat(v,t); u+=1<<t;
%o t==lu & while( bittest(u,lu++),); t); forstep(n=max(lu1,s)\k*k+k,1e9,k,
%o bittest(u,ns) & next; u+=1<<(ns); show>1 & print1("/*"concat(v,ns)"*/ ");
%o t=n/k; show & print1(t,", "); break));t} \\ _M. F. Hasler_, May 07 2010
%Y Cf. A074132, A074134, A074135.
%K nonn
%O 1,2
%A _Amarnath Murthy_, Aug 27 2002
%E Corrected and extended by _Ralf Stephan_, Mar 26 2003
%E Edited by _M. F. Hasler_, May 09 2010
