I fail to see/understand the logic to be applied, especially since there are discrepancies in your examples.
For example, in some screen prints you show it should be:
0101100000000006
for the first one, and in others you show:
0101160000000000
So which one is it? Which do you want?
I think it would be most beneficial if you walked through each of the examples you have posted, and tell us exactly how to get to the final result that you want, as I am not seeing any consistent predictable pattern.