Determine the minimum value of a triangular number T such that the total number of positive divisors of T, including 1 and T, exceeds 500.
list
10 Tr=1:Trn=1
20 loop
30 Tr=Tr+1:Trn=Trn+Tr
40 Dvsrs=fnDivs(Trn)
50 if Dvsrs>=500 then print Tr;Trn;Dvsrs:end
60 endloop
499 end
500 fnDivs(X)
510 local Ds,Ct,Pdr
550 Ds=1:Ct=0:Pdr=0
570 N=X
580 while N>1
590 Dr=prmdiv(N)
600 N=N//Dr
610 if Dr=Pdr then Ct=Ct+1
620 :else Ds=Ds*(Ct+1)
630 :Ct=1
640 Pdr=Dr
650 wend
660 Ds=Ds*(Ct+1)
670 return(Ds)
OK
run
12375 76576500 576
OK
|
Posted by Charlie
on 2009-09-23 00:52:01 |