 ## On the Subject of Simon Stores

This module consists of nine buttons, six of which have the colours: (R)ed, (G)reen, (B)lue, (C)yan, (M)agenta, and (Y)ellow.

These buttons will flash in an increasing sequence, starting with the centre button, in which each flashing colour corresponds to an operator in the tables below.

Apply each operation successively until the end of the sequence and use the result to determine the sequence of coloured buttons to press for each stage.

If at any point an operator yields-

• a value greater than 364, then subtract 365 from the value until it is less than 365.
• a value less than -364, then add 365 to the value until it is greater than -365.

### Section 1: Determining Initial Values

To determine the number to be entered into the sequence of operators, interpret the following pairs of digits in the serial number as two-digit base-36 numbers and take them modulo 365:

• For stage 1, a0 is obtained by using the 3rd and 4th digits.
• For stage 2, b0 is obtained by using the 5th and 6th digits.
• For stage 3, c0 is obtained by using the 1st and 2nd digits.

### Section 2: Operation Tables

In each stage, each color is associated with an operation, expressed here as a function:

• n is the current step of the sequence.
• D is the sum of the individual base-36 digits of the serial number.
Stage 1 Stage 2 Stage 3
R R(x) = x + D R(x) = x + an-1 + n2 R(x) = x + bn-1 - an-1
G G(x) = x - D G(x) = 2x - an-1 G(x) = x - 2bn-1
B B(x) = 2x - D B(x) = 2x - a0 - 4n2 B(x) = x + b0 - a3
C C(x) = D - x - 8n C(x) = x + a1 C(x) = x - bn-1 + an-1
M M(x) = 3n3 - 2x M(x) = x + a2 - D M(x) = x - 2an-1
Y Y(x) = x + D - 6n Y(x) = x + a3 - an-1 Y(x) = x + b4 - a0

#### Single-Colour Flashes

For single-colour flashes, simply apply the function for the colour that flashed: an = F(an-1), bn = F(bn-1), cn = F(cn-1)

#### Two-Colour Flashes

The operators here depend on whether the flashing colours are (P)rimary or (S)econdary with respect to additive colour mixing.
P and S refer to the functions associated with the individual flashing colours.

Stage 1 Stage 2 Stage 3
2P an =
max(P1(an-1), P2(an-1))
bn =
abs(P1(bn-1) - P2(bn-1))
cn =
P3(cn-1) + P3(bn-1) + P3(an-1)
1P, 1S an =
P(an-1) + S(an-1) - 2D
bn =
4D - abs(P(bn-1) - S(bn-1))
cn =
min(P(cn-1), S(cn-1), -abs(P(cn-1) - S(cn-1)))
2S an =
min(S1(an-1), S2(an-1))
bn =
max(S3(bn-1), S3(an-1))
cn =
S3(cn-1) - S1(cn-1) - S2(cn-1)

Note: P3 and S3 refer to the functions corresponding to the respective primary and secondary colours that did not flash at this step of the sequence.

#### Three-Colour Flashes

Stage 1 Stage 2 Stage 3
3P an =
an-1 + a0
bn =
bn-1 + (bn-1 mod 4)b0 - a3
cn =
cn-1 + (cn-1 mod 3)c0 -
(bn-1 mod 3)b0 + (an-1 mod 3)a0
2P, 1S an =
max(P1(an-1),P2(an-1), S(an-1))
bn =
bn-1 + P1(bn-1) +
P2(bn-1) - S(an-1)
cn =
P1(cn-1) + P2(cn-1) - S(bn-1) - S(an-1)
1P, 2S an =
min(S1(an-1),S2(an-1), P(an-1))
bn =
bn-1 + S1(an-1) +
S2(an-1) - P(bn-1)
cn =
S1(cn-1) + S2(cn-1) - P(bn-1) - P(an-1)
3S an =
an-1 - a0
bn =
bn-1 + (b0 mod 4)bn-1 - a3
cn =
cn-1 + (c0 mod 3)cn-1 -
(b0 mod 3)bn-1 + (a0 mod 3)an-1

Note: a4 is equal to zero.

### Section 3: Converting Results

Once a result of the sequence of operations has been obtained, it must be converted into balanced ternary, a base-3 number system in which the digits have the values 1, 0, and -1. Find a sequence of these values such that multiplying them with each power of 3 from 30 = 1 (the “least significant”) to 35 = 243 (the “most significant”), and adding that up, results in the desired number.

### Section 4: Entry and Submission

To work out which buttons need to be pressed, first apply the list of conditions on the positions of buttons on the module to each row of the initial correspondences table, starting from the top of the list and working down.

Initial Correspondences303132333435
Stage 1RGBCMY
Stage 2YBGMCR
Stage 3BMRYGC

 If... ..., then... the top right button is yellow cycle each colour one space to the right. the red button is diametrically opposite the cyan button swap each colour with its complementary (R ↔ C, G ↔ M, B ↔ Y). the green button is adjacent to the white button cycle the primary colours(R → G, G → B, B → R). the magenta button is adjacent to the black button cycle the secondary colours(C → M, M → Y, Y → C). the blue and yellow buttons are on the same side of the module swap B with the colour opposite in the sequence. the red button is on the right side of the module swap R and Y. the blue button is on the left side of the module swap G and C.

Once a balanced ternary number and the buttons corresponding to powers of 3 for the current stage have both been determined, follow the instructions below:

1. Press the centre button. This will cause the sequence to stop flashing and light the white button.
2. Using the coloured buttons, enter the non-zero balanced ternary digits in order of least to most significant:
• Pressing the white and black buttons will toggle which of the two are lit.
• Pressing a coloured button while the white button is lit will enter a ‘+1’ in the corresponding digit.
• Pressing a coloured button while the black button is lit will enter a ‘-1’ in the corresponding digit.
3. Press the centre button again to submit the sequence of inputs.

Submitting the correct sequence of inputs will advance the module to the next stage.

Submitting an incorrect balanced ternary number, or submitting the coloured buttons in the wrong order will result in a strike.