# They've Noticed Your Puzzling Prowess

They came to your home in the early hours and whisked you away.
The four by four's windows were completely blacked out but the agents seemed amicable enough, albeit fairly taciturn.

After a while you felt like you would have started to doze had it been an ordinary journey you were making at this hour. At some point you went off road; a short time after you heard the sound of the tyres crunching against gravel and then the sound of an automated door opening then closing; you had arrived.

You were in a large, spotless garage. "Welcome to Base 62, I am I, yes yes I know, pot-luck I can assure you. You are here because you have been selected as a candidate for enlistment; only a very select few see inside these walls", said the immaculately attired middle aged gentleman who met you as the door was opened. "Coffee, tea, orange juice? A croissant or two to apologise for the early start? We like to allow a whole day to allow you to really get your teeth into our entrance test. Follow me and we can get you started".

You are taken to what looks like a normal meeting room - a spread of breakfast delights, juices, hot coffee and tea are all at the ready, and a computer is set up at a desk. "Help yourself to the food and drink, if there is anything else just let S know by poking your head out the door. As soon as you are ready we have set you some maze-based problems to solve, just click a key to wake the computer. They will get harder and may require some of your computing skills, although we never underestimate the ingenuity of the human mind here at Base 62. Let S know when you are done or if you want to leave at any time".

And with that he's gone. You grab a cinnamon Danish*, head to the computer and click a key, intrigued...

[you can click this]

• There are multiple paths to each exit in maze 2 due to a disconnected wall just left of center. Is that intentional? – Deusovi Jul 25 '16 at 10:29
• @Deusovi it is; there are infinite paths from each to each you could take, if you were so inclined. – Jonathan Allan Jul 25 '16 at 10:34
• You are one of the first people on this site that I have seen to prove being Australian :P $\color{darkorange}{\bigstar}$ – Mr Pie Aug 22 '18 at 11:32
• @user477343 :/ I am not Australian. ("Enter the maze at the bottom..."?) – Jonathan Allan Aug 22 '18 at 17:32
• ...oh. Well, the word "favourite" is Australian spelling. Sorry for being a bit presumptuous. But that doesn't mean it's not a great puzzle though, although I didn't have much time to try to complete the puzzle before I commented; I just tried to go through the maze, treating it like any other ordinary maze :) – Mr Pie Aug 22 '18 at 21:50

Solution to Part (Maze) 5

Maze 5 isn't a maze at all. If you take
1111010000111000001000000001010110101001011001010011101110011011111110111001100001011001001001000111101011111011110100110111010110100110100000011100100100100011000111011001110111011000010111010100001100000010100111011010011011001110001001100011100001101100011000101100011111011100101001101110000011011000100110011001101011011001110000101001011100100110011110111
and convert it to decimal notation and then Base62 encode it you get

• No need to do two, but you got it. – Jonathan Allan Oct 4 '16 at 15:55

### Maze 1

Coloring one wall easily gives a solution:

Walking between the green and red walls at all times gives us the way out. On the way we collect UPi5f:

### Maze 2

The maze looks like this:
Here is a diagram of it, along with the colored version:

(solved by ffao)

### Maze 4

I've diagrammed the four mazes' relevant portions. (Black is the end.)

And 2012rcampion has solved the fourth maze!

### ...Maze? 5

1111010000111000001000000001010110101001011001010011101110011011111110111001100001011001001001000111101011111011110100110111010110100110100000011100100100100011000111011001110111011000010111010100001100000010100111011010011011001110001001100011100001101100011000101100011111011100101001101110000011011000100110011001101011011001110000101001011100100110011110111 seems to be all we have. We don't even have a title for this one! It's 361 characters, or 19×19: this means it can be arranged into a square. The obvious way (line by line) doesn't seem to be producing anything meaningful, though...

• ...so much for multicoloured walls and flooring, I thought at least edge detection would be needed first. Starter for 10, done. – Jonathan Allan Jul 25 '16 at 10:32
• @JonathanAllan: Paint.NET's fill bucket tool has a "tolerance" setting, which is incredibly helpful. – Deusovi Jul 25 '16 at 10:36
• Possible solution? (your diagrams were very helpful!) – 2012rcampion Aug 4 '16 at 5:02
• I'll confess, I ignored the uniqueness constraint and just found all possible paths of five letters---14,842 in total---and then wrote a quick script to download them all and check for one with the right filetype and dimensions. – 2012rcampion Aug 4 '16 at 5:10
• @2012rcampion "...you could try them as you find them (what? sacrilege!)" - shame on you ;) Nice work. I would be interested to see your approach (I count 39,192 - or 33,673 if you ignore those of length less than 5). There are only 63 uniquely creatable ones though. – Jonathan Allan Aug 4 '16 at 21:25

## Solution of mazes 2 and 3

### Maze 2

Sounds like you guys need some programming duty! Thanks in huge part to @Anton's huge help in organizing all the paths in a friendly format, I was able to quickly cook a Python script that goes through all possibilities:

