%I #32 Nov 10 2019 03:07:05
%S 8,12,140,64,2236,196,1300,1600,6256,5084,248756,246196,484400,36680,
%T 887884,821836,1559116,104120,126072244,9586736,4156840,542759984,
%U 1017981724,2744780140,405793096,148647496,1671024916
%N a(n) is the least k such that k^2 + 1 is a semiprime p*q, p < q, and (q - p)/2^n is prime.
%C The corresponding primes are 2, 3, 71, 7, 1069, 7, 5, 5, 59, 2, 368471, 180463, 12421, 2, 29, 125683, 226169, 5, 369704891, 197, 5, 263, 7444559, 239621423, 594271, 2, 474359, ...
%C All terms are even, in order for k^2+1 to be odd. Otherwise, with k^2+1 being even, p-q would be odd and hence not a multiple of 2^n. - _Michel Marcus_, Apr 13 2019
%e a(2)=8 because 8^2+1 = 5*13 and (13-5)/2^2 = 2 is prime. The number 8 is the first term of the sequence 8, 22, 34, 46, 50, 58, ...
%e a(3)=12 because 12^2+1 = 5*29 and (29-5)/2^3 = 3 is prime. The number 12 is the first term of the sequence 12, 28, 44, 52, 76, 80, ...
%e a(4)=140 because 140^2+1 = 17*1153 and (1153-17)/2^4 = 71 is prime. The number 140 is the first term of the sequence 140, 296, 404, 604, ...
%t lst={};Do[k=2;While[!(Plus@@Last/@FactorInteger[k^2+1]==2&&PrimeQ[(FactorInteger[k^2+1][[-1,1]]-FactorInteger[k^2+1][[1,1]])/2^n]),k=k+2];Print[n," ",k],{n,2,19}];lst
%o (PARI) isok(k, n) = my(kk=k^2+1, f=factor(kk)[,1]~); (bigomega(kk) == 2) && (#f == 2) && (p=f[1]) && (q=f[2]) && (qq=(q-p)/2^n) && !frac(qq) && isprime(qq);
%o a(n) = my(k=2); while (!isok(k,n), k+=2); k; \\ _Michel Marcus_, Apr 13 2019
%Y Cf. A085722, A144255.
%K nonn,more
%O 2,1
%A _Michel Lagneau_, Jun 10 2015
%E Name edited by _Jon E. Schoenfield_, Sep 12 2017
%E a(20)-a(22) from _Daniel Suteu_, Apr 13 2019
%E a(23)-a(28) from _Daniel Suteu_, Nov 09 2019