/* Find sum of sigma(n) where sigma(n) is the sum of the divisors of n. (Very Fast Program) Written by P L Patodia on 09.01.2008 Modifie on 25.06.2008 (There was small bug, however this did not affect the value of A072692) */ A024916(z) = { local(s,u,d,n,a,p); s = z*z; u = sqrtint(z); p = 0; for(d=1, u, n = z\d - z\(d+1); if(n<=1, p=d; break(), a = z%d; s -= (2*a+(n-1)*d)*n/2); ); if(p==0, u=z\(u+1), u=z\p); for(d=2, u, s -= z%d); return(s); } /* A072692 - Sum of sigma(j) for 1<=j<=10^n, where sigma(j) is the sum of the divisors of j. */ A072692(n) = { for(i=1, n, print(i,": ", A024916(10^i))) }