import itertools

BASE62 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"

def encode(num, alphabet=BASE62):
"""Encode a positive number in Base X

Arguments:
- num: The number to encode
- alphabet: The alphabet to use for encoding
"""
if num == 0:
return alphabet[0]
arr = []
base = len(alphabet)
while num:
num, rem = divmod(num, base)
arr.append(alphabet[rem])
arr.reverse()
return ''.join(arr)

def isprime(n):
'''check if integer n is a prime'''
# make sure n is a positive integer
n = abs(int(n))
# 0 and 1 are not primes
if n < 2:
return False
# 2 is the only even prime number
if n == 2:
return True
# all other even numbers are not primes
if not n & 1:
return False
# range starts with 3 and only needs to go up the squareroot of n
# for all odd numbers
for x in range(3, int(n**0.5)+1, 2):
if n % x == 0:
return False
return True

def is_twin(x):
return isprime(x) and (isprime(x-2) or isprime(x+2))

poss = \
'''ARLLAAL[ARRA]ALLRAALRLL
ARLLAARLLAALALRAALRLL
ARLLA R LLLRL
ARLLA A L AR R [A AR R] L L LLLRL
ARLLA A R L L [AA L L] AR L LLLRL
ARLLA A L [AR R A] AR L ARRLRLAR
ARLLA A R [L L AA] A ARRLRLAR
RRLRAALR A [R A AR] R L A ARRLA
RRLRAALR R [AA L L] AR A ARRLA
RRLRAALR A [R A AR] R L L LLLRL
RRLRAALR R [AA L L] AR L LLLRL
RRLRAALR A [R A AR] L ARRLRLAR
RRLRAALR R [AA L L] AA A ARRLRLAR
RLRRR L
RLRRR R L [AR R A] AR R L A ARRLA
RLRRR R R [L L AA] L L AR A ARRLA
RLRRR R L [AR R A] AL LRAALRLL
RLRRR R R [AL A L] AA LRAALRLL
RLRRR R L [AR R A] AR L ARRLRLAR
RLRRR R R [L A AL] A ARRLRLAR
LARLRLLA A [A AR R] L A ARRLA
LARLRLLA R [L AA L] L AR A ARRLA
LARLRLLA A [A AR R] A AL LRAALRLL
LARLRLLA R [L AA L] A LRAALRLL
LARLRLLA A [A AR R] L L LLLRL
LARLRLLA R [L AA L] L AR L LLLRL'''

lton = {'L':0, 'A':1, 'R':2}

for x in poss.split('\n'):
for encoding in itertools.permutations(range(3)):
loops = 0
while True:
didloop = loops
ch = 0
s = ''
nums = ''
while ch < len(x):
if x[ch] == ' ':
pass
elif x[ch] == '[':
if didloop == 0: ch = x.index(']')
didloop -= 1
loopstart = ch
elif x[ch] == ']':
ch = loopstart-1
else:
s += x[ch]
nums += str( encoding[ lton[x[ch]] ] )
ch += 1

result = int(nums, 3)
result62 = encode(result)

if len(result62) > 5:
break

if x.find(']') == -1:
break

loops += 1
if is_twin(result):
print 'Found one possibility! ', s, result, result62


Turns out all the code to handle loops was completely unnecessary, as the correct path doesn't loop anyway...

The correct path is the N->W path LARLRLLARALRAALRLL:

If you interpret L as 2, A as 1 and R as 0, this gives the ternary 210202210120112022, decimal 312380531, base-62 L8iRf:

And now we have more mazes at top-left, bottom-left, top-right and bottom-right.

### Maze 3

Mirroring Deusovi's solution of the first two mazes:

We pass through the numbers 476842774, which in base 62 is WGmaU:

The mazes for this part are:

• Nice one, ffao! – Deusovi Jul 26 '16 at 8:26
• Now that was where you were meant to realise that you could colour the walls :) – Jonathan Allan Jul 26 '16 at 13:06
• I wrote a script, got a list of 5370 possible combinations (probably right) that can only be produced with a unique path, but none of them (which neighbors are prime) works. Either I did something wrong, or we don't need all of the combinations. Maybe the word "colour" on a monitor is a hint, and we should take the green-pink-blue-yellow-pink-blue-yellow paths if there are some. – Verence Jul 26 '16 at 14:39
• @Deusovi: not if you consider that you can turn around this time (the other mazes were pretty specific that you couldn't, but this one oddly doesn't say anything). – ffao Jul 26 '16 at 16:09
• @ffao: Ah, didn't even notice that. I'll attempt to update my diagram. – Deusovi Jul 26 '16 at 16:10

Partial answer for maze 2 :

@Deusovi identified the 4 places where we have to choose a direction.

I have enumerated all the possible choices based on the starting and ending positions.

A : ahead, L : left, R : right., [ ] : loop (we can make 0 loop, or many)
turning this into ternary could probably lead to something in base 62.

(S->W) :
A L [R R A] L
A R [L A L] A

