cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-10 of 13 results. Next

A225901 Write n in factorial base, then replace each nonzero digit d of radix k with k-d.

Original entry on oeis.org

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

Views

Author

Paul Tek, May 20 2013

Keywords

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)

Examples

			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.
		

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.

Programs

  • 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 *)
  • 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)
    
  • 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
  • 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
    

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)

A153880 Shift factorial base representation left by one digit.

Original entry on oeis.org

0, 2, 6, 8, 12, 14, 24, 26, 30, 32, 36, 38, 48, 50, 54, 56, 60, 62, 72, 74, 78, 80, 84, 86, 120, 122, 126, 128, 132, 134, 144, 146, 150, 152, 156, 158, 168, 170, 174, 176, 180, 182, 192, 194, 198, 200, 204, 206, 240, 242, 246, 248, 252, 254, 264, 266, 270, 272
Offset: 0

Views

Author

Antti Karttunen, Jan 03 2009

Keywords

Comments

Equally, append 0 to the end of the factorial base representation of n (= A007623(n)), then convert back to decimal.
Involution A225901 maps each term of this sequence to a unique term of A255411, and vice versa.

Examples

			Factorial base representation of 5 is A007623(5) = "21". Shifting this once left (that is, appending 0 to the end) yields "210", which is factorial base representation for 14. Thus a(5) = 14.
		

Crossrefs

Indices of zeros in A260736.
Cf. A153883 (terms divided by 2).
Cf. A266193 (a left inverse).
Cf. A273670 (complement).
Cf. also A007623, A225901, A255411.

Programs

  • Mathematica
    Table[Function[b, FromDigits[IntegerDigits[n, b]~Join~{0}, b]]@ MixedRadix[Reverse@ Range@ 12], {n, 0, 57}] (* Michael De Vlieger, May 30 2016, Version 10.2 *)
  • Python
    from sympy import factorial as f
    def a007623(n, p=2): return n if n
  • Scheme
    (define (A153880 n) (let loop ((n n) (z 0) (i 2) (f 2)) (cond ((zero? n) z) (else (loop (floor->exact (/ n i)) (+ (* f (modulo n i)) z) (+ 1 i) (* f (+ i 1)))))))
    

Formula

Other identities. For all n >= 0:
A266193(a(n)) = n.

A273667 Permutation of nonnegative integers: a(0) = 0, a(A153880(n)) = A255411(a(n)), a(A273670(n)) = A256450(a(n)).

Original entry on oeis.org

0, 1, 4, 2, 6, 3, 18, 8, 12, 5, 24, 10, 48, 15, 16, 7, 30, 13, 56, 20, 21, 9, 36, 17, 96, 67, 60, 26, 27, 11, 72, 42, 22, 23, 120, 81, 240, 73, 66, 32, 33, 14, 87, 49, 28, 29, 144, 101, 360, 270, 88, 89, 80, 38, 90, 39, 52, 19, 107, 57, 288, 34, 76, 35, 168, 125, 416, 303, 109, 110, 99, 44, 420, 111, 108, 45, 61, 25, 112, 131, 64, 68, 327, 40
Offset: 0

Views

Author

Antti Karttunen, May 30 2016

Keywords

Crossrefs

Inverse: A273668.
Similar or related permutations: A255566, A273665.

Formula

a(0) = 0; for n >= 1: if A257680(A225901(n)) = 0 [when n is one of the terms of A153880] then a(n) = A255411(a(A266193(n))), otherwise [when n is one of the terms of A273670], a(n) = A256450(a(A273663(n))).
As a composition of other permutations:
a(n) = A255566(A273665(n)).

A275847 Permutation of natural numbers: a(0) = 0, a(A153880(n)) = A255411(a(n)), a(A273670(n)) = A256450(n).

Original entry on oeis.org

0, 1, 4, 2, 3, 5, 18, 6, 12, 7, 8, 9, 16, 10, 22, 11, 13, 14, 15, 17, 19, 20, 21, 23, 96, 24, 48, 25, 26, 27, 72, 28, 52, 29, 30, 31, 60, 32, 64, 33, 34, 35, 36, 37, 38, 39, 40, 41, 90, 42, 66, 43, 44, 45, 114, 46, 70, 47, 49, 50, 76, 51, 84, 53, 54, 55, 56, 57, 58, 59, 61, 62, 88, 63, 94, 65, 67, 68, 100, 69, 108, 71, 73, 74, 112, 75, 118, 77, 78
Offset: 0

