Portfolio weights permutations I have a portfolio of 3 securities and I want to generate all possible permutations of securities weights. Single weight spans between 0 and 1.0 with increase of 0.1: (0, 0.1, 0.2, ..., 0.9, 1.0). Sum of all weights has to be equal 1 and all weights have to be nonnegative, for example if first weight is equal to 0.9 then either the second [0.9, 0.1, 0.0] or the third weight has to be 0.1 [0.9, 0.0, 0.1]. 
How can I define a mathematical formula to calculate number of all permutations with repetitions?
Right now to calculate all valid permutations I first generate all permutations and then discard those with sum different than 1 but this approach won't work for portfolios with high number of securities.
 A: Let's begin with your example of three types of securities with weights that are multiples of $0.1$.  If we take $0.1$ as our unit, then we must distribute ten units among the three types of securities.  Let $x_i$ be the number of units of the $i$th security.  Then 
$$x_1 + x_2 + x_3 = 10 \tag{1}$$
is an equation in the nonnegative integers.  
A particular solution of the equation corresponds to the placement of two addition signs in a row of ten ones.  For instance, 
$$1 1 1 1 1 + 1 1 1 + 1 1$$
corresponds to the solution $x_1 = 5$, $x_2 = 3$, $x_3 = 2$ and the weights $0.5$ for the first security, $0.3$ for the second security, and $0.2$ for the third security, while 
$$1 1 1 1 1 1 1 1 + 1 1 +$$
corresponds to the solution $x_1 = 8$, $x_2 = 2$, $x_3 = 0$ and the weights $0.8$ for the first security, $0.2$ for the second security, and $0$ for the third security.  
The number of solutions of equation 1 is the number of ways two addition signs can be placed in a row of ten ones, which is 
$$\binom{10 + 2}{2} = \binom{12}{2}$$
since we must select which two of the twelve positions required for ten ones and two addition signs will be filled with addition signs.
Generalization
Let's say that you instead are selecting $n$ types of securities, with weights that are multiples of $1/k$.  In that case, we take $1/k$ as our unit, so we have a total of $k$ units.  For instance, if $k = 10$, then each unit is $0.1$ as in your example.  If $k = 100$, then each unit is $0.01$.  If we let $x_i$, $1 \leq i \leq n$, be the number of units of the $i$th security, then
$$x_1 + x_2 + x_3 + \cdots + x_n = k \tag{2}$$
is an equation in the nonnegative integers.  A particular solution corresponds to the placement of $n - 1$ addition signs in a row of $k$ ones.  The number of solutions of equation 2 in the nonnegative integers is 
$$\binom{k + n - 1}{n - 1}$$
since we must choose which $n - 1$ of the $n + k - 1$ positions required for $k$ ones and $n - 1$ addition signs will be filled with addition signs.
A: This is a stars and bars problem.  You are looking for solutions to $x+y+z=10$ with each variable an integer in $[0,10]$.  Add $1$ to each so you are solving $x'+y'+z'=13$ with each variable in $[1,11]$.  Now imagine a row of $13$ stars with places for bars between them.  You will place two bars to divide $x'$ from $y'$ from $z'$, so you are selecting two places out of $12$.  There are ${12 \choose 2}=66$ ways to do this
A: Number of ways to write n as a sum of k nonnegative integers.
In the above answer, he is writing n as a sum of k non negative integers.  Thus relating your problem to this, I would assume that you will have to write 10 (=n) as a sum of j (=k) ( where j is the number of securities) non negative integers (0-10).  It has also provided you a site to list all permutations.  Good luck.
Once you get the list remove all permuations where you have 10 and divide rest of all permutations by 10 to give you the desired result.
A: We can consider the equation x + y + z = 10 where x, y and z can take integer values ranging from 0 to 10. We can parallel this problem with the following : in how many ways can we permute 12 objects if 10 objects are the same and the 2 others are also the same. Consider 10 circles and 2 seperators. On the left of seperator 1 we have x circles, in between the 2 seperators we have y circles, and on the right of seperator 2 we have z circles. We therefore have 12!/(10!*2!) Ways of solving this equation. This reasoning can be extended very easily to more complicated versions of the same problem.
