Def ext12 ():
"""
The number sequence of triangles is constructed by concatenation of natural numbers. Therefore, the seventh triangle number is 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. In this case
The top 10 are:
1, 3, 6, 10, 15, 21, 28, 36, 45, 55...
Below is the approximate number of the first seven triangles we listed:
1: 1
3: 1, 3
6: 1, 2, 3
10: 1, 2, 5, 10
15: 1, 3, 5, 10
21: 1, 3, 7, 21
28: 1, 2, 4, 7, 14, 28
Observe the divisor of the numbers 10, 15, and 28. We can find that the divisor of the last half is equal to the number of the triangle divided by the first half, therefore, we only need to try int (sqrt (n ))
You can. Note that if the number of triangles is exactly the same as the total number of delimiters, only one divisor can be calculated.
"""
Count = 0
N = 1
While count <= 500:
Count = 1
N + = 1
For I in range (1, int (tri (n) x * 0.5) + 1 ):
If not tri (n) % I:
Count + = 2
If int (tri (n) ** 0.5) = tri (n) ** 0.5:
Count-= 1
Print n, tri (n)
Def ext13 ():
From math import sqrt
N = 0
Counter = 0
While counter< = 500:
Counter = 1
N + = 1
For I in range (1, int (sqrt (tri (n) + 1): # Try from 1 to int (sqrt (tri (n )))
If not tri (n) % I:
Counter + = 2
If int (sqrt (tri (n) = sqrt (tri (n )):
Counter-= 1
# Print counter
Print n, tri (n)