Question: faster algorithm?

My algorithm counting the number of data points between consequitive positive integers in a list seems to be very slow. I suspect there may be a considerable improvement - please help see how to achieve it. If it can be done faster with zeros only, let it be so. See Thanks.

 

View 7371_CT-slow.mw on MapleNet or Download 7371_CT-slow.mw
View file details

 

Please Wait...