Views

Author

Antti Karttunen, Aug 13 2016

Keywords

Crossrefs

Inverse: A275848.
Similar permutations: A273667 (a more recursed variant), A275845, A275846.

Formula

a(0) = 0; for n >= 1: if A257680(A225901(n)) = 0 [when n is one of the terms of A153880] then a(n) = A255411(a(A266193(n))), otherwise [when n is one of the terms of A273670], a(n) = A256450(A273663(n)).

A276949 Index of row where n is located in array A276953 (equally: column in A276955).

Original entry on oeis.org

0, 1, 2, 1, 1, 1, 3, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 2, 1, 1, 1, 3, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 2, 1, 1, 1, 3, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5
Offset: 0

Views

Author

Antti Karttunen, Sep 22 2016

Keywords

Comments

This is the smallest difference that occurs between any nonzero digit's radix (which is one more than its one-based position from the right) and that digit's value in the factorial base representation of n. See A225901 and the example.
a(0) = 0 by convention, as there are no nonzero digits present, and neither does 0 occur in arrays A276953 & A276955.

Examples

			For n=8, its factorial base representation (A007623) is "110", where the radix for each digit position 1, 2, 3 (from the right) is 2, 3, 4 (one larger than the position). For the 1 in the middle position the difference is 3-1 = 2, while for the 1 at the left we obtain 4-1 = 3. Of these two differences 2 is smaller, thus a(8)=2.
		

Crossrefs

Cf. A276951 (for the other index).
Cf. arrays A276953 & A276955.
Cf. also A225901, A273667, A275847.

Formula

a(0) = 0, and for n >= 1: if A276950(n) = 1, then a(n) = 1, otherwise a(n) = 1 + a(A266193(n)).
Other identities. For all n >= 0:
a(n) = A257679(A225901(n)) = A257679(A275847(n)) = A257679(A273667(n)).

A275837 Permutation of nonnegative integers: a(n) = A225901(A273667(n)).

Original entry on oeis.org

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
Offset: 0

Views

Author

Antti Karttunen, Aug 13 2016

Keywords

Crossrefs

Inverse: A275838.
Cf. A275839 (fixed points).
Cf. also A275835, A275836.

Programs

Formula

a(n) = A225901(A273667(n)).
Other identities. For all n >= 0:
a(n) = A266193(a(A153880(n))). [Restriction to A153880 induces the same permutation.]
A275841(n) = A273663(a(A273670(n))). [While restriction to A273670 induces another permutation.]

A275838 Permutation of nonnegative integers: a(n) = A273668(A225901(n)).

Original entry on oeis.org

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
Offset: 0

Views

Author

Antti Karttunen, Aug 13 2016

Keywords

Crossrefs

Inverse: A275837.
Cf. A275839 (fixed points).
Cf. also A275835, A275836.

Programs

Formula

a(n) = A273668(A225901(n)).
Other identities. For all n >= 0:
a(n) = A266193(a(A153880(n))). [Restriction to A153880 induces the same permutation.]
A275842(n) = A273663(a(A273670(n))). [While restriction to A273670 induces another permutation.]

A276951 Index of column where n is located in array A276953 (equally: row in A276955).

Original entry on oeis.org

0, 1, 1, 2, 3, 4, 1, 5, 2, 6, 7, 8, 3, 9, 4, 10, 11, 12, 13, 14, 15, 16, 17, 18, 1, 19, 5, 20, 21, 22, 2, 23, 6, 24, 25, 26, 7, 27, 8, 28, 29, 30, 31, 32, 33, 34, 35, 36, 3, 37, 9, 38, 39, 40, 4, 41, 10, 42, 43, 44, 11, 45, 12, 46, 47, 48, 49, 50, 51, 52, 53, 54, 13, 55, 14, 56, 57, 58, 15, 59, 16, 60, 61, 62, 17, 63, 18, 64
Offset: 0

Views

Author

Antti Karttunen, Sep 22 2016

