cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A194640 Smallest image size for which the number of endofunctions (functions f:{1,2,...,n}->{1,2,...,n}) is a maximum.

This page as a plain text file.
%I A194640 #23 Nov 14 2014 10:27:32
%S A194640 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,
%T A194640 18,19,19,20,20,21,22,22,23,24,24,25,25,26,27,27,28,29,29,30,31,31,32,
%U A194640 32,33,34,34,35,36,36,37,38,38,39,39,40,41,41,42,43,43
%N A194640 Smallest image size for which the number of endofunctions (functions f:{1,2,...,n}->{1,2,...,n}) is a maximum.
%C A194640 a(n) is the smallest number of elements in the image for which the number of functions f:{1,2,...,n}->{1,2,...,n} is a maximum.
%H A194640 Alois P. Heinz, <a href="/A194640/b194640.txt">Table of n, a(n) for n = 0..1000</a>
%F A194640 a(n) = arg max_{k=0..n} Stirling2(n,k) * k! * C(n,k) for n!=2, a(2) = 1.
%F A194640 a(n) = arg max_{k=0..n} A090657(n,k) for n!=2, a(2) = 1.
%e A194640 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.
%p A194640 T:= proc(n, k) option remember;
%p A194640       if k=n then n!
%p A194640     elif k=0 or k>n then 0
%p A194640     else n * (T(n-1, k-1) + k/(n-k) * T(n-1, k))
%p A194640       fi
%p A194640     end:
%p A194640 a:= proc(n) local i, k, m, t;
%p A194640       m, i:= 0, 0;
%p A194640       for k to n do
%p A194640         t:= T(n, k);
%p A194640         if t>m then m, i:= t, k fi
%p A194640       od; i
%p A194640     end:
%p A194640 seq(a(n), n=0..50); # _Alois P. Heinz_, Sep 08 2011
%t A194640 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]
%Y A194640 Cf. A000312 (number of endofunctions), A090657.
%K A194640 nonn
%O A194640 0,4
%A A194640 _Geoffrey Critzer_, Aug 31 2011