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 A360097 #17 Feb 09 2023 09:39:13 %S A360097 13,14,20,7,5,10,4,4,8,6,7,5,1,2,4,2,1,4,2,3,17,4,2,3,1,4,4,1,2,2,2,1, %T A360097 8,3,8,2,4,1,8,2,3,11,1,2,10,1,1,3,4,3,2,2,4,2,2,5,3,1,1,1,1,1,9,4,2, %U A360097 4,1,4,3,4,1,1,1,2,2,2,1,4,3,1,2,2,4,7,1 %N A360097 a(n) = smallest k such that 2*n*k-1 and 2*n*k+1 are nonprimes. %H A360097 Robert Israel, <a href="/A360097/b360097.txt">Table of n, a(n) for n = 1..10000</a> %e A360097 We try 1..k until the condition is met: %e A360097 a(7) != 1 because 2*7*1 = 14 and 14 - 1 = 13, a prime. %e A360097 a(7) != 2 because 2*7*2 = 28 and 28 + 1 = 29, a prime. %e A360097 a(7) != 3 because 2*7*3 = 42 and 42 - 1 = 41 and 42 + 1 = 43, both primes. %e A360097 a(7) = 4 because 2*7*4 = 56 and 56 - 1 = 55 and 56 + 1 = 57 are both nonprimes. %p A360097 f:= proc(n) local k; %p A360097 for k from 1 do %p A360097 if not isprime(2*n*k-1) and not isprime(2*n*k+1) then return k fi %p A360097 od %p A360097 end proc: %p A360097 map(f, [$1..100]); # _Robert Israel_, Feb 07 2023 %t A360097 a[n_] := Module[{k = 1}, While[PrimeQ[2*n*k - 1] || PrimeQ[2*n*k + 1], k++]; k]; Array[a, 100] (* _Amiram Eldar_, Jan 25 2023 *) %o A360097 (Python) %o A360097 from sympy import isprime %o A360097 from itertools import count %o A360097 def a(n): return next(k for k in count(1) if not isprime(2*n*k-1) and not isprime(2*n*k+1)) %o A360097 print([a(n) for n in range(1, 86)]) # _Michael S. Branicky_, Jan 25 2023 %o A360097 (PARI) a(n) = my(k=1); while(isprime(2*n*k-1) || isprime(2*n*k+1), k++); k; \\ _Michel Marcus_, Jan 25 2023 %Y A360097 Cf. A018252, A124522. %K A360097 nonn %O A360097 1,1 %A A360097 _Tamas Sandor Nagy_, Jan 25 2023 %E A360097 More terms from _Michael S. Branicky_, Jan 25 2023