[OC] A Game

https://drive.google.com/file/d/18OLhqqc5YQoP2NZUUIlpDj9R17xAzLcL/view

This is a html code for a game. It displays 10 numbers vertically with two buttons on either side of each number- blue and green. If blue button is clicked, The entire sequence from where it is clicked gets reversed. If the green button is clicked, That number is exchanged with the next number. Once the button is clicked, It will disappear. That is, Each button can be clicked exactly once. The goal is to arrange the numbers in ascending order using those buttons. Proving that it is always possible to arrange the numbers in ascending order, is also an interesting question…

Divisor puzzle

Here’s an interesting puzzle that you can do with a pack of cards. Start with the cards 1, 2, …, N, where N is some whole number. If you’re doing this with cards, then you might count the Jack as 11, the Queen as 12, King as 13. Let’s say, for purposes of this example, that N=5, so you start with the Ace, 2, 3, 4 and 5 of diamonds (Ace being 1). The aim of the puzzle is to play all the cards to the table obeying the following rules:

1. The first card played must be the highest card, the 5 of diamonds in this case.
2. Subsequent cards can only be played if they are a divisor of the cumulative total of the cards currently on the table. A divisor is a smaller number that evenly divides a larger number.

In the present example, a valid sequence of plays would be 5 (5), A (6), 2 (8), 4 (12), 3 (15), where I’ve put the cumulative total in brackets afterwards.

It gets progressively harder as N gets larger. Also, for N>13 you tend to run out of cards, so you have to do it in your head! I got up to N=23. How high can you go? Maybe post your solutions below so that we can compare.