A214015
Number of permutations A(n,k) in S_n with longest increasing subsequence of length <= k; square array A(n,k), n>=0, k>=0, read by antidiagonals.
Original entry on oeis.org
1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 2, 1, 0, 1, 1, 2, 5, 1, 0, 1, 1, 2, 6, 14, 1, 0, 1, 1, 2, 6, 23, 42, 1, 0, 1, 1, 2, 6, 24, 103, 132, 1, 0, 1, 1, 2, 6, 24, 119, 513, 429, 1, 0, 1, 1, 2, 6, 24, 120, 694, 2761, 1430, 1, 0, 1, 1, 2, 6, 24, 120, 719, 4582, 15767, 4862, 1, 0
Offset: 0
A(4,2) = 14 because 14 permutations of {1,2,3,4} do not contain an increasing subsequence of length > 2: 1432, 2143, 2413, 2431, 3142, 3214, 3241, 3412, 3421, 4132, 4213, 4231, 4312, 4321. Permutation 1423 is not counted because it contains the noncontiguous increasing subsequence 123.
A(4,2) = 14 = 2^2 + 3^2 + 1^2 because the partitions of 4 with <= 2 parts are [2,2], [3,1], [4] with 2, 3, 1 standard Young tableaux, respectively:
+------+ +------+ +---------+ +---------+ +---------+ +------------+
| 1 3 | | 1 2 | | 1 3 4 | | 1 2 4 | | 1 2 3 | | 1 2 3 4 |
| 2 4 | | 3 4 | | 2 .-----+ | 3 .-----+ | 4 .-----+ +------------+
+------+ +------+ +---+ +---+ +---+
Square array A(n,k) begins:
1, 1, 1, 1, 1, 1, 1, 1, ...
0, 1, 1, 1, 1, 1, 1, 1, ...
0, 1, 2, 2, 2, 2, 2, 2, ...
0, 1, 5, 6, 6, 6, 6, 6, ...
0, 1, 14, 23, 24, 24, 24, 24, ...
0, 1, 42, 103, 119, 120, 120, 120, ...
0, 1, 132, 513, 694, 719, 720, 720, ...
0, 1, 429, 2761, 4582, 5003, 5039, 5040, ...
Columns k=0-10 give:
A000007,
A000012,
A000108,
A005802,
A047889,
A047890,
A052399,
A072131,
A072132,
A072133,
A072167.
A(2n,n-1) gives
A269042(n) for n>0.
-
h:= proc(l) local n; n:=nops(l); add(i, i=l)! /mul(mul(1+l[i]-j
+add(`if`(l[k]>=j, 1, 0), k=i+1..n), j=1..l[i]), i=1..n)
end:
g:= (n, i, l)-> `if`(n=0 or i=1, h([l[], 1$n])^2, `if`(i<1, 0,
add(g(n-i*j, i-1, [l[], i$j]), j=0..n/i))):
A:= (n, k)-> `if`(k>=n, n!, g(n, k, [])):
seq(seq(A(n, d-n), n=0..d), d=0..14);
-
h[l_] := With[{n = Length[l]}, Sum[i, {i, l}]! / Product[Product[1+l[[i]]-j + Sum[If[l[[k]] >= j, 1, 0], {k, i+1, n}], {j, 1, l[[i]]}], {i, 1, n}]];
g[n_, i_, l_] := If[n == 0 || i == 1, h[Join[l, Array[1&, n]]]^2, If[i < 1, 0, Sum[g[n - i*j, i-1, Join[l, Array[i&, j]]], {j, 0, n/i}]]];
A[n_, k_] := If[k >= n, n!, g[n, k, {}]];
Table [Table [A[n, d-n], {n, 0, d}], {d, 0, 14}] // Flatten (* Jean-François Alcover, Dec 09 2013, translated from Maple *)
A317829
Number of set partitions of multiset {1, 2, 2, 3, 3, 3, ..., n X n}.
Original entry on oeis.org
1, 1, 4, 52, 2776, 695541, 927908528, 7303437156115, 371421772559819369, 132348505150329265211927, 355539706668772869353964510735, 7698296698535929906799439134946965681, 1428662247641961794158621629098030994429958386, 2405509035205023556420199819453960482395657232596725626
Offset: 0
For n = 2 we have a multiset {1, 2, 2} which can be partitioned as {{1}, {2}, {2}} or {{1, 2}, {2}} or {{1}, {2, 2}} or {{1, 2, 2}}, thus a(2) = 4.
A000142 counts submultisets of the same multiset.
A022915 counts permutations of the same multiset.
A006939 lists superprimorials or Chernoff numbers.
A076716 counts factorizations of factorials.
-
g:= proc(n, k) option remember; uses numtheory; `if`(n>k, 0, 1)+
`if`(isprime(n), 0, add(`if`(d>k or max(factorset(n/d))>d, 0,
g(n/d, d)), d=divisors(n) minus {1, n}))
end:
a:= n-> g(mul(ithprime(i)^i, i=1..n)$2):
seq(a(n), n=0..5); # Alois P. Heinz, Jul 26 2020
-
chern[n_]:=Product[Prime[i]^(n-i+1),{i,n}];
facs[n_]:=If[n<=1,{{}},Join@@Table[Map[Prepend[#,d]&,Select[facs[n/d],Min@@#>=d&]],{d,Rest[Divisors[n]]}]];
Table[Length[facs[chern[n]]],{n,3}] (* Gus Wiseman, Aug 21 2020 *)
-
\\ See A318284 for count.
a(n) = {if(n==0, 1, count(vector(n,i,i)))} \\ Andrew Howroyd, Aug 31 2020
A269129
Number A(n,k) of sequences with k copies each of 1,2,...,n avoiding the pattern 12...n; square array A(n,k), n>=0, k>=0, read by antidiagonals.
Original entry on oeis.org
0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 5, 1, 0, 0, 1, 43, 23, 1, 0, 0, 1, 374, 1879, 119, 1, 0, 0, 1, 3199, 173891, 102011, 719, 1, 0, 0, 1, 26945, 16140983, 117392909, 7235651, 5039, 1, 0, 0, 1, 224296, 1474050783, 142951955371, 117108036719, 674641325, 40319, 1
Offset: 0
Square array A(n,k) begins:
0, 0, 0, 0, 0, 0, ...
1, 0, 0, 0, 0, 0, ...
1, 1, 1, 1, 1, 1, ...
1, 5, 43, 374, 3199, 26945, ...
1, 23, 1879, 173891, 16140983, 1474050783, ...
1, 119, 102011, 117392909, 142951955371, 173996758190594, ...
Columns k=0-10 give:
A057427,
A033312,
A267532,
A269113,
A269114,
A269115,
A269116,
A269117,
A269118,
A269119,
A269120.
Rows n=0-10 give:
A000004,
A000007,
A000012,
A269121,
A269122,
A269123,
A269124,
A269125,
A269126,
A269127,
A269128.
-
g:= proc(l) option remember; (n-> f(l[1..nops(l)-1])*
binomial(n-1, l[-1]-1)+add(f(sort(subsop(j=l[j]
-1, l))), j=1..nops(l)-1))(add(i, i=l))
end:
f:= l->(n->`if`(n=0, 1, `if`(l[1]=0, 0, `if`(n=1 or l[-1]=1, 1,
`if`(n=2, binomial(l[1]+l[2], l[1])-1, g(l))))))(nops(l)):
A:= (n, k)-> (k*n)!/k!^n - f([k$n]):
seq(seq(A(n, d-n), n=0..d), d=0..12);
# second Maple program:
b:= proc(k, p, j, l, t) option remember;
`if`(k=0, (-1)^t/l!, `if`(p<0, 0, add(b(k-i, p-1,
j+1, l+i*j, irem(t+i*j, 2))/(i!*p!^i), i=0..k)))
end:
A:= (n, k)-> (n*k)!*(1/k!^n-b(n, k-1, 1, 0, irem(n, 2))*n!):
seq(seq(A(n, d-n), n=0..d), d=0..12); # Alois P. Heinz, Mar 03 2016
-
b[k_, p_, j_, l_, t_] := b[k, p, j, l, t] = If[k == 0, (-1)^t/l!, If[p < 0, 0, Sum[b[k-i, p-1, j+1, l + i j, Mod[t + i j, 2]]/(i! p!^i), {i, 0, k}]] ];
A[n_, k_] := (n k)! (1/k!^n - b[n, k-1, 1, 0, Mod[n, 2]] n!); Table[ Table[ A[n, d-n], {n, 0, d}], {d, 0, 12}] // Flatten (* Jean-François Alcover, Apr 07 2016, after Alois P. Heinz *)
A125714
Alfred Moessner's factorial triangle.
Original entry on oeis.org
1, 2, 3, 6, 11, 6, 24, 50, 35, 10, 120, 274, 225, 85, 15, 720, 1764, 1624, 735, 175, 21, 5040, 13068, 13132, 6769, 1960, 322, 28, 40320, 109584, 118124, 67284, 22449, 4536, 546, 36, 362880, 1026576, 1172700, 723680, 269325, 63273, 9450, 870, 45, 3628800
Offset: 1
An "x" prefaced before each term will indicate the term following the x being circled.
x1 2 x3 4 5 x6 7 8 9 x10 11 12 13 14 x15 ...
__x2 6 x11 18 26 x35 46 58 71 x85 ...
_____________x6 24 x50 96 154 x225 ...
_________________________x24 120 x274 ...
___________________________________________x120 ...
...
i.e., circle the triangular terms in row 1. In row 2, take partial sums of the uncircled terms and circle the terms offset one place to the left of the triangular terms in row 1. Continue in subsequent rows with analogous operations. The triangle consists of the infinite set of terms prefaced with the x (circled on page 64 of "The Book of Numbers").
- J. H. Conway and R. K. Guy, "The Book of Numbers", Springer-Verlag, 1996. Sequence can be seen by reading the successive circled numbers in the "factorial" section on page 64 (based on the work of Alfred Moessner).
- Joshua Zucker, Table of n, a(n) for n = 1..66
- G. S. Kazandzidis, On a conjecture of Moessner and a general problem, Bull. Soc. Math. Grèce (N.S.) 2 (1961), 23-30.
- Dexter Kozen and Alexandra Silva, On Moessner's theorem, Amer. Math. Monthly 120(2) (2013), 131-139.
- R. Krebbers, L. Parlant, and A. Silva, Moessner's theorem: an exercise in coinductive reasoning in Coq, Theory and practice of formal methods, 309-324, Lecture Notes in Comput. Sci., 9660, Springer, 2016.
- Calvin T. Long, Strike it out--add it up, Math. Gaz. 66 (438) (1982), 273-277.
- Alfred Moessner, Eine Bemerkung über die Potenzen der natürlichen Zahlen, S.-B. Math.-Nat. Kl. Bayer. Akad. Wiss., 29, 1951.
- Ivan Paasche, Ein neuer Beweis des Moessnerschen Satzes S.-B. Math.-Nat. Kl. Bayer. Akad. Wiss. 1952 (1952), 1-5 (1953). [Two years are listed at the beginning of the journal issue.]
- Ivan Paasche, Beweis des Moessnerschen Satzes mittels linearer Transformationen, Arch. Math. (Basel) 6 (1955), 194-199.
- Ivan Paasche, Eine Verallgemeinerung des Moessnerschen Satzes, Compositio Math. 12 (1956), 263-270.
- Hans Salié, Bemerkung zu einem Satz von A. Moessner, S.-B. Math.-Nat. Kl. Bayer. Akad. Wiss. 1952 (1952), 7-11 (1953). [Two years are listed at the beginning of the journal issue.]
- Oskar Perron, Beweis des Moessnerschen Satzes, S.-B. Math.-Nat. Kl. Bayer. Akad. Wiss., 31-34, 1951.
-
a := proc(n) local s,m,k,i; s := array(0..n); s[0] := 1;
for m from 1 to n do s[m] := 0; for k from m by - 1 to 1 do
for i from 1 to k do s[i] := s[i] + s[i - 1] od; lprint(s[k]);
if k = n then return(s[n]) fi od; lprint("-") od end: # Peter Luschny, Jan 27 2009
with(combinat);
s:=stirling1;
A003056 := proc(n) floor((sqrt(1+8*n)-1)/2) ; end proc:
T:=n->n*(n+1)/2; # A000217
g:=proc(n) local i,j,t; global T,A003056;
j:=A003056(n-1)+1;
t:=T(j);
for i from 0 to t-1 do
if ((n+i) mod t) = 0 then return(abs(s(j+1,j-i))); fi;
od;
end;
[seq(g(n),n=1..80)]; # N. J. A. Sloane, Jul 27 2021
-
n = 10; A125714 = Reap[ ClearAll[s]; s[0] = 1; For[m = 1, m <= n, m++, s[m] = 0; For[k = m, k >= 1, k--, For[i = 1, i <= k, i++, s[i] = s[i] + s[i-1]]; Sow[s[k]]; If[k == n, Print[n, "! = ", s[n]]; Break[]]]]][[2, 1]] (* Jean-François Alcover, Jun 29 2012, after Peter Luschny *)
-
T(n, k)={ my( s=vector(n)); for( m=1, n, forstep( j=m,1,-1, s[1]++; for( i=2, j, s[i] += s[i-1]));
k<0 && print(vecextract(s,Str(m"..1"))));
if( k>0,s[n+1-k],vecextract(s,"-1..1"))} /* returns T[n,k], or the whole n-th row if k is not given, prints row 1...n of the triangle if k<0 */ \\ M. F. Hasler, Dec 03 2010
A005096
a(n) = n! - n.
Original entry on oeis.org
1, 0, 0, 3, 20, 115, 714, 5033, 40312, 362871, 3628790, 39916789, 479001588, 6227020787, 87178291186, 1307674367985, 20922789887984, 355687428095983, 6402373705727982, 121645100408831981, 2432902008176639980, 51090942171709439979, 1124000727777607679978
Offset: 0
-
[Factorial(n) - n: n in [0..25]]; // Vincenzo Librandi, Jul 20 2011
-
A005096:=n->n!-n: seq(A005096(n), n=0..25); # Wesley Ivan Hurt, Oct 28 2014
-
lst={};Do[AppendTo[lst, n!-n], {n, 3*4!}];lst (* Vladimir Joseph Stephan Orlovsky, Nov 20 2008 *)
Table[n! - n, {n, 0, 25}] (* Wesley Ivan Hurt, Oct 28 2014 *)
-
a(n)=n!-n \\ Charles R Greathouse IV, Oct 28 2014
A214152
Number of permutations T(n,k) in S_n containing an increasing subsequence of length k; triangle T(n,k), n>=1, 1<=k<=n, read by rows.
Original entry on oeis.org
1, 2, 1, 6, 5, 1, 24, 23, 10, 1, 120, 119, 78, 17, 1, 720, 719, 588, 207, 26, 1, 5040, 5039, 4611, 2279, 458, 37, 1, 40320, 40319, 38890, 24553, 6996, 891, 50, 1, 362880, 362879, 358018, 268521, 101072, 18043, 1578, 65, 1, 3628800, 3628799, 3612004, 3042210, 1438112, 337210, 40884, 2603, 82, 1
Offset: 1
T(3,2) = 5. All 3! = 6 permutations of {1,2,3} contain an increasing subsequence of length 2 with the exception of 321.
Triangle T(n,k) begins:
1;
2, 1;
6, 5, 1;
24, 23, 10, 1;
120, 119, 78, 17, 1;
720, 719, 588, 207, 26, 1;
5040, 5039, 4611, 2279, 458, 37, 1;
...
-
h:= proc(l) local n; n:=nops(l); add(i, i=l)! /mul(mul(1+l[i]-j
+add(`if`(l[k]>=j, 1, 0), k=i+1..n), j=1..l[i]), i=1..n)
end:
g:= (n, i, l)-> `if`(n=0 or i=1, h([l[], 1$n])^2, `if`(i<1, 0,
add(g(n-i*j, i-1, [l[], i$j]), j=0..n/i))):
T:= (n, k)-> n! -g(n, k-1, []):
seq(seq(T(n, k), k=1..n), n=1..12);
-
h[l_] := With[{n = Length[l]}, Sum[i, {i, l}]! / Product[Product[1 + l[[i]] - j + Sum[If[l[[k]] >= j, 1, 0], {k, i+1, n}], {j, 1, l[[i]]}], {i, 1, n}] ]; g[n_, i_, l_] := If[n == 0 || i === 1, h[Join[l, Array[1&, n]]]^2, If[i < 1, 0, Sum[g[n - i*j, i-1, Join[l, Array[i&, j]]], {j, 0, n/i}]]]; t[n_, k_] := n! - g[n, k-1, {}]; Table[Table[t[n, k], {k, 1, n}], {n, 1, 12}] // Flatten (* Jean-François Alcover, Dec 17 2013, translated from Maple *)
A054991
Number of prime divisors of n! - 1 (counted with multiplicity).
Original entry on oeis.org
0, 0, 1, 1, 2, 1, 1, 2, 3, 2, 4, 1, 2, 1, 5, 2, 3, 3, 3, 2, 4, 3, 2, 2, 3, 2, 2, 4, 5, 1, 3, 1, 1, 2, 3, 2, 5, 1, 4, 2, 4, 4, 7, 4, 5, 5, 2, 4, 3, 2, 5, 5, 4, 6, 6, 5, 6, 5, 2, 3, 4, 4, 5, 4, 6, 4, 7, 2, 6, 5, 5, 3, 4, 5, 7, 3, 5, 4, 2, 4, 4, 4, 4, 6, 2, 3, 4
Offset: 1
Arne Ring (arne.ring(AT)epost.de), May 30 2000
a(2)=0 because 2! - 1 = 1 (and this is not a prime number) a(5)=2 because 5! -1 = 119 = 7 * 17
-
a[q_] := Module[{x, n}, x=FactorInteger[q!-1]; n=Length[x]; Sum[Table[x[[i]][[2]], {i, n}][[j]], {j, n}]]
A054991[n_Integer] := PrimeOmega[n! - 1]; A054991[1] = 0; Table[A054991[n], {n,2,100}] (* Vladimir Joseph Stephan Orlovsky, Jul 22 2011 *)
A002582
Largest prime factor of n! - 1.
Original entry on oeis.org
1, 5, 23, 17, 719, 5039, 1753, 2999, 125131, 7853, 479001599, 3593203, 87178291199, 1510259, 6880233439, 256443711677, 478749547, 78143369, 19499250680671, 4826713612027, 170006681813, 498390560021687969, 991459181683, 114776274341482621993
Offset: 2
- M. Kraitchik, On the divisibility of factorials, Scripta Math., 14 (1948), 24-26 (but beware errors).
- N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
- N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
- Sean A. Irvine, Table of n, a(n) for n = 2..135
- A. Borning, Some results for k!+-1 and 2.3.5...p+-1, Math. Comp., 26 (1972), 567-570.
- P. Erdős and C. L. Stewart, On the greatest and least prime factors of n! + 1, J. London Math. Soc. (2) 13:3 (1976), pp. 513-519.
- M. Kraitchik, On the divisibility of factorials, Scripta Math., 14 (1948), 24-26 (but beware errors). [Annotated scanned copy]
- Hisanori Mishima, Factorizations of many number sequences
- Hisanori Mishima, Factorizations of many number sequences
- R. G. Wilson v, Explicit factorizations
- J. W. Wrench, Jr., Letters to N. J. A. Sloane, Feb 1974
-
[1] cat [Maximum(PrimeDivisors(Factorial(n)-1)): n in [3..30]]; // Vincenzo Librandi, Feb 14 2020
-
Table[FactorInteger[n! - 1][[-1, 1]], {n, 2, 25}] (* Harvey P. Dale, Aug 29 2011 *)
-
a(n)=if(n>2,my(f=factor(n!-1)[,1]);f[#f],1) \\ Charles R Greathouse IV, Dec 05 2012
A028418
Sum over all n! permutations of n letters of maximum cycle length.
Original entry on oeis.org
1, 3, 13, 67, 411, 2911, 23563, 213543, 2149927, 23759791, 286370151, 3734929903, 52455166063, 788704078527, 12648867695311, 215433088624351, 3884791172487903, 73919882720901823, 1480542628345939807, 31128584449987511871, 685635398619169059391
Offset: 1
Joe Keane (jgk(AT)jgk.org)
- S. W. Golomb, Shift-Register Sequences, Holden-Day, San Francisco, 1967, p. 183.
- R. Sedgewick and P. Flajolet, Analysis of Algorithms, Addison Wesley, 1996, page 358.
-
b:= proc(n, m) option remember; `if`(n=0, m, add((j-1)!*
b(n-j, max(m,j))*binomial(n-1, j-1), j=1..n))
end:
a:= n-> b(n, 0):
seq(a(n), n=1..25); # Alois P. Heinz, May 14 2016
-
kmax = 19; gf[x_] = Sum[ 1/(1-x) - 1/(E^((x^(1+k)*Hypergeometric2F1[1+k, 1, 2+k, x])/ (1+k))*(1-x)), {k, 0, kmax}];
a[n_] := n!*Coefficient[Series[gf[x], {x, 0, kmax}], x^n]; Array[a, kmax]
(* Jean-François Alcover, Jun 22 2011, after e.g.f. *)
a[ n_] := If[ n < 1, 0, 1 + Total @ Apply[ Max, Map[ Length, First /@ PermutationCycles /@ Drop[ Permutations @ Range @ n, 1], {2}], 1]]; (* Michael Somos, Aug 19 2018 *)
A139174
a(n) = (n!-4)/4.
Original entry on oeis.org
5, 29, 179, 1259, 10079, 90719, 907199, 9979199, 119750399, 1556755199, 21794572799, 326918591999, 5230697471999, 88921857023999, 1600593426431999, 30411275102207999, 608225502044159999
Offset: 4
-
[(Factorial(n)-4)/4: n in [4..25]]; // Vincenzo Librandi, Jul 20 2011
-
Table[(n! - 4)/4, {n, 4, 20}]
Comments