Challenge
Given a positive integer N
that is 28 or above, output a list of numbers summing to N
that uses each digit 1
through 7
exactly once. You can give as a program or function.
The digits can appear by themselves or concatenated, as long as you use each of them once without repeats. For example,[12, 34, 56, 7]
is valid, as is [1, 27, 6, 4, 35]
and [1234, 567]
, but not [123, 34567]
or [3, 2, 1476]
. The order that the numbers are listed does not matter.
If N
cannot be made with 1-7, return or output nothing.
Other information
This is code golf, so the shortest code in bytes by Thursday the 15th of October wins.
Ask any questions in the comments.
Anything I do not specify in the challenge is up to you.
Standard loopholes are disallowed.
Examples
These may clear any confusion up:
Input
28
Output
[1, 2, 3, 4, 5, 6, 7]
Input
100
Output
[56, 7, 4, 31, 2]
Input
1234567
Output
[1234567]
Input
29
Output
Nothing, 29 is invalid.
Input
1891
Output
[1234, 657]
Input
370
Output
[15, 342, 7, 6]
I'll make more if needed.
Here's a pastebin of all of the possible numbers created with these seven numbers, courtesy of FryAmTheEggman.
29
? \$\endgroup\$(N/A)
as the output. \$\endgroup\$[1234566, 1]
is not a valid output, because 6 is repeated. You may not repeat numbers in the output. \$\endgroup\$1, ..,, 7
so that there's at least as many1
's as10
's, at least as many10
's as100
's, and so on. \$\endgroup\$