OFFSET
1,3
COMMENTS
From Lei Zhou, Mar 18 2014: (Start)
This is also the number of primes such that the (n+1)-th prime (mod i-th prime) is smaller than the (n+1)-th prime (mod n-th prime) for 1 <= i < n.
Proof: We denote the n-th prime number as P_n. Suppose P_(n+1) mod P_i = k; we can write P_(n+1) = m*P_i + k. Setting l = P_(n+1) - P_n, the composite numbers between P_n and P_(n+1) will be consecutively m*P_i + C, where C = k-l+1, k-l+2, ..., k-1. If k < l, there must be a value at which C equals zero since k-1 > 0 and k-l+1 <= 0, so P_i is a factor of a composite number between P_n and P_(n+1). If k >= l, all C values are greater than zero, thus P_i cannot be a factor of a composite number between P_n and P_(n+1). (End)
LINKS
T. D. Noe, Table of n, a(n) for n = 1..10000
EXAMPLE
n=30, p(30)=113, the next prime is 127. Between them are 13 composites: {114, 115, ..., 126}. Factorizing all and collecting prime factors, the set {2,3,5,7,11,13,17,19,23,29,31,41,59,61} is obtained, consisting of 14 primes, so a(30)=14.
MATHEMATICA
Length[Union[Flatten[Table[Transpose[FactorInteger[n]][[1]], {n, First[#]+ 1, Last[#]-1}]]]]&/@Partition[Prime[Range[100]], 2, 1] (* Harvey P. Dale, Jan 19 2012 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Labos Elemer, Feb 09 2000
STATUS
approved