%I #6 Feb 06 2016 15:13:52
%S 0,0,0,0,1,1,2,3,2,3,5,4,4,6,6,5,8,7,7,7,7,7,13,7,8,11,13,8,13,10,12,
%T 12,13,10,17,9,15,16,17,11,18,14,19,14,18,12,26,13,16,19,21,15,24,14,
%U 22,16,22,18,29,13,23,22,28,14,28,18,29,22,24,18,32
%N Number of k <= n such that (n mod k) is prime.
%H Clark Kimberling, <a href="/A266714/b266714.txt">Table of n, a(n) for n = 1..1000</a>
%e (11 mod k) gives 0,1,2,3,1,5,4,3,2,1,0, with primes 2,3,5,3,2, so a(11) = 5.
%t t[n_] := Table[Mod[n, k], {k, 1, n}]
%t p[n_] := Select[t[n], PrimeQ[#] &]
%t Table[Length[p[n]], {n, 1, 200}]
%o (PARI) a(n) = sum(k=2, n, isprime(n % k)); \\ _Michel Marcus_, Feb 04 2016
%Y Cf. A266715, A268372.
%K nonn,easy
%O 1,7
%A _Clark Kimberling_, Feb 03 2016
|