This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A359396 #15 Jan 11 2023 08:48:08 %S A359396 5,9,105,3,909,4995825,28212939 %N A359396 a(n) is the least k such that k^j+2 is prime for j = 1 to n but not n+1. %C A359396 All terms are odd, and all except a(1) = 5 are divisible by 3. %C A359396 The generalized Bunyakovsky conjecture implies that a(n) exists for all n. %C A359396 a(8) > 10^10. %C A359396 a(8) > 10^11. - _Lucas A. Brown_, Jan 11 2023 %e A359396 a(4) = 3 because 3^1 + 2 = 5, 3^2 + 2 = 11, and 3^3 + 2 = 29 and 3^4 + 2 = 83 are prime but 3^5 + 2 = 245 is not. %p A359396 f:= proc(n) local j; %p A359396 for j from 1 do %p A359396 if not isprime(n^j+2) then return j-1 fi %p A359396 od %p A359396 end proc: %p A359396 V:= Vector(7): V[1]:= 5: count:= 1: %p A359396 for k from 3 by 6 while count < 7 do %p A359396 v:= f(k); %p A359396 if v > 0 and V[v] = 0 then V[v]:= k; count:= count+1 fi %p A359396 od: %p A359396 convert(V,list); %o A359396 (Python) %o A359396 from sympy import isprime %o A359396 from itertools import count, islice %o A359396 def f(k): %o A359396 j = 1 %o A359396 while isprime(k**j + 2): j += 1 %o A359396 return j-1 %o A359396 def agen(): %o A359396 adict, n = dict(), 1 %o A359396 for k in count(2): %o A359396 v = f(k) %o A359396 if v not in adict: adict[v] = k %o A359396 while n in adict: yield adict[n]; n += 1 %o A359396 print(list(islice(agen(), 5))) # _Michael S. Branicky_, Jan 09 2023 %Y A359396 Cf. A087576. %K A359396 nonn,more %O A359396 1,1 %A A359396 _Robert Israel_, Dec 29 2022