Using fnSigma(N) subroutine, we try to find amicable numbers up to smaller number less than 1010.
10 ' 20 for M=2 to 10^9 30 N=fnSigma(M)-M:if N<=M then 50 40 R=fnSigma(N)-N:if R=M then print M,N 50 next M 60 end 70 fnSigma(N) 80 local W,S,P 90 S=1 100 W=1:P=prmdiv(N) 110 if N@P=0 then W=W*P+1:N=N\P:goto 110 else S=S*W 120 if N>1 then 100 else return(S)
The "if" condition in the line 30 is the rule for omitting perfect numbers.
There are 1427 amicable pairs which smaller number is less than 1010.
previous | index | next |
---|