login
Numbers of the form prime(p)^q where p and q are primes. Prime powers whose prime index and exponent are both prime.
4

%I #23 Sep 12 2024 12:42:20

%S 9,25,27,121,125,243,289,961,1331,1681,2187,3125,3481,4489,4913,6889,

%T 11881,16129,24649,29791,32041,36481,44521,58081,68921,76729,78125,

%U 80089,109561,124609,134689,160801,161051,177147,185761,205379,212521,259081,299209

%N Numbers of the form prime(p)^q where p and q are primes. Prime powers whose prime index and exponent are both prime.

%C Alternatively, numbers of the form prime(prime(i))^prime(j) for some positive integers i, j.

%H Robert Israel, <a href="/A352519/b352519.txt">Table of n, a(n) for n = 1..10000</a>

%e The terms together with their prime indices begin:

%e 9: {2,2}

%e 25: {3,3}

%e 27: {2,2,2}

%e 121: {5,5}

%e 125: {3,3,3}

%e 243: {2,2,2,2,2}

%e 289: {7,7}

%e 961: {11,11}

%e 1331: {5,5,5}

%e 1681: {13,13}

%e 2187: {2,2,2,2,2,2,2}

%e 3125: {3,3,3,3,3}

%e 3481: {17,17}

%e 4489: {19,19}

%e 4913: {7,7,7}

%e 6889: {23,23}

%e 11881: {29,29}

%e 16129: {31,31}

%e 24649: {37,37}

%e 29791: {11,11,11}

%p N:= 10^7: # for terms <= N

%p M:=numtheory:-pi(numtheory:-pi(isqrt(N))):

%p PP:= {seq(ithprime(ithprime(i)),i=1..M)}:

%p R:= NULL:

%p for p in PP do

%p q:= 1:

%p do

%p q:= nextprime(q);

%p t:= p^q;

%p if t > N then break fi;

%p R:= R, t;

%p od;

%p od:

%p sort([R]); # _Robert Israel_, Dec 08 2022

%t Select[Range[10000],PrimePowerQ[#]&&MatchQ[FactorInteger[#],{{_?(PrimeQ[PrimePi[#]]&),k_?PrimeQ}}]&]

%o (Python)

%o from sympy import primepi, integer_nthroot, primerange

%o def A352519(n):

%o def f(x): return int(n+x-sum(primepi(primepi(integer_nthroot(x,p)[0])) for p in primerange(x.bit_length())))

%o def bisection(f,kmin=0,kmax=1):

%o while f(kmax) > kmax: kmax <<= 1

%o while kmax-kmin > 1:

%o kmid = kmax+kmin>>1

%o if f(kmid) <= kmid:

%o kmax = kmid

%o else:

%o kmin = kmid

%o return kmax

%o return bisection(f,n,n) # _Chai Wah Wu_, Sep 12 2024

%Y Numbers of the form p^q for p and q prime are A053810, counted by A001221.

%Y These partitions are counted by A230595.

%Y This is the prime power case of A346068.

%Y For numbers that are not a prime power we have A352518, counted by A352493.

%Y A000040 lists the primes.

%Y A000961 lists prime powers.

%Y A001597 lists perfect powers.

%Y A001694 lists powerful numbers, counted by A007690.

%Y A056166 = prime exponents are all prime, counted by A055923.

%Y A076610 = prime indices are all prime, counted by A000607, powerful A339218.

%Y A109297 = same indices as exponents, counted by A114640.

%Y A112798 lists prime indices, reverse A296150, sum A056239.

%Y A124010 gives prime signature, sorted A118914, sum A001222.

%Y A164336 lists all possible power-towers of prime numbers.

%Y A257994 counts prime indices that are themselves prime, nonprime A330944.

%Y A325131 = disjoint indices from exponents, counted by A114639.

%Y Cf. A000720, A002035, A005117, A007821, A038499, A101436, A181819, A181821.

%K nonn

%O 1,1

%A _Gus Wiseman_, Mar 26 2022