A134968 Number of convex functions from {1,...,n} to itself.
1, 1, 4, 16, 54, 168, 462, 1212, 2937, 6832, 15135, 32430, 66898, 134710, 263466, 504308, 944208, 1736575, 3134832, 5574947, 9760954, 16868418, 28771587, 48513127, 80867486, 133455462, 218041708, 353039664, 566580113, 901958971, 1424480451, 2233367056
Offset: 0
Examples
a(3)=16: the 16 sequences are 111, 112, 113, 123, 211, 212, 213, 222, 223, 311, 312, 313, 321, 322, 323 and 333.
Programs
-
Mathematica
(*P[n,k]=number of ways to partition n into exactly k parts*) P[n_Integer, n_Integer] = 1; P[n_Integer, k_Integer] := P[n, k] = Sum[P[n - k, r], {r, 1, Min[n - k, k]}] (*q[n,k]=number of ways to partition n into k-or-fewer parts*) q[0, 0] = 1; q[n_Integer, 0] = 0; q[n_Integer, k_Integer] := q[n, k] = q[n, k - 1] + P[n, k] a[n_] := Sum[(n - Max[f, r])*P[r, s]*q[f, n - 1 - s], {r, 0, n - 1}, {s, 0, n - 1}, {f, 0, n - 1}]
Formula
See Mathematica code.
Comments