%I #23 Oct 02 2021 08:30:48
%S 8,10,24,48,168,360,840,1368,1848,2208,3720,5040,7920,10608,11448,
%T 16128,17160,19320,29928,36480,44520,49728,54288,57120,66048,85848,
%U 97968,113568,128880,177240,196248,201600,218088,241080,273528,292680,323760,344568,368448,426408,458328,516960,528528,537288,552048,564000,573048,579120
%N Numbers such that the two adjacent integers are a prime and the square of another prime.
%C -> Equivalently, numbers k such that tau(k^2-1) = A347191(k) = 6 (see example; used for Maple code).
%C Proof: tau(k^2-1) = 6 <==> k^2-1 = p^5 or k^2-1 = p*q^2 with p <> q primes; but k^2-p^5 = 1 is impossible, as a consequence of the Catalan-Mihăilescu theorem; now, (k-1)*(k+1) = p*q^2 ==> (k-1 = p and k+1 = q^2) or (k-1 = q^2 and k+1 = p), because k-1 = q and k+1 = p*q is not possible, otherwise 2 = q*(p-1), which would contradict p <> q.
%C -> There are two possible configurations with p, q primes: (q^2 < a(n) < p) or (p < a(n) < q^2).
%C The unique configuration q^2 < a(n) < p is for q = 3, a(2) = 10 and p = 11.
%C All the other configurations, for n = 1 or n >= 3, are of the form p < a(n) < q^2 with p = A049002(n) and q = A062326(n).
%C -> Note that there is only one integer such that the two adjacent integers are a prime and the square of that prime: it is 3, which lies between 2 and 2^2; in this case, tau(3^2-1) = 4.
%H Diophante, <a href="http://www.diophante.fr/problemes-par-themes/arithmetique-et-algebre/a1-pot-pourri/3848-a1885-caches-derriere-leurs-diviseurs">A1885, Cachés derrière leurs diviseurs</a> (in French).
%H Adrian Dudek, <a href="http://arxiv.org/abs/1507.08893">On the Number of Divisors of n^2-1</a>, arXiv:1507.08893 [math.NT], 2015.
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Catalan%27s_conjecture">Catalan's conjecture</a>.
%F For n >= 3: a(n) = A049002(n) + 1 = a(n) = A146981(n) - 1 = (A049002(n) + A146981(n))/2 = A062326(n)^2 - 1.
%e 8 is a term since 8 lies between 7 (prime) and 9 = 3^2 (square of prime); also tau(8^2-1) = tau(63) = 6.
%e 10 is a term since 10 lies between 9 = 3^2 (square of prime) and 11 (prime); also tau(10^2-1) = tau(99) = 6.
%e 24 is a term since 24 lies between 23 (prime) and 25 = 5^2 (square of prime); also tau(24^2-1) = tau(575) = 6.
%p with(numtheory):
%p filter := q-> tau(q^2-1) = 6 : select(filter, [$2..580000]);
%t q[n_] := Module[{e1 = FactorInteger[n - 1][[;; , 2]], e2 = FactorInteger[n + 1][[;; , 2]]}, (e1 == {1} && e2 == {2}) || (e1 == {2} && e2 == {1})]; Select[Range[4, 600000], q] (* _Amiram Eldar_, Sep 23 2021 *)
%o (PARI) isok(m) = my(pa, pb); (isprimepower(m-1, &pa)*isprimepower(m+1, &pb) == 2) && (pa != pb); \\ _Michel Marcus_, Sep 23 2021
%o (PARI) upto(n) = { my(res = List()); forprime(i = 3, sqrtint(n-1), if(isprime(i^2 - 2), listput(res, i^2-1); ); if(isprime(i^2 + 2), listput(res, i^2 + 1); ) ); res } \\ _David A. Corneth_, Sep 23 2021
%Y Cf. A049002, A062326, A146981.
%Y Cf. A347191, A347192, A347193.
%Y Subsequence of A163492 (between prime and a perfect square).
%K nonn
%O 1,1
%A _Bernard Schott_, Sep 23 2021