OFFSET
1,2
COMMENTS
Numbers n such that a(n) = m: 2, 31, 41, 131, 157, ... (for m = 2);
3, 53, 83, 97, 139, ... (for m = 3); 19, 23, 79, 191, ... (for m = 4), ...
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..20000
EXAMPLE
For n = 2, k = 0: (0 + 1)*2 - 0 = 2 is prime and (0 + 1)*2 + 0 = 2 is prime; for n = 2, k = 1: (1 + 1)*2 - 1 = 3 is prime and (1 + 1)*2 + 1 = 5 is prime; for n = 2, k = 2: (2 + 1)*2 - 2 = 4 is composite and (2 + 1)*2 + 2 = 6 is composite, so a(2) = 2.
MATHEMATICA
Table[SelectFirst[Range[0, 120], And[! PrimeQ[n (# + 1) - #], ! PrimeQ[n (# + 1) + #]] &], {n, 120}] (* Michael De Vlieger, Mar 04 2016, Version 10 *)
PROG
(PARI) A269668(n) = {my(k=0); while (isprime((k+1)*n-k) || isprime((k+1)*n+k), k++); k; } \\ Michel Marcus, Apr 04 2016, corrected by Antti Karttunen, Dec 27 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Juri-Stepan Gerasimov, Mar 03 2016
EXTENSIONS
Definition corrected by Michael De Vlieger, Mar 04 2016
STATUS
approved