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 A309120 #39 Jul 19 2019 17:37:02 %S A309120 2,2,2,2,2,2,2,2,2,2,2,2,4,2,2,2,4,2,2,2,2,2,2,2,4,2,2,3,2,2,2,3,2,2, %T A309120 2,2,2,3,2,2,2,2,4,2,2,3,6,2,2,2,2,2,2,2,2,2,2,3,6,3,6,5,2,2,2,2,4,2, %U A309120 2,2,4,5,4,2,2,2,4,2,2,3,2,2,2,2,6,2,2,3,2,2,2,3,4,3 %N A309120 a(n) is the least k > 1 such that n*k is adjacent to a prime. %C A309120 If n is odd then a(n) is even. %C A309120 a(n) exists by Dirichlet's theorem on primes in arithmetic progressions. %H A309120 Robert Israel, <a href="/A309120/b309120.txt">Table of n, a(n) for n = 1..10000</a> %F A309120 a(A104278(n)) > 2 and a(A147820(n)) = 2. - _Ivan N. Ianakiev_, Jul 18 2019 %e A309120 a(13)=4 because 4*13+1=53 is prime but none of 2*13-1,2*13+1,3*13-1,3*13+1 are primes. %p A309120 f:= proc(m) local k; %p A309120 for k from 2 by 1+(m mod 2) do %p A309120 if isprime(k*m-1) or isprime(k*m+1) then return k fi %p A309120 od %p A309120 end proc: %p A309120 map(f, [$1..100]); %t A309120 a[n_]:=Module[{k=2},While[Not[PrimeQ[k*n-1]||PrimeQ[k*n+1]],k++];k]; %t A309120 a/@Range[94] (* _Ivan N. Ianakiev_, Jul 18 2019 *) %o A309120 (PARI) a(n) = my(k=2); while (!isprime(n*k+1) && !isprime(n*k-1), k++); k; \\ _Michel Marcus_, Jul 19 2019 %Y A309120 Cf. A307833, A104278, A147820. %K A309120 nonn %O A309120 1,1 %A A309120 _Robert Israel_, Jul 17 2019