Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
After multiple test, I understant why it's work (but sadly not why this solution made that) :
A)
Explanation of what is bin() here https://www.programiz.com/python-programming/methods/built-in/bin
B)
I try to Bin numbers and count difference between Bin's size and Bin's size without 0 :
for i in range(20):
print("{} => {} => {}".format(i, bin(i), len(bin(i)) - len(bin(i).rstrip('0'))))
''' results
0 => 0b0 => 1
1 => 0b1 => 0
2 => 0b10 => 1
3 => 0b11 => 0
4 => 0b100 => 2
5 => 0b101 => 0
6 => 0b110 => 1
7 => 0b111 => 0
8 => 0b1000 => 3
9 => 0b1001 => 0
10 => 0b1010 => 1
11 => 0b1011 => 0
12 => 0b1100 => 2
13 => 0b1101 => 0
14 => 0b1110 => 1
15 => 0b1111 => 0
16 => 0b10000 => 4
17 => 0b10001 => 0
18 => 0b10010 => 1
19 => 0b10011 => 0
C) As you can see in last row, those Bin logic is the same that we want with letters:
you pop the first result for 0 and you got
[0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0]
Same as
[a, b, a, c, a, b, a, d, a, b, a, c, a, b, a, e, a, b, a]
Now why algorithmic logic Bin follows this process ...
I don't know if this sequence is known as that of Fibonacci or Padovan.
This must be related to the very logic of python operation.
With understandable formatting, this gives:
S(1) = "a"
S(2) = S(1) + "b" + S(1) => "a" + "b" + "a" => "aba"
S(3) = S(2) + "c" + S(2) => "aba" + "c" +"aba" => "abacaba"
S(4) => "abacabadabacaba"
...
S(26) = S(25) + "z" + S(25) => ??
abacaba(k) => S(26)[k]
whoa...
This comment is hidden because it contains spoiler information about the solution