Problem 179 - Consecutive Positive Divisors
My first attempts at solving this problem were far too slow - I was finding the number of factors of each number between 1 and Max.
However, by creating a zero array (actually an array of 1s), it was much easier to keep adding one to these values during for loops. Eg, I passed through the array adding 1 for each multiple of 2, then adding 1 for each multiple of 3, then adding 1 for each multiple of 4, etc.
Max = 10**7
n = [1]*Max
for i in range(2, Max):
for j in range(i, Max, i):
n[j] += 1
count = sum(n[i] == n[i+1] for i in range(2, Max-1))
print(count)
Gives an output of 986,262