%I A034968
%S A034968 0,1,1,2,2,3,1,2,2,3,3,4,2,3,3,4,4,5,3,4,4,5,5,6,1,2,2,3,3,4,2,3,3,4,4,
5,
%T A034968 3,4,4,5,5,6,4,5,5,6,6,7,2,3,3,4,4,5,3,4,4,5,5,6,4,5,5,6,6,7,5,6,6,7,7,
%U A034968 8,3,4,4,5,5,6,4,5,5,6,6,7,5,6,6,7,7,8,6,7,7,8,8,9,4,5,5,6,6,7,5,6,6,7
%N A034968 Minimal number of factorials which add to n.
%C A034968 Equivalently, sum of digits when n is written in factorial base (A007623).
%C A034968 Also minimum number of adjacent transpositions needed to produce each
permutation in the list A055089 (or number of swappings needed to
bubble sort each such permutation).
%F A034968 a(n)=n-sum(i>=2, (i-1)*floor(n/i!)) - Benoit Cloitre (benoit7848c(AT)orange.fr),
Aug 26 2003
%F A034968 G.f. 1/(1-x)*Sum_{k>0}(Sum_{i=1}^k i*x^(i*k!))/(Sum_{i=0}^k x^(i*k!))
[From Franklin T. Adams-Watters (FrankTAW(AT)Netscape.net), May 13
2009]
%e A034968 a(205=1!*1+3!*2+4!*3+5!*1)=1+2+3+1=6.
%p A034968 [seq(convert(fac_base(j),`+`),j=0..119)]; # fac_base and PermRevLexUnrank
given in A055089. Perm2InversionVector in A064039
%p A034968 Or alternatively: [seq(convert(Perm2InversionVector(PermRevLexUnrank(j)),
`+`),j=0..119)];
%o A034968 (PARI) a(n)=local(k,r);k=2;r=0;while(n>0,r+=n%k;n\=k;k++);r [From Franklin
T. Adams-Watters (FrankTAW(AT)Netscape.net), May 13 2009]
%Y A034968 Partial sums of first n! terms: A001809. See A055091 for the minimum
number of any transpositions. A034968[A056019[n]] = A034968[n] for
all n.
%Y A034968 Sequence in context: A097028 A092331 A089293 this_sequence A054707 A166269
A055460
%Y A034968 Adjacent sequences: A034965 A034966 A034967 this_sequence A034969 A034970
A034971
%K A034968 nonn
%O A034968 0,4
%A A034968 Erich Friedman (erich.friedman(AT)stetson.edu)
%E A034968 Additional comments from Antti Karttunen, Aug 23, 2001.
|