I wish to write a function that accepts two variables n and k, where n>k, and returns vectors composed out of the integer k. The function should return all possible vectors, where k is the largest number in the vector, and all of the elements in the vector sum to n. In short, what I want to accomplish is the following:
n = 10, k = 3
thus the vectors are as follow
(3,1,1,1,1,1,1,1)
(3,2,1,1,1,1,1)
(3,2,2,1,1,1)
(3,2,2,2,1)
(3,3,1,1,1,1)
(3,3,2,1,1)
(3,3,2,2)
(3,3,3,1)