A112647 a(n)=x is the smallest solution to abs(sigma(x+1)-sigma(x))=n, or 0 if no solution exists.
14, 2, 1, 3, 6, 9, 5, 7, 62
Offset: 0
Examples
n=5: least solution is 9 because sigma for 9 and 9+1=10 are 13 and 13+5=18.
Programs
-
MATLAB
N = 2*10^8; % to search sigma(n) for n <= N M = 100; % to get a(1) to a(M) Sigma = ones(1,N); for n=2:N inds = [n:n:N]; Sigma(inds) = Sigma(inds) + n; end DSigma = abs(Sigma(2:end) - Sigma(1:end-1)); A = zeros(1,M); for v = 1:M r = find(DSigma == v,1,'first'); if numel(r) > 0 A(v) = r; end end A % Robert Israel, May 24 2016
-
Mathematica
f[x_] :=Abs[DivisorSigma[1, n+1] - DivisorSigma[1, n]]; t=Table[0, {258}]; Do[s=f[n]; If[s<258 && t[[s+1]]==0, t[[s+1]]=n], {n, 10^7}]; t (* edited by Giovanni Resta, Oct 29 2019 *)
Extensions
Entry revised by N. J. A. Sloane, May 25 2016
a(0) prepended by Giovanni Resta, Oct 29 2019
Comments