Search: a275836 -id:a275836
|
|
A225901
|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
COMMENTS
|
A self-inverse permutation of the natural numbers.
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╲
-----------------
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.
(End)
|
|
LINKS
|
|
|
FORMULA
|
(End)
Other identities. For n >= 0:
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.]
(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:
(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
|
|
CROSSREFS
|
Cf. A000142, A007623, A004488, A048647, A001563, A007489, A257684, A257687, A276091, A275736, A276149.
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|
|
|
|
0, 1, 2, 4, 18, 5, 6, 22, 12, 3, 96, 20, 72, 17, 14, 19, 114, 13, 94, 10, 11, 23, 108, 15, 24, 79, 84, 100, 101, 21, 48, 102, 8, 9, 600, 71, 480, 49, 78, 118, 119, 16, 65, 73, 98, 99, 696, 27, 360, 594, 62, 63, 70, 112, 54, 113, 74, 7, 45, 95, 552, 116, 50, 117, 672, 603, 454, 569, 37, 40, 29, 106, 444, 41, 36, 107, 85, 97, 38, 621, 86, 82, 545, 110, 528, 59, 56, 111
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
LINKS
|
|
|
FORMULA
|
Other identities. For all n >= 0:
|
|
PROG
|
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|
|
|
|
0, 1, 2, 9, 3, 5, 6, 57, 32, 33, 19, 20, 8, 17, 14, 23, 41, 13, 4, 15, 11, 29, 7, 21, 24, 133, 272, 47, 293, 70, 150, 263, 152, 357, 109, 110, 74, 68, 78, 163, 69, 73, 135, 545, 249, 58, 230, 220, 30, 37, 62, 225, 100, 161, 54, 127, 86, 285, 209, 85, 182, 172, 50, 51, 197, 42, 104, 231, 105, 431, 52, 35, 12, 43, 56, 99, 213, 95, 38, 25, 134, 153, 81, 341, 26, 76
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
LINKS
|
|
|
FORMULA
|
Other identities. For all n >= 0:
|
|
PROG
|
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|
|
|
|
0, 1, 6, 3, 4, 2, 56, 20, 36, 17, 21, 9, 48, 15, 30, 13, 16, 7, 18, 8, 24, 10, 12, 5, 495, 135, 74, 31, 132, 53, 582, 401, 147, 59, 157, 158, 361, 116, 216, 173, 117, 47, 136, 155, 380, 46, 78, 82, 420, 111, 61, 25, 108, 45, 490, 347, 123, 51, 133, 134, 312, 93, 192, 149, 94, 41, 112, 131, 327, 40, 64, 68, 360, 270, 80, 38, 88, 89, 416, 303, 99, 44, 109, 110, 288, 34
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
LINKS
|
|
|
FORMULA
|
Other identities. For all n >= 0:
|
|
PROG
|
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
Search completed in 0.009 seconds
|