%I #49 Jun 11 2024 04:33:33
%S 0,2,6,45,415,4693,65010,1073640,20669837,454793822,11259684418,
%T 309761863916,9373389023182,309374515194621,11059527891811334,
%U 425655578031419604,17547665070746310736,771403345825446116583,36020103485009885093324
%N Number of primes between n! and n^n inclusive.
%F a(n) = A064151(n) - A003604(n). Add 1 for n = 2 since 2! is prime. - _Jens Kruse Andersen_, Jul 29 2014
%e There are 45 primes between 4! = 24 and 4^4 = 256.
%p with(numtheory): A229836:=n->pi(n^n)-pi(n!): (0,2,seq(A229836(n), n=3..10)); # _Wesley Ivan Hurt_, Nov 17 2015
%t Join[{0, 2}, Table[PrimePi[n^n] - PrimePi[n!], {n, 3, 12}]] (* _Wesley Ivan Hurt_, Nov 17 2015 *)
%o (Python)
%o import math
%o import sympy
%o from sympy import sieve
%o x = 1
%o while x < 50:
%o ....y = [i for i in sieve.primerange(math.factorial(x),x**x)]
%o ....print(len(y))
%o ....x += 1
%o (Python)
%o from math import factorial
%o from sympy import primepi
%o def A229836(n): return primepi(n**n)-primepi(factorial(n)-1) # _Chai Wah Wu_, Jun 06 2024
%o (PARI) a(n)=primepi(n^n)-primepi(n!-1) \\ _Charles R Greathouse IV_, Apr 30 2014
%o (PARI) a(n) = if(n==2, 2, primepi(n^n)-primepi(n!)) \\ _Altug Alkan_, Nov 17 2015
%Y Cf. A000142, A000312, A003604, A064151.
%K nonn,more
%O 1,2
%A _Derek Orr_, Dec 30 2013
%E a(12)-a(16) from _Jens Kruse Andersen_, Jul 29 2014
%E a(17)-a(18) from _Chai Wah Wu_, Jun 06 2024
%E a(19) from _Amiram Eldar_, Jun 11 2024