I am having a bit of trouble solving this one. Here is some pseudo code using the 1+2+3=6=3*4/2 principle. Atleast I think but
it keeps getting me the wrong answer.
I guess there is something wrong with my assumption "if the n/2 and n+1 values are co-prime they will have the same number of dividers and you can just multiply them to get the number of dividers for the corresponding triangle number n(n+1)/2 "
Code: Select all
n = 1
while div < 501
val1 = n/2
val2 = n+1
if coprime(val1,val2)
nr = getNumberOfDiv(val1)
div = nr * nr
n++
Triangle number: 258840
Divisors: 576 (24x24)







