login
a(n) = n^n - n!.
20

%I #73 Oct 17 2022 07:07:17

%S 0,0,2,21,232,3005,45936,818503,16736896,387057609,9996371200,

%T 285271753811,8915621446656,302868879571453,11111919647266816,

%U 437892582706491375,18446723150919663616,827239906198908668177,39346401672922831847424,1978419534015213180291979

%N a(n) = n^n - n!.

%C a(n) = |non-injective functions [n]->[n]| = |non-surjective functions [n]->[n]|.

%C Fit a polynomial f of degree n-1 to the first n n-th powers of nonnegative integers. Then a(n) = f(n). - _Franklin T. Adams-Watters_, Dec 28 2006

%C n^n > n! for n >= 3. [Mitrinovic]

%D D. S. Mitrinovic, Analytic Inequalities, Springer-Verlag, 1970; p. 193, 3.1.22.

%H T. D. Noe and Vincenzo Librandi, <a href="/A036679/b036679.txt">Table of n, a(n) for n = 0..300</a> [T. D. Noe computed terms 0-50, May 11 2007; Vincenzo Librandi computed the first 300 terms, Aug 22 2011]

%H Mohammad K. Azarian, <a href="https://doi.org/10.12988/imf.2022.912321">Remarks and Conjectures Regarding Combinatorics of Discrete Partial Functions</a>, Int'l Math. Forum (2022) Vol. 17, No. 3, 129-141. See Corollary 2.3(iii).

%F E.g.f.: 1/(1-T(x))-1/(1-x) where T(x) is the e.g.f. for A000169. - _Geoffrey Critzer_, Dec 10 2012

%t Join[{0}, Table[n^n - n!, {n, 20}]] (* _Harvey P. Dale_, Oct 11 2011 *)

%o (Magma) [(n^n-Factorial(n)): n in [0..20] ]; // _Vincenzo Librandi_, Aug 22 2011

%o (PARI) a(n)=n^n-n! \\ _Charles R Greathouse IV_, Aug 22 2011

%o (Python)

%o from math import factorial

%o def a(n): return n**n - factorial(n)

%o print([a(n) for n in range(20)]) # _Michael S. Branicky_, Aug 10 2021

%Y Cf. A126130, diagonal of A101030.

%K nonn,easy,nice

%O 0,3

%A _N. J. A. Sloane_, _G. L. Honaker, Jr._