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.

Previous Showing 11-20 of 58 results. Next

A276012 Permutation of nonnegative integers: a(n) = A273663(A225901(A256450(n))).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Aug 16 2016

Keywords

Crossrefs

Inverse: A276011.
Cf. also A275952 & A275954 and permutations A275841 & A275842.

Programs

Formula

a(n) = A273663(A225901(A256450(n))).

A275843 Fixed points of A275957; numbers n for which A060125(n) = A225901(n).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Aug 16 2016

Keywords

Comments

Indexing starts from zero because a(0) = 0 is a special case in this sequence.

Crossrefs

Fixed points of permutation pair A275957 & A275958.
Complement: A275844.
Subsequences: A007489 and A033312.

A275844 Numbers n for which A060125(n) <> A225901(n).

Original entry on oeis.org

2, 4, 6, 7, 8, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 25, 26, 27, 28, 29, 30, 31, 32, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 72, 73, 74, 76, 77, 78, 79, 80, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100
Offset: 1

Views

Author

Antti Karttunen, Aug 16 2016

Keywords

Crossrefs

Complement: A275843.

A276146 a(n) = A034968(A225901(n)).

Original entry on oeis.org

0, 1, 2, 3, 1, 2, 3, 4, 5, 6, 4, 5, 2, 3, 4, 5, 3, 4, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 5, 6, 7, 8, 9, 10, 8, 9, 6, 7, 8, 9, 7, 8, 5, 6, 7, 8, 6, 7, 3, 4, 5, 6, 4, 5, 6, 7, 8, 9, 7, 8, 5, 6, 7, 8, 6, 7, 4, 5, 6, 7, 5, 6, 2, 3, 4, 5, 3, 4, 5, 6, 7, 8, 6, 7, 4, 5, 6, 7, 5, 6, 3, 4, 5, 6, 4, 5, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 5, 6, 3, 4, 5, 6, 4, 5, 2, 3, 4, 5, 3, 4, 5
Offset: 0

Views

Author

Antti Karttunen, Aug 29 2016

Keywords

Crossrefs

