Not yet I'm afraid. Sorry for the delay, I have been exploring a different approach. I created the new program you designed and it was not giving the correct results; I tried fiddling with it for several hours but I couldn't get it to give the right results. Might you be able to suggest some adjustments?
See attached for the program you wrote (I have pasted the results for all S[i] for d=6, d=8 and d=10). Here are the desired results:
d | Desired result
I also tried, as you suggested, setting k<=(d-6)/2 instead of k<=(d-8)/2, but this gives results that are too great, (e.g. when d=8, S ends at 4640).
What do you think?