Probably a simple code-golf challenge. Given 2 positive integers
n, make a list of
n values that are positive integers whose sum is equal to the number
m. Either all values in the output are the same value or the difference is exactly 1.
2, 2, 2
2, 2, 3or
2, 3, 2or
3, 2, 2
n=8would generate an error because the sum of 8 positive integers cannot be 7.
3, 3, 2, 2or any other permutation
- Both input and output is only about positive integers.
- Either all values in the output are the same value or the difference is exactly 1.
- The order of the values in the list is not important.
- The sum of the values in the list is equal to
- When it's not solvable, generate an error or a false value (in case of m=7 and n=8 for example).
- As a result of the other rules
n=3would generate any of the permutations of
3, 3, 2(not
2, 2, 4)
This is code-golf, so the shortest valid answer – measured in bytes – wins.