# Find the pattern with inputs and outputs

I'm trying to solve a challenge where I need to solve a certain pattern first

Below are the inputs and corresponding outputs:

"a" => "0"
"ab" => "1"
"h" => "10
"challenge" => "46150321430225"
"abc" => "40"


Hint is:

"Alpha7"

Who can help detecting the pattern?

[This is not a classical puzzle question, so I don't care about spoiler markup.]

You can get the numbers as follows:

1. Convert the word to a list of numbers according to their 0-base index in the alphabet. For example,

"abc"[0, 1, 2]

2. Treat each element as a base 26 digit and convert to a number:

[0, 1, 2] → 0×26×26 + 1×26 + 2 = 28

3. Now convert that number to a base 7 representation:

28 = 4×7 + 0 = 407

There's one ambiguity: Leading a's will have no impact on the number and hence cannot be recovered when reconverting back to words. The hint Aplha 7 means that you have to convert according to the alphabet first and to base 7 then.

• should the OP really name this a pattern!? – Honey Oct 13 '16 at 19:52