# Arrange the digits from 0 to 9 into a number with inequality constraints

Arrange the digits from 0 to 9 into a 10 digit number (abcdefghij) which follow the rule :

• a < b > c < d > e < f > g < h > i < j
• difference between 2 adjacent digits is more than 4

Bonus puzzle :

Change the 2nd rule with :

• The digits follow the pattern : ....,even,odd,even,odd....

Original puzzle:

4938271605
The requirement that each number be >4 difference from the adjacent ones, both of which must be either larger or smaller, suggests a repeating pattern moving down (or up) from beginning to end

Bonus puzzle:

8967452301
It is impossible to put the "even" digits (counting 0 as even, and 1 as odd) in the set b d f h j because the first rule is that these digits must all be greater than their neighbors, and one of the even digits is zero, which is not greater than any of the rest. Similarly, the odds (which include 9) must be in the set of numbers that are greater than their neighbors. Therefore, any solution with alternating odd-even pattern must begin with an even number.

• answer to bonus puzzle is wrong. check again. – Jamal Senjaya Aug 27 '16 at 2:38
• @JamalSenjaya does the first digit need to be odd? or do they just have to alternate? – tmpearce Aug 27 '16 at 2:47
• Odd, even, odd, even, odd, even, odd, even, even, odd – mbjb Aug 27 '16 at 2:50
• @tmpearce your answer is wrong because you put 0 in 9th place which is not odd, and 9 in 10th place which is not even. – Jamal Senjaya Aug 27 '16 at 2:51
• @tmpearce I marked your answer as accepted, because your mistake is in the bonus puzzle. not main puzzle. – Jamal Senjaya Aug 27 '16 at 2:53