calculates runs of numbers with square factors