OFFSET
3,1
COMMENTS
The corresponding indices of the n-gonal numbers are 33, 1093, 73, 17, 97, ... (A371760).
LINKS
Amiram Eldar, Table of n, a(n) for n = 3..10000
Eric Weisstein's World of Mathematics, Polygonal Number.
Eric Weisstein's World of Mathematics, Poulet Number.
Wikipedia, Polygonal number.
Wikipedia, Pseudoprime.
FORMULA
a(n) = ((n-2)*k^2 - (n-4)*k)/2, where k = A371760(n).
EXAMPLE
MATHEMATICA
p[k_, n_] := ((n-2)*k^2 - (n-4)*k)/2; pspQ[n_] := CompositeQ[n] && PowerMod[2, n - 1, n] == 1; a[n_] := Module[{k = 2}, While[! pspQ[p[k, n]], k++]; p[k, n]]; Array[a, 50, 3]
PROG
(PARI) p(k, n) = ((n-2)*k^2 - (n-4)*k)/2;
ispsp(n) = !isprime(n) && Mod(2, n)^(n-1) == 1;
a(n) = {my(k = 2); while(!ispsp(p(k, n)), k++); p(k, n); }
CROSSREFS
KEYWORD
nonn
AUTHOR
Amiram Eldar, Apr 05 2024
STATUS
approved