OFFSET
1,2
COMMENTS
k can take values from 1 to floor[n/2].
a(n)=0 for k = 1, 6, 30 and 54. Are there any others? - Robert Israel, Feb 23 2018
There are none for n up to 10^9. - Mauro Fiorentini, Jul 24 2023
LINKS
Ivan Neretin, Table of n, a(n) for n = 1..10000
EXAMPLE
a(15) = 37 as 1*14 +1 = 16, 2*13 +1 = 27 are composite but 3*12 +1= 37 is a prime.
a(6) = 0 as 1*5 +1=6, 2*4 +1=9, 3*3 +1 = 10 are all composite.
MAPLE
f:= proc(n) local k;
for k from floor(n/2) to 1 by -1 do
if isprime(k*(n-k)+1) then return k*(n-k)+1 fi
od:
0 end proc:
map(f, [$1..100]); # Robert Israel, Feb 23 2018
MATHEMATICA
Table[Max@Prepend[Select[Table[k (n - k) + 1, {k, n/2}], PrimeQ], 0], {n, 60}] (* Ivan Neretin, Feb 23 2018 *)
PROG
(PARI) { a(n) = forstep(k=n\2, 1, -1, if(isprime(k*(n-k)+1), return(k*(n-k)+1))); return(0) } \\ Max Alekseyev, Oct 04 2005
CROSSREFS
KEYWORD
nonn
AUTHOR
Amarnath Murthy, Jul 15 2005
EXTENSIONS
More terms from Max Alekseyev, Oct 04 2005
STATUS
approved