(S->E) :
R
A L R R [A R R] L L
A R L L [A L L] R L

(S->N) :
A L [R R A] R L
A R [L L A] A

----------------

(W->S) :
A [R A R] R L A
R [A L L] R A

(W->E) :
A [R A R] R L L
R [A L L] R L

(W->N) :
A [R A R] L
R [A L L] A A

----------------

(E->S) :
L
R L [R R A] R R L A
R R [L L A] L L R A

(E->W) :
R L [R R A] L
R R [L A L] A

(E->N) :
R L [R R A] R L
R R [L A L] A

----------------

(N->S) :
A [A R R] L A
R [L A L] L R A

(N->W) :
A [A R R] A L
R [L A L] A

(N->E) :
A [A R R] L L
R [L A L] L R L

EDIT :

Here are the junction choices during the transitionnal pathways between points
(with the correct initial direction)

S->d : ARLLA
d->S : ARRLA

E->d : RLRRR
d->E : LLLRL

W->a : RRLRAALR
a->W : LRAALRLL

N->b : LARLRLLA
b->N : ARRLRLAR

a->b : (no junction)
b->a : (no junction)

a->c : A
c->a : A

b->c : (no junction)
c->b : (no junction)

c->d : (no junction)
d->c : (no junction)

Here are the complete paths will all turns when going through a junction :

---------------------------------
(S->W) :

S      d c [ a b c ]  a         W
ARLLA A L [AR R A ] AL LRAALRLL

S      d c b [a c b] a         W
ARLLA A R L [LAA L] A LRAALRLL

(S->E) :

S      d      E
ARLLA R LLLRL

S      d c  a b [c  a b] c d      E
ARLLA A L AR R [A AR R] L L LLLRL

S      d c b a [ c b a]  c d      E
ARLLA A R L L [AA L L] AR L LLLRL

(S->N) :

S      d c [ a b c]  a b         N
ARLLA A L [AR R A] AR L ARRLRLAR

S      d c [b a  c] b         N
ARLLA A R [L L AA] A ARRLRLAR

---------------------------------
(W->S) :

W         a [b c  a] b c d      S
RRLRAALR A [R A AR] R L A ARRLA

W         a [ c b a]  c d      S
RRLRAALR R [AA L L] AR A ARRLA

(W->E) :

W         a [b c  a] b c d      E
RRLRAALR A [R A AR] R L L LLLRL

W         a [ c b a]  c d      E
RRLRAALR R [AA L L] AR L LLLRL

(W->N) :

W         a [b c  a] b         N
RRLRAALR A [R A AR] L ARRLRLAR

W         a [ c b a]  c b         N
RRLRAALR R [AA L L] AA A ARRLRLAR

---------------------------------
(E->S) :

E      d      S
RLRRR L ARRLA

E      d c [ a b c]  a b c d      S
RLRRR R L [AR R A] AR R L A ARRLA

E      d c [b a  c] b a  c d      S
RLRRR R R [L L AA] L L AR A ARRLA

(E->W) :

E      d c [ a b c]  a         W
RLRRR R L [AR R A] AL LRAALRLL

E      d c [ a c b]  a         W
RLRRR R R [AL A L] AA LRAALRLL

(E->N) :

E      d c [ a b c]  a b         N
RLRRR R L [AR R A] AR L ARRLRLAR

E      d c [b a  c] b         N
RLRRR R R [L A AL] A ARRLRLAR

---------------------------------
(N->S) :

N         b [c  a b] c d      S
LARLRLLA A [A AR R] L A ARRLA

N         b [a  c b] a  c d      S
LARLRLLA R [L AA L] L AR A ARRLA

(N->W) :

N         b [c  a b] c  a         W
LARLRLLA A [A AR R] A AL LRAALRLL

N         b [a  c b] a         W
LARLRLLA R [L AA L] A LRAALRLL

(N->E) :

N         b [c  a b] c d      E
LARLRLLA A [A AR R] L L LLLRL

N         b [a  c b] a  c d      E
LARLRLLA R [L AA L] L AR L LLLRL



Also :

The result number has to be a twin prime, and given enough data to cover up 5 characters in base 62, we would need around 19 ternary characters (could be less or more based on encoding results) because $3^{18} < 62^5 < 3^{19}$. Thus this requires using the loops multiple times we don't need the loops because there is enough characters in some paths.

• Wait - you didn't count any of the turns on the paths. – Deusovi Jul 25 '16 at 12:54
• good point @Deusovi, that would greatly reduce the amount of possibilities. – Anton Jul 25 '16 at 13:10
• Hmm, in it's current form this will actually yield a couple of twin primes that would fit the bill with $4$ loops E to S or S to E - feel free to look, but there does not seem to be a computer there. (I probably should have checked this case). – Jonathan Allan Jul 25 '16 at 13:48
• In Base 62, you can use 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghjklmnopqrstuvwxyz (that's 62chars) – OldBunny2800 Jul 25 '16 at 19:29