%I #25 Jun 10 2024 18:45:09
%S 7,11,23,31,41,47,59,71,79,131,137,151,167,239,311,359,443,461,701,
%T 839,911,1021,1039,1367,1721,1847,2207,2351,2551,2861,3191,3719,4019,
%U 4691,4759,5039,5167,5279,6971,7481,7853,7919,9311,9619,9689,10607,10739,11447
%N Primes p such that there exists prime q < p for which p*q^2 + 1 is divisible by q^2 + p and 1 + p.
%e For n=4, a(4)=31 and q=17 satisfy the desired divisibilities.
%p P:= select(isprime,[2,seq(i,i=3..100000,2)]):
%p nP:= nops(P);
%p R:= NULL:
%p for i from 2 to nP do
%p p:= P[i];
%p for j from 1 to i-1 do
%p q:= P[j];
%p if p*q^2 + 1 mod ilcm(p+1, q^2+p) = 0 then
%p R:= R,p;
%p break
%p fi
%p od od:
%p R;
%K nonn
%O 1,1
%A _Stephen Bartell_, May 22 2024