OFFSET
1,5
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
FORMULA
a(n) <= A200996(n). - Reinhard Zumkeller, Feb 14 2013
a(A002110(n)/3+3) >= ceiling((prime(n+1)-1)/3) for n >= 2. Equality holds for n = 2, 4, 6, 8, 10, 12, 22, 25, 31, 116, 155, 156, 197, ... . - Pontus von Brömssen, Oct 16 2021
a(A002110(n)/3-3) >= ceiling((prime(n+1)-1)/3) for n >= 3. Equality holds for n = 3, 4, 5, 6, 7, 9, 39, 51, 59, 65, 98, 311, ... . - Pontus von Brömssen, Oct 19 2021
MATHEMATICA
f[n_] := Block[{k = 1}, While[ ! PrimeQ[k*n - 1] && ! PrimeQ[k*n + 1], k++ ]; k]; Table[ f[n], {n, 105}] (* Robert G. Wilson v, Feb 12 2005 *)
lk[n_]:=Module[{k=1}, While[NoneTrue[k*n+{1, -1}, PrimeQ], k++]; k]; Array[ lk, 120] (* The program uses the NoneTrue function from Mathematica version 10 *) (* Harvey P. Dale, May 01 2016 *)
PROG
(Haskell)
a103689 n = min (a053989 n) (a034693 n)
-- Reinhard Zumkeller, Feb 14 2013
(PARI) a(n) = my(k=1); while (!isprime(k*n+1) && !isprime(k*n-1), k++); k; \\ Michel Marcus, Oct 18 2021
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Pierre CAMI, Feb 12 2005
EXTENSIONS
Edited, corrected and extended by Robert G. Wilson v, Feb 19 2005
STATUS
approved