Thanks
@SMcNeill that s=j*j looks like it is needed in line 14, but I don't know.
I definitely don't know what is going in the first For loops in the main block.
Can anyone explain it?
The 81's are the maximum square for a digit if you have n digits then the maximum sum of them is n * 81 which is allot less than the numbers we run through for the 89 sums. I did start a table that recorded where the sums would go, the did() array (in V2) so we could avoid doing those calculation sequences over and over. But I don't think the FreeBASIC code is doing quite the same thing.