%I #123 Jul 23 2022 05:53:42
%S 1,2,1,2,1,3,1,2,1,2,1,3,1,2,1,2,1,3,1,2,1,2,1,4,1,2,1,2,1,3,1,2,1,2,
%T 1,3,1,2,1,2,1,3,1,2,1,2,1,4,1,2,1,2,1,3,1,2,1,2,1,3,1,2,1,2,1,3,1,2,
%U 1,2,1,4,1,2,1,2,1,3,1,2,1,2,1,3,1,2,1,2,1,3,1,2,1,2,1,4,1,2,1,2,1,3,1,2,1
%N a(n) = largest m such that m! divides n.
%C Number of factorial divisors of n. - _Amarnath Murthy_, Oct 19 2002
%C The sequence may be constructed as follows. Step 1: start with 1, concatenate and add +1 to last term gives: 1,2. Step 2: 2 is the last term so concatenate twice those terms and add +1 to last term gives: 1, 2, 1, 2, 1, 3 we get 6 terms. Step 3: 3 is the last term, concatenate 3 times those 6 terms and add +1 to last term gives: 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 4, iterates. At k-th step we obtain (k+1)! terms. - _Benoit Cloitre_, Mar 11 2003
%C From _Benoit Cloitre_, Aug 17 2007, edited by _M. F. Hasler_, Jun 28 2016:
%C Another way to construct the sequence: start from an infinite series of 1's:
%C 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ... Replace every second 1 by a 2 giving:
%C 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, ... Replace every third 2 by a 3 giving:
%C 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 3, ... Replace every fourth 3 by a 4 etc. (End)
%C This sequence is the fixed point, starting with 1, of the morphism m, where m(1) = 1, 2, and for k > 1, m(k) is the concatenation of m(k - 1), the sequence up to the first k, and k + 1. Thus m(2) = 1, 2, 1, 3; m(3) = 1, 2, 1, 3, 1, 2, 1, 2, 1, 4; m(4) = 1, 2, 1, 3, 1, 2, 1, 2, 1, 4, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 1, 5, etc. - _Franklin T. Adams-Watters_, Jun 10 2009
%C All permutations of n elements can be listed as follows: Start with the (arbitrary) permutation P(0), and to obtain P(n + 1), reverse the first a(n) + 1 elements in P(n). The last permutation is the reversal of the first, so the path is a cycle in the underlying graph. See example and fxtbook link. - _Joerg Arndt_, Jul 16 2011
%C Positions of rightmost change with incrementing rising factorial numbers, see example. - _Joerg Arndt_, Dec 15 2012
%C Records appear at factorials. - _Robert G. Wilson v_, Dec 21 2012
%C One more than the number of trailing zeros (A230403(n)) in the factorial base representation of n (A007623(n)). - _Antti Karttunen_, Nov 18 2013
%C A062356(n) and a(n) coincide quite often. - _R. J. Cano_, Aug 04 2014
%C For n>0 and 1<=j<=(n+1)!-1, (n+1)^2-1=A005563(n) is the number of times that a(j)=n-1. - _R. J. Cano_, Dec 23 2016
%H Antti Karttunen, <a href="/A055881/b055881.txt">Table of n, a(n) for n = 1..10080</a>
%H Joerg Arndt, <a href="http://www.jjj.de/fxt/#fxtbook">Matters Computational (The Fxtbook)</a>, section 10.4, pp.245-248 (prefix reversals); section 10.5, pp. 248-250 (Heap's method).
%H R. J. Cano, <a href="http://oeis.org/w/images/b/ba/A055881.txt">Alternative sequencer</a> (PARI/GP).
%H Claude Lenormand, <a href="/A055881/a055881.txt">Comments on this sequence</a>.
%H József Sándor, <a href="http://www.gallup.unm.edu/~smarandache/Sandor43.pdf">On Additive Analogues of Certain Arithmetic Smarandache Functions</a>.
%H <a href="/index/Fa#facbase">Index entries for sequences related to factorial base representation</a>.
%F G.f.: Sum_{k > 0} x^(k!)/(1 - x^(k!)). - _Vladeta Jovovic_, Dec 13 2002
%F a(n) = A230403(n)+1. - _Antti Karttunen_, Nov 18 2013
%F a(n) = A230415(n-1,n) = A230415(n,n-1) = A230417(n,n-1). - _Antti Karttunen_, Nov 19 2013
%F a(m!+n) = a(n) if 1 <= n <= m*m! - 1 = A001563(m) - 1. - _R. J. Cano_, Jun 27 2016
%F Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = e - 1 (A091131). - _Amiram Eldar_, Jul 23 2022
%e a(12) = 3 because 3! is highest factorial to divide 12.
%e From _Joerg Arndt_, Jul 16 2011: (Start)
%e All permutations of 4 elements via prefix reversals:
%e n: permutation a(n)+1
%e 0: [ 0 1 2 3 ] -
%e 1: [ 1 0 2 3 ] 2
%e 2: [ 2 0 1 3 ] 3
%e 3: [ 0 2 1 3 ] 2
%e 4: [ 1 2 0 3 ] 3
%e 5: [ 2 1 0 3 ] 2
%e 6: [ 3 0 1 2 ] 4
%e 7: [ 0 3 1 2 ] 2
%e 8: [ 1 3 0 2 ] 3
%e 9: [ 3 1 0 2 ] 2
%e 10: [ 0 1 3 2 ] 3
%e 11: [ 1 0 3 2 ] 2
%e 12: [ 2 3 0 1 ] 4
%e 13: [ 3 2 0 1 ] 2
%e 14: [ 0 2 3 1 ] 3
%e 15: [ 2 0 3 1 ] 2
%e 16: [ 3 0 2 1 ] 3
%e 17: [ 0 3 2 1 ] 2
%e 18: [ 1 2 3 0 ] 4
%e 19: [ 2 1 3 0 ] 2
%e 20: [ 3 1 2 0 ] 3
%e 21: [ 1 3 2 0 ] 2
%e 22: [ 2 3 1 0 ] 3
%e 23: [ 3 2 1 0 ] 2
%e (End)
%e From _Joerg Arndt_, Dec 15 2012: (Start)
%e The first few rising factorial numbers (dots for zeros) with 4 digits and the positions of the rightmost change with incrementing are:
%e [ 0] [ . . . . ] -
%e [ 1] [ 1 . . . ] 1
%e [ 2] [ . 1 . . ] 2
%e [ 3] [ 1 1 . . ] 1
%e [ 4] [ . 2 . . ] 2
%e [ 5] [ 1 2 . . ] 1
%e [ 6] [ . . 1 . ] 3
%e [ 7] [ 1 . 1 . ] 1
%e [ 8] [ . 1 1 . ] 2
%e [ 9] [ 1 1 1 . ] 1
%e [10] [ . 2 1 . ] 2
%e [11] [ 1 2 1 . ] 1
%e [12] [ . . 2 . ] 3
%e [13] [ 1 . 2 . ] 1
%e [14] [ . 1 2 . ] 2
%e [15] [ 1 1 2 . ] 1
%e [16] [ . 2 2 . ] 2
%e [17] [ 1 2 2 . ] 1
%e [18] [ . . 3 . ] 3
%e [19] [ 1 . 3 . ] 1
%e [20] [ . 1 3 . ] 2
%e [21] [ 1 1 3 . ] 1
%e [22] [ . 2 3 . ] 2
%e [23] [ 1 2 3 . ] 1
%e [24] [ . . . 1 ] 4
%e [25] [ 1 . . 1 ] 1
%e [26] [ . 1 . 1 ] 2
%e (End)
%t Table[Length[Intersection[Divisors[n], Range[5]!]], {n, 125}] (* _Alonso del Arte_, Dec 10 2012 *)
%t f[n_] := Block[{m = 1}, While[Mod[n, m!] == 0, m++]; m - 1]; Array[f, 105] (* _Robert G. Wilson v_, Dec 21 2012 *)
%o (Scheme)
%o (define (A055881 n) (let loop ((n n) (i 2)) (cond ((not (zero? (modulo n i))) (- i 1)) (else (loop (/ n i) (+ 1 i))))))
%o (PARI) See Cano link.
%o (PARI) n=5; f=n!; x='x+O('x^f); Vec(sum(k=1,n,x^(k!)/(1-x^(k!)))) \\ _Joerg Arndt_, Jan 28 2014
%o (PARI) a(n)=for(k=2,n+1,if(n%k, return(k-1),n/=k)) \\ _Charles R Greathouse IV_, May 28 2015
%Y Cf. A055874, A055926, A055770, A062356, A073575, A091131, A230403, A230404, A230405, A076733, A232096, A232098, A233285, A233267, A233269, A231719, A232741, A232742, A232743, A232744, A232745, A060832 (partial sums).
%Y This sequence occurs also in the next to middle diagonals of A230415 and as the second rightmost column of triangle A230417.
%Y Other sequences related to factorial base representation (A007623): A034968, A084558, A099563, A060130, A227130, A227132, A227148, A227149, A153880.
%Y Analogous sequence for binary (base-2) representation: A001511.
%K easy,nonn
%O 1,2
%A _Leroy Quet_ and _Labos Elemer_, Jul 16 2000