Programs

  • Mathematica
    b = MixedRadix[Reverse@ Range[2, 12]]; h[n_] := Module[{s = 0, i = 2, k = n}, While[k > 0, k = Floor[n/i!]; s = s + (i - 1) k; i++]; n - s]; Table[h@ FromDigits[Map[Boole[# > 0] &, #] (Reverse@ Range[2, Length@ # + 1] - #), b] &@ IntegerDigits[n, b], {n, 0, 120}] (* 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]}]; h[n_] := Module[{s = 0, i = 2, k = n}, While[k > 0, k = Floor[n/i!]; s = s + (i - 1) k; i++]; n - s]; Table[h@ g[Map[Boole[# > 0] &, #] (Reverse@ Range[2, Length@ # + 1] - #)] &@ f@ n, {n, 0, 120}] (* Michael De Vlieger, Aug 29 2016, function h after Jean-François Alcover at A034968 *)
  • Scheme
    (define (A276146 n) (A034968 (A225901 n)))

Formula

a(n) = A034968(A225901(n)).

A302851 Permutation of nonnegative integers: a(0) = 0; for n >= 1, a(n) = A225901(1+A225901(n-1)).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Apr 26 2018

Keywords

Crossrefs

Cf. A302852 (inverse).
Cf. A225901.

Programs

  • PARI
    A225901(n) = { my(s=0, d, k=2); while(n, d=n%k; n=n\k; if(d, s += (k-d)*(k-1)!); k=k+1); (s); };
    A302851(n) = if(!n,n,A225901(1+A225901(n-1)));

Formula

a(0) = 0; for n >= 1, a(n) = A225901(1+A225901(n-1)).

A302852 Permutation of nonnegative integers: a(0) = 0; for n >= 1, a(n) = 1+A225901(A225901(n)-1).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Apr 26 2018

Keywords

Crossrefs

Cf. A302851 (inverse).
Cf. A225901.

Programs

  • PARI
    A225901(n) = { my(s=0, d, k=2); while(n, d=n%k; n=n\k; if(d, s += (k-d)*(k-1)!); k=k+1); (s); };
    A302852(n) = if(!n,n,1+A225901(A225901(n)-1));

Formula

a(0) = 0; for n >= 1, a(n) = 1+A225901(A225901(n)-1).

A331171 a(n) = min(n, A225901(n)), where A225901 is factorial base flip.

Original entry on oeis.org

0, 1, 2, 3, 2, 3, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 15, 6, 7, 10, 11, 8, 9, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 48, 49, 52, 53, 50, 51, 66, 67, 70, 71, 68, 69, 60, 61, 64, 65, 62, 63, 54, 55, 58, 59
Offset: 0

Views

Author

Antti Karttunen, Jan 12 2020

Keywords

Comments

For all i, j:
a(i) = a(j) => A060130(i) = A060130(j).
For all i, j > 0:
a(i) = a(j) => A055881(i) = A055881(j).

Crossrefs

Programs

  • PARI
    A225901(n) = { my(s=0, d, k=2); while(n, d=n%k; n=n\k; if(d, s += (k-d)*(k-1)!); k=k+1); (s); };
    A331171(n) = min(n, A225901(n));

Formula

a(n) = min(n, A225901(n)).

A351953 a(n) = A351952(A225901(n)).

Original entry on oeis.org

0, 1, 2, 7, 1, 5, 3, 11, 19, 53, 14, 43, 2, 9, 16, 47, 11, 37, 1, 7, 13, 41, 8, 31, 4, 15, 26, 73, 19, 59, 41, 117, 193, 491, 158, 421, 34, 103, 172, 449, 137, 379, 27, 89, 151, 407, 116, 337, 3, 13, 23, 67, 16, 53, 36, 107, 178, 461, 143, 391, 29, 93, 157, 419, 122, 349, 22, 79, 136, 377, 101, 307, 2, 11, 20, 61
Offset: 0

Views

Author

Antti Karttunen, Apr 02 2022

Keywords

Crossrefs

Programs

  • PARI
    A003415(n) = if(n<=1, 0, my(f=factor(n)); n*sum(i=1, #f~, f[i, 2]/f[i, 1]));
    A003557(n) = (n/factorback(factorint(n)[, 1]));
    A276076(n) = { my(i=0,m=1,f=1,nextf); while((n>0),i=i+1; nextf = (i+1)*f; if((n%nextf),m*=(prime(i)^((n%nextf)/f));n-=(n%nextf));f=nextf); m; };
    A351952(n) = { my(u=A276076(n)); (A003415(u) / A003557(u)); };
    A225901(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); }; \\ From A225901.
    A351953(n) = A351952(A225901(n));

Formula

A034968 Minimal number of factorials that add to n.

Original entry on oeis.org

0, 1, 1, 2, 2, 3, 1, 2, 2, 3, 3, 4, 2, 3, 3, 4, 4, 5, 3, 4, 4, 5, 5, 6, 1, 2, 2, 3, 3, 4, 2, 3, 3, 4, 4, 5, 3, 4, 4, 5, 5, 6, 4, 5, 5, 6, 6, 7, 2, 3, 3, 4, 4, 5, 3, 4, 4, 5, 5, 6, 4, 5, 5, 6, 6, 7, 5, 6, 6, 7, 7, 8, 3, 4, 4, 5, 5, 6, 4, 5, 5, 6, 6, 7, 5, 6, 6, 7, 7, 8, 6, 7, 7, 8, 8, 9, 4, 5, 5, 6, 6, 7, 5, 6, 6, 7
Offset: 0

Views

Author

Keywords

Comments

Equivalently, sum of digits when n is written in factorial base (A007623).
Equivalently, a(0)...a(n!-1) give the total number of inversions of the permutations of n elements in lexicographic order (the factorial numbers in rising base are the inversion tables of the permutations and their sum of digits give the total number of inversions, see example and the Fxtbook link). - Joerg Arndt, Jun 17 2011
Also minimum number of adjacent transpositions needed to produce each permutation in the list A055089, or number of swappings needed to bubble sort each such permutation. (See A055091 for the minimum number of any transpositions.)

Examples

			a(205) = a(1!*1 + 3!*2 + 4!*3 + 5!*1) = 1+2+3+1 = 7. [corrected by Shin-Fu Tsai, Mar 23 2021]
From _Joerg Arndt_, Jun 17 2011: (Start)
   n:    permutation   inv. table a(n)  cycles
   0:    [ 0 1 2 3 ]   [ 0 0 0 ]   0    (0) (1) (2) (3)
   1:    [ 0 1 3 2 ]   [ 0 0 1 ]   1    (0) (1) (2, 3)
   2:    [ 0 2 1 3 ]   [ 0 1 0 ]   1    (0) (1, 2) (3)
   3:    [ 0 2 3 1 ]   [ 0 1 1 ]   2    (0) (1, 2, 3)
   4:    [ 0 3 1 2 ]   [ 0 2 0 ]   2    (0) (1, 3, 2)
   5:    [ 0 3 2 1 ]   [ 0 2 1 ]   3    (0) (1, 3) (2)
   6:    [ 1 0 2 3 ]   [ 1 0 0 ]   1    (0, 1) (2) (3)
   7:    [ 1 0 3 2 ]   [ 1 0 1 ]   2    (0, 1) (2, 3)
   8:    [ 1 2 0 3 ]   [ 1 1 0 ]   2    (0, 1, 2) (3)
   9:    [ 1 2 3 0 ]   [ 1 1 1 ]   3    (0, 1, 2, 3)
  10:    [ 1 3 0 2 ]   [ 1 2 0 ]   3    (0, 1, 3, 2)
  11:    [ 1 3 2 0 ]   [ 1 2 1 ]   4    (0, 1, 3) (2)
  12:    [ 2 0 1 3 ]   [ 2 0 0 ]   2    (0, 2, 1) (3)
  13:    [ 2 0 3 1 ]   [ 2 0 1 ]   3    (0, 2, 3, 1)
  14:    [ 2 1 0 3 ]   [ 2 1 0 ]   3    (0, 2) (1) (3)
  15:    [ 2 1 3 0 ]   [ 2 1 1 ]   4    (0, 2, 3) (1)
  16:    [ 2 3 0 1 ]   [ 2 2 0 ]   4    (0, 2) (1, 3)
  17:    [ 2 3 1 0 ]   [ 2 2 1 ]   5    (0, 2, 1, 3)
  18:    [ 3 0 1 2 ]   [ 3 0 0 ]   3    (0, 3, 2, 1)
  19:    [ 3 0 2 1 ]   [ 3 0 1 ]   4    (0, 3, 1) (2)
  20:    [ 3 1 0 2 ]   [ 3 1 0 ]   4    (0, 3, 2) (1)
  21:    [ 3 1 2 0 ]   [ 3 1 1 ]   5    (0, 3) (1) (2)
  22:    [ 3 2 0 1 ]   [ 3 2 0 ]   5    (0, 3, 1, 2)
  23:    [ 3 2 1 0 ]   [ 3 2 1 ]   6    (0, 3) (1, 2)
(End)
		

Crossrefs

Cf. A368342 (partial sums), A001809 (sums of n! terms).
Cf. A227148 (positions of even terms), A227149 (of odd terms).
Differs from analogous A276150 for the first time at n=24.
Positions of records are A200748.

Programs

  • Maple
    [seq(convert(fac_base(j),`+`),j=0..119)]; # fac_base and PermRevLexUnrank given in A055089. Perm2InversionVector in A064039
    Or alternatively: [seq(convert(Perm2InversionVector(PermRevLexUnrank(j)),`+`),j=0..119)];
    # third Maple program:
    b:= proc(n, i) local q;
          `if`(n=0, 0, b(irem(n, i!, 'q'), i-1)+q)
        end:
    a:= proc(n) local k;
          for k while k!Alois P. Heinz, Nov 15 2012
  • Mathematica
    a[n_] := Module[{s=0, i=2, k=n}, While[k > 0, k = Floor[n/i!]; s = s + (i-1)*k; i++]; n-s]; Table[a[n], {n, 0, 105}] (* Jean-François Alcover, Nov 06 2013, after Benoit Cloitre *)
  • PARI
    a(n)=local(k,r);k=2;r=0;while(n>0,r+=n%k;n\=k;k++);r \\ Franklin T. Adams-Watters, May 13 2009
    
  • Python
    def a(n):
        k=2
        r=0
        while n>0:
            r+=n%k
            n=n//k
            k+=1
        return r
    print([a(n) for n in range(201)]) # Indranil Ghosh, Jun 19 2017, after PARI program
    
  • Python
    def A034968(n, p=2): return n if n
  • Scheme
    (define (A034968 n) (let loop ((n n) (i 2) (s 0)) (cond ((zero? n) s) (else (loop (quotient n i) (+ 1 i) (+ s (remainder n i)))))))
    ;; Antti Karttunen, Aug 29 2016
    

Formula

a(n) = n - Sum_{i>=2} (i-1)*floor(n/i!). - Benoit Cloitre, Aug 26 2003
G.f.: 1/(1-x)*Sum_{k>0} (Sum_{i=1..k} i*x^(i*k!))/(Sum_{i=0..k} x^(i*k!)). - Franklin T. Adams-Watters, May 13 2009
From Antti Karttunen, Aug 29 2016: (Start)
a(0) = 0; for n >= 1, a(n) = A099563(n) + a(A257687(n)).
a(0) = 0; for n >= 1, a(n) = A060130(n) + a(A257684(n)).
Other identities. For all n >= 0:
a(n) = A001222(A276076(n)).
a(n) = A276146(A225901(n)).
a(A000142(n)) = 1, a(A007489(n)) = n, a(A033312(n+1)) = A000217(n).
a(A056019(n)) = a(n).
A219651(n) = n - a(n).
(End)

Extensions

Additional comments from Antti Karttunen, Aug 23 2001

A004488 Tersum n + n.

Original entry on oeis.org

0, 2, 1, 6, 8, 7, 3, 5, 4, 18, 20, 19, 24, 26, 25, 21, 23, 22, 9, 11, 10, 15, 17, 16, 12, 14, 13, 54, 56, 55, 60, 62, 61, 57, 59, 58, 72, 74, 73, 78, 80, 79, 75, 77, 76, 63, 65, 64, 69, 71, 70, 66, 68, 67, 27, 29, 28, 33, 35, 34, 30, 32, 31, 45, 47, 46, 51
Offset: 0

Views

Author

Keywords

Comments

Could also be described as "Write n in base 3, then replace each digit with its base-3 negative" as with A048647 for base 4. - Henry Bottomley, Apr 19 2000
a(a(n)) = n, a self-inverse permutation of the nonnegative integers. - Reinhard Zumkeller, Dec 19 2003
First 3^n terms of the sequence form a permutation s(n) of 0..3^n-1, n>=1; the number of inversions of s(n) is A016142(n-1). - Gheorghe Coserea, Apr 23 2018

Crossrefs

Programs

  • Haskell
    a004488 0 = 0
    a004488 n = if d == 0 then 3 * a004488 n' else 3 * a004488 n' + 3 - d
                where (n', d) = divMod n 3
    -- Reinhard Zumkeller, Mar 12 2014
    
  • Maple
    a:= proc(n) local t, r, i;
          t, r:= n, 0;
          for i from 0 while t>0 do
            r:= r+3^i *irem(2*irem(t, 3, 't'), 3)
          od; r
        end:
    seq(a(n), n=0..80);  # Alois P. Heinz, Sep 07 2011
  • Mathematica
    a[n_] := FromDigits[Mod[3-IntegerDigits[n, 3], 3], 3]; Table[a[n], {n, 0, 66}] (* Jean-François Alcover, Mar 03 2014 *)
  • PARI
    a(n) = my(b=3); fromdigits(apply(d->(b-d)%b, digits(n, b)), b);
    vector(67, i, a(i-1))  \\ Gheorghe Coserea, Apr 23 2018
    
  • Python
    from sympy.ntheory.factor_ import digits
    def a(n): return int("".join([str((3 - i)%3) for i in digits(n, 3)[1:]]), 3) # Indranil Ghosh, Jun 06 2017

Formula

Tersum m + n: write m and n in base 3 and add mod 3 with no carries, e.g., 5 + 8 = "21" + "22" = "10" = 1.
a(n) = Sum(3-d(i)-3*0^d(i): n=Sum(d(i)*3^d(i): 0<=d(i)<3)). - Reinhard Zumkeller, Dec 19 2003
a(3*n) = 3*a(n), a(3*n+1) = 3*a(n)+2, a(3*n+2) = 3*a(n)+1. - Robert Israel, May 09 2014
Previous Showing 11-20 of 58 results. Next