A194640 Smallest image size for which the number of endofunctions (functions f:{1,2,...,n}->{1,2,...,n}) is a maximum.
0, 1, 1, 2, 3, 3, 4, 5, 5, 6, 7, 7, 8, 8, 9, 10, 10, 11, 12, 12, 13, 13, 14, 15, 15, 16, 17, 17, 18, 19, 19, 20, 20, 21, 22, 22, 23, 24, 24, 25, 25, 26, 27, 27, 28, 29, 29, 30, 31, 31, 32, 32, 33, 34, 34, 35, 36, 36, 37, 38, 38, 39, 39, 40, 41, 41, 42, 43, 43
Offset: 0
Keywords
Examples
a(3) = 2 because there are 18 functions from {1,2,3} into {1,2,3} that have two elements in their image, 3 functions have one and 6 functions that have three elements in their image.
Links
- Alois P. Heinz, Table of n, a(n) for n = 0..1000
Programs
-
Maple
T:= proc(n, k) option remember; if k=n then n! elif k=0 or k>n then 0 else n * (T(n-1, k-1) + k/(n-k) * T(n-1, k)) fi end: a:= proc(n) local i, k, m, t; m, i:= 0, 0; for k to n do t:= T(n, k); if t>m then m, i:= t, k fi od; i end: seq(a(n), n=0..50); # Alois P. Heinz, Sep 08 2011
-
Mathematica
Prepend[Flatten[Table[Flatten[First[Position[Table[StirlingS2[n, k] Binomial[n, k] k!, {k, 1, n}],Max[Table[StirlingS2[n, k] Binomial[n, k] k!, {k, 1, n}]]]]], {n, 1,50}]], 0]
Formula
a(n) = arg max_{k=0..n} Stirling2(n,k) * k! * C(n,k) for n!=2, a(2) = 1.
a(n) = arg max_{k=0..n} A090657(n,k) for n!=2, a(2) = 1.
Comments