login
Number of k <= floor(n/2) such that (n mod k) is prime.
3

%I #13 Feb 11 2016 08:09:31

%S 0,0,0,0,0,0,0,1,0,1,2,1,1,3,2,1,4,3,3,3,3,3,8,2,3,6,7,2,7,4,6,6,7,4,

%T 10,2,8,9,9,3,10,6,11,6,10,4,17,4,7,10,12,6,15,5,13,7,13,9,19,3,13,12,

%U 17,3,17,7,18,11,13,7,21,7,17,12,20,4,23,6

%N Number of k <= floor(n/2) such that (n mod k) is prime.

%H Clark Kimberling, <a href="/A266715/b266715.txt">Table of n, a(n) for n = 1..1000</a>

%e (11 mod k) gives 0,1,2,3,1, with primes 2,3, so a(11) = 2.

%t t[n_] := Table[Mod[n, k], {k, 1, Floor[n/2]}]

%t p[n_] := Select[t[n], PrimeQ[#] &]

%t Table[Length[p[n]], {n, 1, 200}]

%o (PARI) a(n) = sum(k=1, n\2, isprime(n % k)); \\ _Michel Marcus_, Feb 04 2016

%Y Cf. A266714, A268372.

%K nonn,easy

%O 1,11

%A _Clark Kimberling_, Feb 03 2016