A365815 a(n) is the least centered n-gonal prime, or -1 if none exists.
19, 5, 31, 7, 43, -1, -1, 11, 67, 13, 79, 43, 151, 17, 103, 19, 191, 61, 127, 23, 139, 73, 151, 79, 163, 29, 6091, 31, 311, 97, 199, 103, 211, 37, 223, 229, 1093, 41, 2707, 43, 431, 661, 271, 47, 283, 1009, 491, 151, 307, 53, 3499, 163, 331, 337, 571, 59, 4603, 61
Offset: 3
Keywords
Links
- Ilya Gutkovskiy, Scatterplot of a(n) up to n=10000
- Eric Weisstein's World of Mathematics, Centered Polygonal Number
Programs
-
Mathematica
Table[SelectFirst[n # (# + 1)/2 + 1 & /@ Range[100], PrimeQ], {n, 3, 60}] /. (Missing["NotFound"] -> -1)
-
PARI
a(n) = if ((n==8) || (n==9), return(-1)); my(k=0, p); while (!isprime(p=1+n*k*(k-1)/2), k++); p; \\ Michel Marcus, Sep 27 2023