Melbourne University Mathematics and Statistics Society

Solution for 3.2 Accrual (Answer = TROPHY)

The script is a variant of the number guessing trick that utilises binary representations to identify a nominated number. In the regular trick, the number is identified by adding 16, 8, 4, 2, and/or 1 together depending on whether the number appears in the appropriate list.

In this variant, the numbers is identified by adding 20, 18, 15, 16 and/or 8 depending on whether the number appears in the appropriate list (as identified from the URL querystring), then adding 25 and taking modulo 32. This sequence {20, 18, 15, 16, 8} & 25 equates to the answer TROPHY.

Alternatively, the pseudocode for accrual.php can be backward engineered to be:

if first  bit is 'Y' add 20 (mod 32)
if second bit is 'Y' add 18 (mod 32)
if third  bit is 'Y' add 15 (mod 32)
if fourth bit is 'Y' add 16 (mod 32)
if fifth  bit is 'Y' add 8 (mod 32)
add 25 (mod 32)
return result