We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c3b8c51 commit e5f130cCopy full SHA for e5f130c
project_euler/problem_12/sol2.py
@@ -0,0 +1,8 @@
1
+def triangle_number_generator():
2
+ for n in range(1,1000000):
3
+ yield n*(n+1)//2
4
+
5
+def count_divisors(n):
6
+ return sum([2 for i in range(1,int(n**0.5)+1) if n%i==0 and i*i != n])
7
8
+print(next(i for i in triangle_number_generator() if count_divisors(i) > 500))
0 commit comments