login
A266714
Number of k <= n such that (n mod k) is prime.
3
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, 12, 13, 10, 17, 9, 15, 16, 17, 11, 18, 14, 19, 14, 18, 12, 26, 13, 16, 19, 21, 15, 24, 14, 22, 16, 22, 18, 29, 13, 23, 22, 28, 14, 28, 18, 29, 22, 24, 18, 32
OFFSET
1,7
LINKS
EXAMPLE
(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.
MATHEMATICA
t[n_] := Table[Mod[n, k], {k, 1, n}]
p[n_] := Select[t[n], PrimeQ[#] &]
Table[Length[p[n]], {n, 1, 200}]
PROG
(PARI) a(n) = sum(k=2, n, isprime(n % k)); \\ Michel Marcus, Feb 04 2016
CROSSREFS
Sequence in context: A110976 A318271 A236483 * A151570 A341520 A059036
KEYWORD
nonn,easy
AUTHOR
Clark Kimberling, Feb 03 2016
STATUS
approved