The program must return a valid sequence of numbers into some rules
xis the size of the sequence;
xcannot be less than
4or greater than
9(Thanks David Carraher);
- Digits of the sentence can't repeat, each one must appear once;
- All digits between
xmust be in the sequence;
- A valid sequence never begins nor ends with
- Into the sequence, numbers can never appear "together";
1423 not valid, because begins with
23 are "together".
2134 not valid, because ends with
34 are "together".
Still don't get it? Other example:
28375146 valid, because don't start with
x(8), don't end with
x, and no numbers are "together"(no numbers touches, no numbers are the next or previous)
Sorry, I really don't know how to explain the last rule. Hope the example make it understandable.
xdoes not need to be an input, you can show the outputs for
- Since any language will be accepted and, I don't know how all of them work, I will ask you people to help me with this;
- The winner will be the one who got more up-votes in 1 week, so please, vote the answer you find the best; I will mark it as the Correct one;
Good, luck. =)