Keywords

Comments

a(0) = 0 by convention, because 0 is not present in arrays A276953 and A276955.

Crossrefs

Cf. arrays A276953 & A276955. A276949 gives their other index.
Cf. also A257681, A275847.

Programs

Formula

a(0) = 0; for n >= 1, if A260736(n) > 0 [when A276950(n) is not zero, when n is in A273670], then a(n) = A276952(n) = 1 + A273663(n), otherwise a(n) = a(A266193(n)).
Other identities. For all n >= 0:
a(n) = A257681(A275847(n)).

A275845 Permutation of natural numbers: a(0) = 0, a(A153880(n)) = A255411(n), a(A273670(n)) = A256450(a(n)).

Original entry on oeis.org

0, 1, 4, 2, 6, 3, 12, 8, 16, 5, 15, 10, 18, 21, 22, 7, 20, 13, 24, 27, 28, 9, 26, 17, 48, 30, 52, 33, 34, 11, 60, 32, 64, 23, 56, 36, 66, 61, 70, 39, 40, 14, 73, 38, 78, 29, 67, 42, 72, 80, 76, 74, 85, 45, 84, 46, 88, 19, 89, 44, 90, 97, 94, 35, 81, 49, 87, 99, 93, 91, 105, 53, 96, 104, 100, 54, 109, 25, 108, 110, 112, 51, 111, 121, 114, 117, 118, 41
Offset: 0

Views

Author

Antti Karttunen, Aug 13 2016

Keywords

Crossrefs

Inverse: A275846.
Similar permutations: A273667 (a more recursed variant), A275847, A275848.

Formula

a(0) = 0; for n >= 1: if A257680(A225901(n)) = 0 [when n is one of the terms of A153880] then a(n) = A255411(A266193(n)), otherwise [when n is one of the terms of A273670], a(n) = A256450(a(A273663(n))).
Other identities:
a(A000142(n)) = A052849(n) for all n >= 2.

A276009 Decrement each nonzero digit by one in factorial base representation of n: a(n) = n - A276008(n).

Original entry on oeis.org

0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 2, 2, 6, 6, 6, 6, 8, 8, 12, 12, 12, 12, 14, 14, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 2, 2, 6, 6, 6, 6, 8, 8, 12, 12, 12, 12, 14, 14, 24, 24, 24, 24, 26, 26, 24, 24, 24, 24, 26, 26, 30, 30, 30, 30, 32, 32, 36, 36, 36, 36, 38, 38, 48, 48, 48, 48, 50, 50, 48, 48, 48, 48, 50, 50, 54, 54, 54, 54, 56, 56, 60, 60, 60, 60, 62, 62, 72, 72, 72, 72
Offset: 0

Views

Author

Antti Karttunen, Aug 18 2016

Keywords

Examples

			For n=23 whose factorial base representation is "321", when we subtract one from each digit we get "210", the factorial base representation of 14, thus a(23) = 14.
For n=37 ("1201"), when we subtract one from each digit we get "0100", thus a(37) = 6 as A007623(6) = 100.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Module[{k = n, m = 2, r, s = {}}, While[{k, r} = QuotientRemainder[k, m]; k != 0|| r != 0, AppendTo[s, r]; m++]; s = Max[# - 1, 0]& /@ s; Total[s*Range[Length[s]]!]]; Array[a, 100, 0] (* Amiram Eldar, Feb 14 2024 *)
  • Python
    from sympy import factorial as f
    def a007623(n, p=2): return n if n

    0 else '0' for i in x)[::-1] return sum([int(y[i])*f(i + 1) for i in range(len(y))]) print([a(n) for n in range(201)]) # Indranil Ghosh, Jun 21 2017

  • Scheme
    (define (A276009 n) (- n (A276008 n)))
    ;; Standalone version:
    (define (A276009 n) (let loop ((n n) (s 0) (f 1) (i 2)) (if (zero? n) s (let ((d (modulo n i))) (if (zero? d) (loop (/ n i) s (* i f) (+ 1 i)) (loop (/ (- n d) i) (+ s (* f (- d 1))) (* i f) (+ 1 i)))))))
    

Formula

a(n) = n - A276008(n).
Showing 1-10 of 13 results. Next