[go: up one dir, main page]

login
Search: a275958 -id:a275958
     Sort: relevance | references | number | modified | created      Format: long | short | data
Write n in factorial base, then replace each nonzero digit d of radix k with k-d.
+10
59
0, 1, 4, 5, 2, 3, 18, 19, 22, 23, 20, 21, 12, 13, 16, 17, 14, 15, 6, 7, 10, 11, 8, 9, 96, 97, 100, 101, 98, 99, 114, 115, 118, 119, 116, 117, 108, 109, 112, 113, 110, 111, 102, 103, 106, 107, 104, 105, 72, 73, 76, 77, 74, 75, 90, 91, 94, 95, 92, 93, 84, 85, 88, 89, 86, 87, 78, 79, 82, 83, 80, 81, 48, 49, 52, 53, 50, 51, 66, 67, 70, 71, 68
OFFSET
0,3
COMMENTS
Analogous to A004488 or A048647 for the factorial base.
A self-inverse permutation of the natural numbers.
From Antti Karttunen, Aug 16-29 2016: (Start)
Consider the following way to view a factorial base representation of nonnegative integer n. For each nonzero digit d_i present in the factorial base representation of n (where i is the radix = 2.. = one more than 1-based position from the right), we place a pebble to the level (height) d_i at the corresponding column i of the triangular diagram like below, while for any zeros the corresponding columns are left empty:
.
Level
6 o
─ ─
5 . .
─ ─ ─
4 . . .
─ ─ ─ ─
3 . . . .
─ ─ ─ ─ ─
2 . . o . .
─ ─ ─ ─ ─ ─
1 . o . . o o
─ ─ ─ ─ ─ ─ ─
Radix: 7 6 5 4 3 2
Digits: 6 1 2 0 1 1 = A007623(4491)
Instead of levels, we can observe on which "slope" each pebble (nonzero digit) is located at. Formally, the slope of nonzero digit d_i with radix i is (i - d_i). Thus in above example, both the most significant digit (6) and the least significant 1 are on slope 1 (called "maximal slope", because it contains digits that are maximal allowed in those positions), while the second 1 from the right is on slope 2 ("submaximal slope").
This involution (A225901) sends each nonzero digit at level k to the slope k (and vice versa) by flipping such a diagram by the shallow diagonal axis that originates from the bottom right corner. Thus, from above diagram we obtain:
Slope (= digit's radix - digit's value)
1
2 .
3 . .╲
4 . .╲o╲
5 . .╲.╲.╲
6 . .╲.╲o╲.╲
. .╲.╲.╲.╲o╲
o╲.╲.╲.╲.╲o╲
-----------------
1 5 3 0 2 1 = A007623(1397)
and indeed, a(4491) = 1397 and a(1397) = 4491.
Thus this permutation maps between polynomial encodings A275734 & A275735 and all the respective sequences obtained from them, where the former set of sequences are concerned with the "slopes" and the latter set with the "levels" of the factorial base representation. See the Crossrefs section.
Sequences A231716 and A275956 are closed with respect to this sequence, in other words, for all n, a(A231716(n)) is a term of A231716 and a(A275956(n)) is a term of A275956.
(End)
FORMULA
From Antti Karttunen, Aug 29 2016: (Start)
a(0) = 0; for n >= 1, a(n) = A276091(A275736(n)) + A153880(a(A257684(n))).
or, for n >= 1, a(n) = A276149(n) + a(A257687(n)).
(End)
Other identities. For n >= 0:
a(n!) = A001563(n).
a(n!-1) = A007489(n-1).
From Antti Karttunen, Aug 16 2016: (Start)
A275734(a(n)) = A275735(n) and vice versa, A275735(a(n)) = A275734(n).
A060130(a(n)) = A060130(n). [The flip preserves the number of nonzero digits.]
A153880(n) = a(A255411(a(n))) and A255411(n) = a(A153880(a(n))). [This involution conjugates between the two fundamental factorial base shifts.]
a(n) = A257684(a(A153880(n))) = A266193(a(A255411(n))). [Follows from above.]
A276011(n) = A273662(a(A273670(n))).
A276012(n) = A273663(a(A256450(n))).
(End)
EXAMPLE
a(1000) = a(1*6! + 2*5! + 1*4! + 2*3! + 2*2!) = (7-1)*6! + (6-2)*5! + (5-1)*4! + (4-2)*3! + (3-2)*2! = 4910.
a(1397) = a(1*6! + 5*5! + 3*4! + 0*3! + 2*2! + 1*1!) = (7-1)*6! + (6-5)*5! + (5-3)*4! + (3-2)*2! + (2-1)*1! = 4491.
MATHEMATICA
b = MixedRadix[Reverse@ Range[2, 12]]; Table[FromDigits[Map[Boole[# > 0] &, #] (Reverse@ Range[2, Length@ # + 1] - #), b] &@ IntegerDigits[n, b], {n, 0, 82}] (* Version 10.2, or *)
f[n_] := Block[{a = {{0, n}}}, Do[AppendTo[a, {First@ #, Last@ #} &@ QuotientRemainder[a[[-1, -1]], Times @@ Range[# - i]]], {i, 0, #}] &@ NestWhile[# + 1 &, 0, Times @@ Range[# + 1] <= n &]; Most@ Rest[a][[All, 1]] /. {} -> {0}]; g[w_List] := Total[Times @@@ Transpose@ {Map[Times @@ # &, Range@ Range[0, Length@ w]], Reverse@ Append[w, 0]}]; Table[g[Map[Boole[# > 0] &, #] (Reverse@ Range[2, Length@ # + 1] - #)] &@ f@ n, {n, 0, 82}] (* Michael De Vlieger, Aug 29 2016 *)
PROG
(PARI) a(n)=my(s=0, d, k=2); while(n, d=n%k; n=n\k; if(d, s=s+(k-d)*(k-1)!); k=k+1); return(s)
(Scheme)
(define (A225901 n) (let loop ((n n) (z 0) (m 2) (f 1)) (cond ((zero? n) z) (else (loop (quotient n m) (if (zero? (modulo n m)) z (+ z (* f (- m (modulo n m))))) (+ 1 m) (* f m))))))
;; One implementing the first recurrence, with memoization-macro definec:
(definec (A225901 n) (if (zero? n) n (+ (A276091 (A275736 n)) (A153880 (A225901 (A257684 n))))))
;; Antti Karttunen, Aug 29 2016
(Python)
from sympy import factorial as f
def a(n):
s=0
k=2
while(n):
d=n%k
n=(n//k)
if d: s=s+(k - d)*f(k - 1)
k+=1
return s
print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 19 2017
CROSSREFS
Cf. A275959 (fixed points), A231716, A275956.
This involution maps between the following sequences related to "levels" and "slopes" (see comments): A275806 <--> A060502, A257511 <--> A260736, A264990 <--> A275811, A275729 <--> A275728, A275948 <--> A275946, A275949 <--> A275947, A275964 <--> A275962, A059590 <--> A276091.
KEYWORD
nonn,base
AUTHOR
Paul Tek, May 20 2013
STATUS
approved
Self-inverse infinite permutation which shows the position of the inverse of each finite permutation in A060117 (or A060118) in the same sequence; or equally, the cross-indexing between A060117 and A060118.
+10
18
0, 1, 2, 5, 4, 3, 6, 7, 14, 23, 22, 15, 12, 19, 8, 11, 16, 21, 18, 13, 20, 17, 10, 9, 24, 25, 26, 29, 28, 27, 54, 55, 86, 119, 118, 87, 84, 115, 56, 59, 88, 117, 114, 85, 116, 89, 58, 57, 48, 49, 74, 101, 100, 75, 30, 31, 38, 47, 46, 39, 60, 67, 80, 107, 112, 93, 66, 61, 92
OFFSET
0,3
COMMENTS
PermRank3Aux is a slight modification of rank2 algorithm presented in Myrvold-Ruskey article.
MAPLE
with(group); permul := (a, b) -> mulperms(b, a); swap := (p, i, j) -> convert(permul(convert(p, 'disjcyc'), [[i, j]]), 'permlist', nops(p));
PermRank3Aux := proc(n, p, q) if(1 = n) then RETURN(0); else RETURN((n-p[n])*((n-1)!) + PermRank3Aux(n-1, swap(p, n, q[n]), swap(q, n, p[n]))); fi; end;
PermRank3R := p -> PermRank3Aux(nops(p), p, convert(invperm(convert(p, 'disjcyc')), 'permlist', nops(p)));
PermRank3L := p -> PermRank3Aux(nops(p), convert(invperm(convert(p, 'disjcyc')), 'permlist', nops(p)), p);
# a(n) = PermRank3L(PermUnrank3R(n)) or PermRank3R(PermUnrank3L(n)) or PermRank3L(convert(invperm(convert(PermUnrank3L(j), 'disjcyc')), 'permlist', nops(PermUnrank3L(j))))
CROSSREFS
Cf. A261220 (fixed points).
Cf. A056019 (compare the scatter plots).
KEYWORD
nonn,base,look
AUTHOR
Antti Karttunen, Mar 02 2001
STATUS
approved
Permutation of nonnegative integers: a(n) = A225901(A060125(n)).
+10
5
0, 1, 4, 3, 2, 5, 18, 19, 16, 9, 8, 17, 12, 7, 22, 21, 14, 11, 6, 13, 10, 15, 20, 23, 96, 97, 100, 99, 98, 101, 90, 91, 64, 33, 32, 65, 60, 31, 94, 93, 62, 35, 30, 61, 34, 63, 92, 95, 72, 73, 52, 27, 26, 53, 114, 115, 112, 105, 104, 113, 84, 79, 70, 45, 38, 59, 78, 85, 58, 39, 44, 71, 48, 25, 76, 75, 50, 29, 66, 43, 88, 81, 56, 41, 108, 103, 118, 117, 110, 107, 54, 37
OFFSET
0,3
FORMULA
a(n) = A225901(A060125(n)).
PROG
(Scheme) (define (A275957 n) (A225901 (A060125 n)))
CROSSREFS
Inverse: A275958.
Fixed points: A275843.
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Aug 16 2016
STATUS
approved
Fixed points of A275957; numbers n for which A060125(n) = A225901(n).
+10
4
0, 1, 3, 5, 9, 12, 23, 33, 53, 71, 75, 81, 119, 153, 252, 360, 361, 372, 492, 719, 873, 1493, 1511, 2183, 2231, 2279, 2879, 2889, 2913, 2961, 3033, 3675, 3681, 5039, 5913, 10332, 15195, 15201, 18081, 18795, 18801, 20160, 20161, 20163, 20165, 20213, 20235, 20520, 20521, 21653, 23835, 25253, 25271, 26693, 26711, 27431, 30732, 40319, 46233, 82133, 82151
OFFSET
0,3
COMMENTS
Indexing starts from zero because a(0) = 0 is a special case in this sequence.
PROG
(Scheme, with Antti Karttunen's IntSeq-library, two versions)
(define A275843 (ZERO-POS 0 0 (lambda (n) (- (A060125 n) (A225901 n)))))
(define A275843 (FIXED-POINTS 0 0 A275957))
CROSSREFS
Fixed points of permutation pair A275957 & A275958.
Complement: A275844.
Subsequences: A007489 and A033312.
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Aug 16 2016
STATUS
approved

Search completed in 0.010 seconds