2(N-1)/N = 2 - 2/N. So one way to get exactly that mean is to make all the numbers 2 except for two of them which are 1.
N < 2 : can't be done. N = 2 : only [1,1] does the job. N = 3 : the sum of the three numbers must be 4, so none of them can be 3, so [1,1,2] [1,2,1] [2,1,1] are the only possibilities. N = 4 : [1,1,1,3] [1,1,2,2] [1,1,3,1] [1,2,1,2] [1,2,2,1] [1,3,1,1] [2,1,1,2] [2,1,2,1] [2,2,1,1] [3,1,1,1] Is there a pattern here? Yes. There must be an integer k such that 0 <= 2k <= N-2 and then you have a rearrangement of (k+2) 1s, (N-2-2k) 2s, and k 3s. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.