login
Number of primes between sigma(n) and n.
0

%I #3 Feb 11 2014 19:05:30

%S 0,0,0,1,0,2,0,2,1,3,0,4,0,3,3,4,0,5,0,5,3,3,0,8,1,4,3,7,0,10,0,7,4,5,

%T 4,13,0,5,4,12,0,11,0,9,7,6,0,15,1,9,5,10,0,14,4,14,6,8,0,22,0,6,9,12,

%U 5,16,0,11,5,15,0,24,0,9,9,13,3,18,0,20,8,8,0,25,5,9,7,18,0,27,5,15,7

%N Number of primes between sigma(n) and n.

%e sigma(6) = 12 and there are 2 primes between 6 and 12 (endpoints are excluded), namely 7, 11. Hence a(6) = 2.

%t (*gives number of primes < n*) f[n_] := Module[{r, i}, r = 0; i = 1; While[Prime[i] < n, i++ ]; i - 1]; (*gives number of primes between m and n with endpoints excluded*) g[m_, n_] := Module[{r}, r = f[m] - f[n]; If[PrimeQ[n], r = r - 1]; r]; Table[g[DivisorSigma[1, n], n], {n, 1, 100}]

%K nonn

%O 1,6

%A _Joseph L. Pe_, Sep 24 2002