Let a0, a1, a2, ... be an integer sequence defined by:
The sequence starts with 1, 1, 2, 4, 8, 16, 23, 28, 38, 49, ... You are given a106 = 31054319.
Find a1015.