%I #41 Oct 06 2017 01:03:44
%S 1,0,1,-1,1,-1,1,-1,1,-1,1,-1,1,0,1,-1,1,-1,1,-1,0,-1,1,-1,1,0,1,-1,1,
%T -1,1,-1,0,0,1,-1,1,0,1,-1,1,-1,1,0,-1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,0,
%U -1,1,-1,1,1,1,-1,1,-1,1,-1,1,-1,1,-1,1,1,0,-1,1
%N Signs of differences of number of divisors function: a(n) = sign(d(n)-d(n-1)), cf. A000005.
%C d(n) (A000005) has offset 1, being an arithmetic function, so this sequence has offset 2.
%C Erdős proves that a(n) = 1 with natural density 1/2 and a(n) = -1 with natural density 1/2. Heath-Brown proved that a(n) = 0 infinitely often; see A005237 for details. - _Charles R Greathouse IV_, Oct 20 2013
%H N. J. A. Sloane, <a href="/A182394/b182394.txt">Table of n, a(n) for n = 2..20000</a>
%H P. Erdős, <a href="http://www.renyi.hu/~p_erdos/1936-03.pdf">On a problem of Chowla and some related problems</a>, Proc. Cambridge Philos. Soc. 32 (1936), pp. 530-540.
%H D. R. Heath-Brown, <a href="http://dx.doi.org/10.1112/S0025579300010743">The divisor function at consecutive integers</a>, Mathematika 31 (1984), pp. 141-149.
%F a(n) = 1 if d(n) > d(n - 1) and a(n) = -1 if d(n) < d(n - 1), otherwise a(n) = 0 if d(n) = d(n - 1), where d(n) is the number of divisors of n (A000005).
%e The initial values d(1) ... d(20) are
%e 1, 2, 2, 3, 2, 4, 2, 4, 3, 4, 2, 6, 2, 4, 4, 5, 2, 6, 2, 6, ...
%e and the first differences are
%e 1, 0, 1, -1, 2, -2, 2, -1, 1, -2, 4, -4, 2, 0, 1, -3, 4, -4, 4, ...,
%e the signs of which are +1, 0, +1, -1, ...
%t Sign[Differences[DivisorSigma[0, Range[2..100]]]] (* _T. D. Noe_, Apr 27 2012, amended by _N. J. A. Sloane_, Oct 05 2017 *)
%o (PARI) a(n)=sign(numdiv(n)-numdiv(n-1)) \\ _Charles R Greathouse IV_, Oct 20 2013
%Y Cf. A000005, A051950, A175150 (accumulated sums).
%K sign,easy
%O 2
%A _Giovanni Teofilatto_, Apr 27 2012
%E Edited by _N. J. A. Sloane_, Oct 05 2017