In reply to Rick Wicklin.

Actually I need to get all possible samples (permutations) of size n from a population of size N. For that all possible permutations of n symbols from N symbols are to be generated. But i don't need all permutations as a complete dataset. At the time of permutation generation, for each permutation i need a function of that permutation and that has to be summed up for all the permutations. Actually memory allocation problem arises at the time of permutation generation. The helpful programs shown in all of your blogs writes each permutation to a dataset.
Please help me.
With regards,