A060130
Number of nonzero digits in factorial base representation (A007623) of n; minimum number of transpositions needed to compose each permutation in the lists A060117 & A060118.
Original entry on oeis.org
0, 1, 1, 2, 1, 2, 1, 2, 2, 3, 2, 3, 1, 2, 2, 3, 2, 3, 1, 2, 2, 3, 2, 3, 1, 2, 2, 3, 2, 3, 2, 3, 3, 4, 3, 4, 2, 3, 3, 4, 3, 4, 2, 3, 3, 4, 3, 4, 1, 2, 2, 3, 2, 3, 2, 3, 3, 4, 3, 4, 2, 3, 3, 4, 3, 4, 2, 3, 3, 4, 3, 4, 1, 2, 2, 3, 2, 3, 2, 3, 3, 4, 3, 4, 2, 3, 3, 4, 3, 4, 2, 3, 3, 4, 3, 4, 1, 2, 2, 3, 2, 3, 2, 3, 3
Offset: 0
19 = 3*(3!) + 0*(2!) + 1*(1!), thus it is written as "301" in factorial base (A007623). The count of nonzero digits in that representation is 2, so a(19) = 2.
Cf.
A007623,
A034968,
A055091,
A060117,
A060118,
A060128,
A060129,
A060131,
A060502,
A257687,
A275734,
A275735,
A276076.
The topmost row and the leftmost column in array
A230415, the left edge of triangle
A230417.
Differs from similar
A267263 for the first time at n=30.
-
A060130(n) = count_nonfixed(convert(PermUnrank3R(n), 'disjcyc'))-nops(convert(PermUnrank3R(n), 'disjcyc')) or nops(fac_base(n))-nops(positions(0, fac_base(n)))
fac_base := n -> fac_base_aux(n, 2); fac_base_aux := proc(n, i) if(0 = n) then RETURN([]); else RETURN([op(fac_base_aux(floor(n/i), i+1)), (n mod i)]); fi; end;
count_nonfixed := l -> convert(map(nops, l), `+`);
positions := proc(e, ll) local a, k, l, m; l := ll; m := 1; a := []; while(member(e, l[m..nops(l)], 'k')) do a := [op(a), (k+m-1)]; m := k+m; od; RETURN(a); end;
# For procedure PermUnrank3R see A060117
-
Block[{nn = 105, r}, r = MixedRadix[Reverse@ Range[2, -1 + SelectFirst[Range@ 12, #! > nn &]]]; Array[Count[IntegerDigits[#, r], k_ /; k > 0] &, nn, 0]] (* Michael De Vlieger, Dec 30 2017 *)
-
(define (A060130 n) (let loop ((n n) (i 2) (s 0)) (cond ((zero? n) s) (else (loop (quotient n i) (+ 1 i) (+ s (if (zero? (remainder n i)) 0 1)))))))
;; Two other implementations, that use memoization-macro definec:
(definec (A060130 n) (if (zero? n) n (+ 1 (A060130 (A257687 n)))))
(definec (A060130 n) (if (zero? n) n (+ (A257511 n) (A060130 (A257684 n)))))
;; Antti Karttunen, Dec 30 2017
Example-section added, name edited, the old Maple-code moved away from the formula-section, and replaced with all the new formulas by
Antti Karttunen, Dec 30 2017
A055881
a(n) = largest m such that m! divides n.
Original entry on oeis.org
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, 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, 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
Offset: 1
a(12) = 3 because 3! is highest factorial to divide 12.
From _Joerg Arndt_, Jul 16 2011: (Start)
All permutations of 4 elements via prefix reversals:
n: permutation a(n)+1
0: [ 0 1 2 3 ] -
1: [ 1 0 2 3 ] 2
2: [ 2 0 1 3 ] 3
3: [ 0 2 1 3 ] 2
4: [ 1 2 0 3 ] 3
5: [ 2 1 0 3 ] 2
6: [ 3 0 1 2 ] 4
7: [ 0 3 1 2 ] 2
8: [ 1 3 0 2 ] 3
9: [ 3 1 0 2 ] 2
10: [ 0 1 3 2 ] 3
11: [ 1 0 3 2 ] 2
12: [ 2 3 0 1 ] 4
13: [ 3 2 0 1 ] 2
14: [ 0 2 3 1 ] 3
15: [ 2 0 3 1 ] 2
16: [ 3 0 2 1 ] 3
17: [ 0 3 2 1 ] 2
18: [ 1 2 3 0 ] 4
19: [ 2 1 3 0 ] 2
20: [ 3 1 2 0 ] 3
21: [ 1 3 2 0 ] 2
22: [ 2 3 1 0 ] 3
23: [ 3 2 1 0 ] 2
(End)
From _Joerg Arndt_, Dec 15 2012: (Start)
The first few rising factorial numbers (dots for zeros) with 4 digits and the positions of the rightmost change with incrementing are:
[ 0] [ . . . . ] -
[ 1] [ 1 . . . ] 1
[ 2] [ . 1 . . ] 2
[ 3] [ 1 1 . . ] 1
[ 4] [ . 2 . . ] 2
[ 5] [ 1 2 . . ] 1
[ 6] [ . . 1 . ] 3
[ 7] [ 1 . 1 . ] 1
[ 8] [ . 1 1 . ] 2
[ 9] [ 1 1 1 . ] 1
[10] [ . 2 1 . ] 2
[11] [ 1 2 1 . ] 1
[12] [ . . 2 . ] 3
[13] [ 1 . 2 . ] 1
[14] [ . 1 2 . ] 2
[15] [ 1 1 2 . ] 1
[16] [ . 2 2 . ] 2
[17] [ 1 2 2 . ] 1
[18] [ . . 3 . ] 3
[19] [ 1 . 3 . ] 1
[20] [ . 1 3 . ] 2
[21] [ 1 1 3 . ] 1
[22] [ . 2 3 . ] 2
[23] [ 1 2 3 . ] 1
[24] [ . . . 1 ] 4
[25] [ 1 . . 1 ] 1
[26] [ . 1 . 1 ] 2
(End)
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).
This sequence occurs also in the next to middle diagonals of
A230415 and as the second rightmost column of triangle
A230417.
Analogous sequence for binary (base-2) representation:
A001511.
-
Table[Length[Intersection[Divisors[n], Range[5]!]], {n, 125}] (* Alonso del Arte, Dec 10 2012 *)
f[n_] := Block[{m = 1}, While[Mod[n, m!] == 0, m++]; m - 1]; Array[f, 105] (* Robert G. Wilson v, Dec 21 2012 *)
-
See Cano link.
-
n=5; f=n!; x='x+O('x^f); Vec(sum(k=1,n,x^(k!)/(1-x^(k!)))) \\ Joerg Arndt, Jan 28 2014
-
a(n)=for(k=2,n+1,if(n%k, return(k-1),n/=k)) \\ Charles R Greathouse IV, May 28 2015
-
(define (A055881 n) (let loop ((n n) (i 2)) (cond ((not (zero? (modulo n i))) (- i 1)) (else (loop (/ n i) (+ 1 i))))))
A230415
Square array T(i,j) giving the number of differing digits in the factorial base representations of i and j, for i >= 0, j >= 0, read by antidiagonals.
Original entry on oeis.org
0, 1, 1, 1, 0, 1, 2, 2, 2, 2, 1, 1, 0, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 1, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 0, 1, 2, 1, 2, 3, 3, 3, 3, 1, 1, 3, 3, 3, 3, 2, 2, 1, 2, 2, 0, 2, 2, 1, 2, 2, 3, 3, 2, 2, 3, 3, 3, 3, 2, 2, 3, 3, 1, 2, 2, 1, 2, 2, 0, 2, 2, 1, 2, 2, 1, 2, 2, 3, 3, 3, 3, 1, 1, 3, 3, 3, 3, 2, 2, 2, 1, 2, 2, 1, 2, 1, 0, 1, 2, 1, 2, 2, 1, 2
Offset: 0
The top left corner of this square array begins as:
0, 1, 1, 2, 1, 2, 1, 2, 2, 3, 2, ...
1, 0, 2, 1, 2, 1, 2, 1, 3, 2, 3, ...
1, 2, 0, 1, 1, 2, 2, 3, 1, 2, 2, ...
2, 1, 1, 0, 2, 1, 3, 2, 2, 1, 3, ...
1, 2, 1, 2, 0, 1, 2, 3, 2, 3, 1, ...
2, 1, 2, 1, 1, 0, 3, 2, 3, 2, 2, ...
1, 2, 2, 3, 2, 3, 0, 1, 1, 2, 1, ...
2, 1, 3, 2, 3, 2, 1, 0, 2, 1, 2, ...
2, 3, 1, 2, 2, 3, 1, 2, 0, 1, 1, ...
3, 2, 2, 1, 3, 2, 2, 1, 1, 0, 2, ...
2, 3, 2, 3, 1, 2, 1, 2, 1, 2, 0, ...
...
For example, T(1,2) = T(2,1) = 2 as 1 has factorial base representation '...0001' and 2 has factorial base representation '...0010', and they differ by their two least significant digits.
On the other hand, T(3,5) = T(5,3) = 1, as 3 has factorial base representation '...0011' and 5 has factorial base representation '...0021', and they differ only by their second rightmost digit.
Note that as A007623(6)='100' and A007623(10)='120', we have T(6,10) = T(10,6) = 1 (instead of 2 as in A231713, cf. also its Example section), as here we count only the number of differing digit positions, but ignore the magnitudes of their differences.
The topmost row and the leftmost column:
A060130.
-
nn = 14; m = 1; While[m! < nn, m++]; m; Table[Function[w, Count[Subtract @@ Map[PadLeft[#, Max@ Map[Length, w]] &, w], k_ /; k != 0]]@ Map[IntegerDigits[#, MixedRadix[Reverse@ Range[2, m]]] &, {i - j, j}], {i, 0, nn}, {j, 0, i}] // Flatten (* Michael De Vlieger, Jun 27 2016, Version 10.2 *)
-
(define (A230415 n) (A230415bi (A025581 n) (A002262 n)))
(define (A230415bi x y) (let loop ((x x) (y y) (i 2) (d 0)) (cond ((and (zero? x) (zero? y)) d) (else (loop (floor->exact (/ x i)) (floor->exact (/ y i)) (+ i 1) (+ d (if (= (modulo x i) (modulo y i)) 0 1)))))))
A231714
Lower triangular region of A231713; A triangular table read by rows: T(n,k) = sum of absolute values of digit differences in the factorial base representations (A007623) of n and k, where (n, k) = (0,0), (1,0), (1,1), (2,0), (2,1), (2,2), ..., n >= 0 and (0 <= k <= n).
Original entry on oeis.org
0, 1, 0, 1, 2, 0, 2, 1, 1, 0, 2, 3, 1, 2, 0, 3, 2, 2, 1, 1, 0, 1, 2, 2, 3, 3, 4, 0, 2, 1, 3, 2, 4, 3, 1, 0, 2, 3, 1, 2, 2, 3, 1, 2, 0, 3, 2, 2, 1, 3, 2, 2, 1, 1, 0, 3, 4, 2, 3, 1, 2, 2, 3, 1, 2, 0, 4, 3, 3, 2, 2, 1, 3, 2, 2, 1, 1, 0, 2, 3, 3, 4, 4, 5, 1, 2, 2, 3, 3, 4, 0, 3, 2, 4, 3, 5, 4, 2, 1, 3, 2, 4, 3, 1, 0, 3, 4, 2, 3, 3, 4, 2, 3, 1, 2, 2, 3, 1, 2, 0
Offset: 0
This triangular table begins as:
0;
1, 0;
1, 2, 0;
2, 1, 1, 0;
2, 3, 1, 2, 0;
3, 2, 2, 1, 1, 0;
1, 2, 2, 3, 3, 4, 0;
2, 1, 3, 2, 4, 3, 1, 0;
...
Please see A231713 for examples how the terms are computed.
This is a lower, or equivalently, an upper triangular subregion of symmetric square array
A231713. Cf.
A230417.
Showing 1-4 of 4 results.
Comments