You are viewing a single comment's thread. Return to all comments →
import math def divisors(n): divs = [1] for i in xrange(2,int(math.sqrt(n))+1): if n%i == 0: divs.extend([i,n/i]) divs.extend([n]) return list(set(divs)) n = input() a = [] for i in range(n): count = 0 a.append(input()) adict = {} for j in range(a[i]): k = j+1 adict[k] = divisors(k) for m in adict: if m!=len(adict): if len(adict[m])==len(adict[m+1]): count = count+1 print count
I am getting time out error for this, I think I am runnig out of space, can anyone suggest for an alternative in python
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #179: Consecutive positive divisors
You are viewing a single comment's thread. Return to all comments →
I am getting time out error for this, I think I am runnig out of space, can anyone suggest for an alternative in python