%I #12 May 27 2016 14:27:36
%S 0,0,1,0,2,1,3,2,1,3,1,2,3,2,1,1,3,2,4,3,1,4,3,3,2,5,4,7,6,2,2,2,7,2,
%T 5,2,1,2,3,1,3,3,7,6,7,2,1,2,8,7,1,3,5,4,1,1,3,2,6,5,5,3,2,3,2,2,4,2,
%U 7,6,1,6,2,1,6,3,2,2,2,5,3,2,7,3,6,3,6,2,7,6,5,2,6,5,10,3,2,3,2,2,2,3,1,9,2
%N a(n) = number of k's such that prime(n+1) = prime(n) + (prime(n) mod k).
%H Harvey P. Dale, <a href="/A118123/b118123.txt">Table of n, a(n) for n = 1..1000</a>
%F a(n) = # { k>0 | prime(n+1) - prime(n) = prime(n) % k }, where p % k is the remainder of p divided by k.
%t f[n_] := If[n == 1, 0, Block[{p = Prime@n, np = Prime[n + 1]}, Length@Select[Divisors[2p - np], # >= np - p &]]]; Array[f, 105]
%t nk[n_]:=Count[Mod[n,Range[n-1]],_?(#==NextPrime[n]-n&)]; nk/@Prime[ Range[ 110]] (* _Harvey P. Dale_, May 27 2016 *)
%o (PARI) A118123(n)={my(d=prime(n+1)-n=prime(n)); sumdiv(n-d,k,k>d)}
%Y Cf. A117078, A117563.
%K nonn
%O 1,5
%A _RĂ©mi Eismann_ and _Robert G. Wilson v_, May 12 2006
%E Edited by _M. F. Hasler_, Nov 07 2009