login
a(n) = (k^k + k!) / (k*(k + 1)), where k = prime(n) - 1.
1

%I #20 Apr 13 2021 19:21:57

%S 1,1,14,1128,90942080,57157560576,67818988957718528,

%T 115047995548743401472,674758653138775267142795264,

%U 40819609745761407890621234130376982528,221388314080552960064314183934017536000000,79870389582370042643423622863118514819531536385179648

%N a(n) = (k^k + k!) / (k*(k + 1)), where k = prime(n) - 1.

%C According to the two theorems (Fermat and Wilson), k + 1 divides(k^k + k!) because k^k == 1 (mod k + 1) and k! == - 1 (mod k + 1) for any prime k + 1.

%H Andrew Howroyd, <a href="/A178989/b178989.txt">Table of n, a(n) for n = 1..50</a>

%e a(3) = 14 because prime(3) = 5 => p = 4 => (4^4 + 4!) / 4(4 + 1) = 280/20 = 14.

%p with(numtheory): for n from 1 to 20 do: p:=ithprime(n):q:=p-1:x:= (q^q + q!)/(q*p):

%p printf(`%d, `, x): od:

%t f[n_] := Block[{k = Prime@ n - 1}, (k^k + k!)/(k (k + 1))]; Array[f, 10] (* _Robert G. Wilson v_, Jan 05 2011 *)

%o (PARI) a(n)={my(k=prime(n)-1); (k^k + k!) / (k*(k + 1))} \\ _Andrew Howroyd_, Apr 13 2021

%Y Cf. A000040.

%K nonn

%O 1,3

%A _Michel Lagneau_, Jan 03 2011

%E Terms a(11) and beyond from _Andrew Howroyd_, Apr 13 2021