OFFSET
1,1
EXAMPLE
2 is in the sequence because (2-1)*2^2+1 = 1*2^2+1 = 4+1 = 5, which is prime.
MATHEMATICA
Select[Range[1000], PrimeQ[(# - 1) #^# + 1] &] (* Vincenzo Librandi, Oct 23 2014 *)
PROG
(PARI) isok(n) = isprime((n-1)*n^n+1); \\ Michel Marcus, Oct 23 2014
(Magma) [n: n in [1..1000] |IsPrime((n-1)*n^n+1)]; // Vincenzo Librandi, Oct 23 2014
(Python)
from sympy import isprime
def afind(limit, startk=0):
for k in range(startk, limit+1):
if isprime((k-1)*k**k + 1):
print(k, end=", ")
afind(200) # Michael S. Branicky, Jan 01 2022
CROSSREFS
KEYWORD
hard,more,nonn
AUTHOR
Ray G. Opao, Jul 14 2005
EXTENSIONS
a(7) from Michael S. Branicky, Jan 01 2022
STATUS
approved