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 A367805 #49 Jan 04 2024 21:10:41 %S A367805 0,1,1,3,1,3,1,3,3,1,5,3,1,3,7,7,1,5,5,1,5,3,3,3,3,1,3,1,5,9,3,7,1,3, %T A367805 1,5,5,3,3,3,1,5,1,5,1,3,9,5,1,9,3,1,15,7,3,15,1,9,11,1,9,3,21,1,3,3, %U A367805 5,3,1,3,3,15,3,5,9,3,13,3,19,3,1,15,1,3,3,9,13,3,1,15 %N A367805 a(1) = 0; for n > 1, a(n) is the least positive integer k for which k*prime(n) + 2 is prime. %H A367805 Alois P. Heinz, <a href="/A367805/b367805.txt">Table of n, a(n) for n = 1..10000</a> %F A367805 a(n) = (A279756(n) - 2)/A000040(n). %F A367805 a(n) = 1 <=> n in A029707. %e A367805 For n = 4: a(4) = 3, because prime(4) = 7, 3*7 + 2 = 23 which is prime. %p A367805 a:= proc(n) local p, q, r; p:= ithprime(n); q:= p; %p A367805 while irem(q-2, p, 'r')<>0 do q:= nextprime(q) od; r %p A367805 end: %p A367805 seq(a(n), n=1..99); # _Alois P. Heinz_, Dec 04 2023 %t A367805 nmax=90; a[1]=0; For[n=2, n<=nmax, n++, For[k=1, k>0, k++, If[PrimeQ[k*Prime[n]+2], a[n]=k; k=-1]]]; Array[a,nmax] (* _Stefano Spezia_, Dec 04 2023 *) %o A367805 (PARI) a(n) = if (n==1, 0, my(k=1, p=prime(n)); while (!isprime(k*p+2), k++); k); \\ _Michel Marcus_, Dec 02 2023 %o A367805 (Python) %o A367805 from itertools import count, dropwhile %o A367805 from sympy import prime, isprime %o A367805 def A367805(n): %o A367805 if n==1: %o A367805 return 0 %o A367805 else: %o A367805 p = prime(n) %o A367805 return next(dropwhile(lambda x:not isprime(x*p+2),count(1))) # _Chai Wah Wu_, Jan 04 2024 %Y A367805 Cf. A000040, A029707, A035096, A117673, A279756, A001359. %K A367805 nonn %O A367805 1,4 %A A367805 _Frank Hollstein_, Dec 01 2023 %E A367805 More terms from _Michel Marcus_, Dec 02 2023