Problem 44676. Mean = Standard Deviation
Create a series with following properties;
- All of the members should be positive integer
- Mean of the series should be integer
- Standard deviation of the series should be integer (use a normalization factor of N instead of N-1)
- Mean should be equal to standard deviation
For example if input is 6, you can return the following series;
out = [12 44 2 24 2 6]
mean(out) = 15; std(out,1) = 15;
Another example; if input is 4, a possible solution;
out = [24 2 2 48]; mean(out) = 19; std(out,1) = 19;
Solution Stats
Problem Comments
-
4 Comments
zeros(x,1) is not an acceptable solution. A new assert line added and all solutions are rescored
I was wondering what the one line command was to do this when I saw the scores as low as they were!! Those were before the all(y>0) condition was added.
haha! I was discussed this one with binbin yesterday, he said this one was ill-conditioned, sooner or later will be fixed. We submit a solution anyway, sort of for fun. hope you don't mind it. But if really do that can be tricky indeed. good problem.
I don't agree, bainhome, since all non-negative means m can be represented by sets with k/2 zeros and k/2 2*m numbers for any even k, which would render an infinite number of "ill-conditioned" sets for all m. For mean and std 1: [0 2], [0 0 2 2], [0 0 0 2 2 2], [0 0 0 0 2 2 2 2], ... .For mean and std 2: [0 4], [0 0 4 4], [0 0 0 4 4 4], [0 0 0 0 4 4 4 4], ... And for mean and std 3: [0 6], [0 0 6 6], [0 0 0 6 6 6], [0 0 0 0 6 6 6 6], ... In fact , m=0 is just a particular case.
PS: This is not considered a solution for this problem currently since it doesn't allow using zeros.
Solution Comments
Show commentsProblem Recent Solvers7
Suggested Problems
-
Determine whether a vector is monotonically increasing
20756 Solvers
-
1935 Solvers
-
String substitution, sub problem to cryptoMath
230 Solvers
-
Lychrel Number Test (Inspired by Project Euler Problem 55)
98 Solvers
-
635 Solvers
More from this Author92
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!