login
A329308
a(n) is the number of k with 1 < k < sqrt(n) such that n mod k^2 is prime.
3
0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 2, 1, 0, 2, 1, 1, 0, 2, 2, 1, 2, 1, 3, 0, 1, 1, 3, 1, 2, 3, 1, 2, 0, 3, 2, 1, 1, 4, 4, 0, 2, 2, 4, 1, 1, 1, 3, 2, 1, 3, 3, 3, 3, 2, 4, 2, 2, 1, 4, 1, 3, 2, 2, 0, 2, 5, 5, 2, 3, 2, 3, 1, 1, 3, 5, 0, 5, 3, 3, 2, 1, 3, 6, 2, 2, 5, 3, 3, 1, 2, 3, 4, 3, 3, 4, 1, 1, 4, 2
OFFSET
1,11
LINKS
EXAMPLE
a(11) = 2 because 11 == 3 (mod 2^2) and 11 == 2 (mod 3^2), and 2 and 3 are prime.
MAPLE
f:= proc(n) local k; nops(select(isprime, [seq(n mod k^2, k=2..floor(sqrt(n)))])) end proc:
map(f, [$1..100]);
MATHEMATICA
a[n_] := Select[Range[2, Sqrt[n] // Floor], PrimeQ[Mod[n, #^2]]&] // Length;
Array[a, 100] (* Jean-François Alcover, Jul 17 2020 *)
PROG
(Magma) a:=[]; for n in [1..100] do Append(~a, #[k:k in [2..Floor(Sqrt(n))]| IsPrime(n mod k^2) ]); end for; a; // Marius A. Burtea, Nov 11 2019
(PARI) a(n) = sum(j=2, sqrtint(n), isprime(n % j^2)); \\ Michel Marcus, Nov 11 2019
CROSSREFS
Sequence in context: A024361 A305614 A190676 * A135486 A030187 A270657
KEYWORD
nonn
AUTHOR
J. M. Bergot and Robert Israel, Nov 09 2019
STATUS
approved