On 2025-07-08 22:09, Bill Allombert wrote:
> You should do
> M1(n)=my(s=0);fordiv(n,d,s+=d);s;
>
> But this function is just sigma(n)
>
Ok.
>> ?
>> M2(n)=s=0;for(m=1,n,forpart(v=m,if(v[1]<v[2],for(d=1,n\v[1],r=n-d*v[1];if(r%v[2]==0,s+=d*(r\v[2])))),[1,m],[2,2]));s;
>
> As I understand this function is
> (sigma(n,3)-(2*n-1)*sigma(n))/8
> which is much faster to compute.
>
That does not work:
? M1(n)=sigma(n);
? M2(n)=(sigma(n,3)-(2*n-1)*sigma(n))/8;
? T1(n)=(n^2 - 3^n + 2)*M1(n) - 8*M2(n);
? T1(3)
-72
?
Regards,
Hermann.
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.