OFFSET
1,1
COMMENTS
For all primes p > 5, at least one polygonal number exists with P_s(k) = p - 1 when k = 3 or 4, dependent on p mod 6; this is why the sequence is defined for k >= 5.
For s = {14,17} no such P_s(k) exists, since P_14(k) + 1 and P_17(k) + 1 are composites.
For k = 4*m + 1, m > 0 all the numbers P_s(k) + 1 are even and > 2, so they cannot be prime.
For s = 2*m, m >= 2, k = 2*j + 1, j >= 1 all the numbers P_s(k) + 1 are even and > 2, so they cannot be prime.
EXAMPLE
a(1)-1 = 29-1 = 28 = P_3(7);
a(2)-1 = 37-1 = 36 = P_3(8) = P_4(6).
MATHEMATICA
lst = {}; Do[
If[Resolve[
Exists[{s, k},
Prime[m] == 1/2 k (4 + k (-2 + s) - s) + 1 && s >= 3 && k >= 5],
Integers], lst = Union[lst, {Prime[m]}]], {m, 4, 150}]; lst
PROG
(PARI) isok(p) = {if ((p > 5) && isprime(p), for (s=3, p, if (ispolygonal(p-1, s, &k) && (k>=5), return (1)); ); ); return (0); } \\ Michel Marcus, May 18 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Ralf Steiner, May 17 2018
STATUS
approved