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-7 of 7 results.

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

A051683 Triangle read by rows: T(n,k) = n!*k.

Original entry on oeis.org

1, 2, 4, 6, 12, 18, 24, 48, 72, 96, 120, 240, 360, 480, 600, 720, 1440, 2160, 2880, 3600, 4320, 5040, 10080, 15120, 20160, 25200, 30240, 35280, 40320, 80640, 120960, 161280, 201600, 241920, 282240, 322560, 362880, 725760, 1088640, 1451520, 1814400, 2177280, 2540160, 2903040, 3265920
Offset: 1

Views

Author

Klaus Strassburger (strass(AT)ddfi.uni-duesseldorf.de)

Keywords

Comments

Numbers with only one nonzero digit when written in factorial base. - Franklin T. Adams-Watters, Nov 28 2011
In other words, numbers m such that A034968(m) = A099563(m). - Antti Karttunen, Jul 02 2013
When the numbers denote finite permutations (as row numbers of A055089) these are the circular shifts to the right within an interval. The subsequence A001563 denotes the circular shifts that start with the first element. Compare A211370 for circular shifts to the left. - Tilman Piesk, Apr 29 2017

Examples

			Table begins
   1;
   2,  4;
   6, 12, 18;
  24, 48, 72, 96; ...
		

Crossrefs

Programs

  • Haskell
    a051683 n k = a051683_tabl !! (n-1) !! (k-1)
    a051683_row n = a051683_tabl !! (n-1)
    a051683_tabl = map fst $ iterate f ([1], 2) where
       f (row, n) = (row' ++ [head row' + last row'], n + 1) where
         row' = map (* n) row
    -- Reinhard Zumkeller, Mar 09 2012
    
  • Magma
    [[Factorial(n)*k: k in [1..n]]: n in [1..15]]; // Vincenzo Librandi, Jun 15 2015
    
  • Mathematica
    T[n_, k_] := n!*k; Flatten[Table[T[n, k], {n, 9}, {k, n}]] (* Jean-François Alcover, Apr 22 2011 *)
  • PARI
    for(n=1,10, for(k=1,n, print1(n!*k, ", "))) \\ G. C. Greubel, Mar 27 2018
    
  • Python
    from math import isqrt, factorial, comb
    def A051683(n): return factorial(a:=(m:=isqrt(k:=n<<1))+(k>m*(m+1)))*(n-comb(a,2)) # Chai Wah Wu, Jun 25 2025
  • Scheme
    (define (A051683 n) (* (A000142 (A002024 n)) (A002260 n))) ;; Antti Karttunen, Jul 02 2013
    

Formula

T(n,k) = A000142(A002024(n)) * A002260(n,k) = A002024(n)! * A002260(n,k) - Antti Karttunen, Jul 02 2013
Sum_{n>=1} 1/a(n) = e * (gamma - Ei(-1)) = A347952. - Amiram Eldar, Oct 13 2024

A343048 a(n) is the least number whose sum of digits in primorial base equals n.

Original entry on oeis.org

0, 1, 3, 5, 11, 17, 23, 29, 59, 89, 119, 149, 179, 209, 419, 629, 839, 1049, 1259, 1469, 1679, 1889, 2099, 2309, 4619, 6929, 9239, 11549, 13859, 16169, 18479, 20789, 23099, 25409, 27719, 30029, 60059, 90089, 120119, 150149, 180179, 210209, 240239, 270269
Offset: 0

Views

Author

Rémy Sigrist, Apr 05 2021

Keywords

Comments

Equivalently, this sequence gives positions of records in A276150.

Examples

			The first terms, alongside their primorial base representation, are:
  n   a(n)  prim(a(n))
  --  ----  ----------
   0     0           0
   1     1           1
   2     3          11
   3     5          21
   4    11         121
   5    17         221
   6    23         321
   7    29         421
   8    59        1421
   9    89        2421
  10   119        3421
  11   149        4421
  12   179        5421
  13   209        6421
  14   419       16421
  15   629       26421
		

Crossrefs

One less than A060735.
Cf. also A372559.

Programs

  • PARI
    a(n) = my (v=0, pp=1); forprime (p=2, oo, if (n==0, return (v), my (d=min(p-1, n)); n-=d; v+=d*pp; pp*=p))

Formula

A276150(a(n)) = n.
a(n) = A060735(n)-1. - Antti Karttunen, Nov 14 2024

A213168 a(n) = n!/2 - (n-1)! - n + 2.

Original entry on oeis.org

0, 0, 4, 33, 236, 1795, 15114, 141113, 1451512, 16329591, 199583990, 2634508789, 37362124788, 566658892787, 9153720575986, 156920924159985, 2845499424767984, 54420176498687983, 1094805903679487982, 23112569077678079981, 510909421717094399980
Offset: 2

Views

Author

Olivier Gérard, Nov 02 2012

Keywords

Comments

Row sums of A142706 for k=1..n-1.

Crossrefs

Cf. A001286.
Cf. A200748 (considered as a triangular array).

Programs

  • Magma
    [Factorial(n)/2-Factorial(n-1)-n+2: n in [2..25]]; // Vincenzo Librandi, Sep 09 2016
  • Maple
    f:=gfun:-rectoproc({2*(n-3)*a(n) - (2*n^2-6*n+4)*a(n-1)- 2*(n-3)*(n-2)^2, a(2)=0,a(3)=0},a(n),remember): map(f, [$2..22]); # Georg Fischer, Aug 25 2021
  • Mathematica
    Table[n!/2 - (n - 1)! - n + 2, {n, 2, 20}]
  • Maxima
    A213168(n):=n!/2-(n-1)!-n+2$
    makelist(A213168(n),n,2,30); /* Martin Ettl, Nov 03 2012 */
    

Formula

a(n) = A001286(n-1) - n + 2. - Anton Zakharov, Sep 08 2016
D-finite with recurrence: 2*(n-3)*a(n) - (2*n^2-6*n+4)*a(n-1)- 2*(n-3)*(n-2)^2 = 0. - Georg Fischer, Aug 25 2021
E.g.f.: 1/(2-2*x)+log(1-x)+(2-x)*exp(x). - Alois P. Heinz, Aug 25 2021

A263130 Least number such that the product of its digits in factorial base is n.

Original entry on oeis.org

1, 5, 21, 17, 633, 23, 36153, 65, 93, 635, 443122713, 71, 81474226713, 36155, 645, 113, 6069010670156313, 95, 2318037293294156313, 641, 36165, 443122715, 595774037991797891660313, 119, 4233, 81474226715, 453, 36161, 256727294482662730300616548940313, 647
Offset: 1

Views

Author

Paul Tek, Oct 10 2015

Keywords

Comments

The product of digits in factorial base is given by A208575.
All terms are odd.
Each prime number sets a new record.
a(p) = p*(p!) + Sum_{k=1..p-1} k! for any prime p.
a(n!) = A033312(n+1) for any n>0.
A208576(a(n)) = A208576(n)+1 for any n>1.

Examples

			The first terms of the sequence are:
+----+-------------+----------------------------+
| n  | a(n)        | a(n) in factorial base     |
+----+-------------+----------------------------+
|  1 |           1 |                          1 |
|  2 |           5 |                        2_1 |
|  3 |          21 |                      3_1_1 |
|  4 |          17 |                      2_2_1 |
|  5 |         633 |                  5_1_1_1_1 |
|  6 |          23 |                      3_2_1 |
|  7 |       36153 |              7_1_1_1_1_1_1 |
|  8 |          65 |                    2_2_2_1 |
|  9 |          93 |                    3_3_1_1 |
| 10 |         635 |                  5_1_1_2_1 |
| 11 |   443122713 |     11_1_1_1_1_1_1_1_1_1_1 |
| 12 |          71 |                    2_3_2_1 |
| 13 | 81474226713 | 13_1_1_1_1_1_1_1_1_1_1_1_1 |
| 14 |       36155 |              7_1_1_1_1_2_1 |
| 15 |         645 |                  5_1_3_1_1 |
| 16 |         113 |                    4_2_2_1 |
+----+-------------+----------------------------+
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{d = Divisors@ n, g, k, m = {1}}, g[x_] := Flatten[Table[#1, {#2}] & @@@ FactorInteger@ x]; Do[k = Max@ Select[d, # <= i &]; If[! IntegerQ@ k, AppendTo[m, 1], d = Divisors[Last[d]/k]; AppendTo[m, k]]; If[d == {1}, Break[]], {i, 2, n}]; Reverse@ m]; Table[FromDigits[#, MixedRadix[Reverse@ Range[2, Length@ #]]] &@ f@ n, {n, 30}] (* Michael De Vlieger, Oct 12 2015, Version 10.2 *)

A343041 a(0) = 0 and for any n > 0, a(n) = A343040(a(n-1), n).

Original entry on oeis.org

0, 1, 3, 3, 5, 5, 11, 11, 11, 11, 11, 11, 17, 17, 17, 17, 17, 17, 23, 23, 23, 23, 23, 23, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71
Offset: 0

Views

Author

Rémy Sigrist, Apr 03 2021

Keywords

Comments

This sequence has similarities with A087052.
If we remove duplicate terms, then we obtain A200748.
The value A200748(k) appears A130493(k) times for any k > 0.

Examples

			The first terms, in decimal and in factorial base, are:
  n   a(n)  fact(n)  fact(a(n))
  --  ----  -------  ----------
   0     0        0           0
   1     1        1           1
   2     3       10          11
   3     3       11          11
   4     5       20          21
   5     5       21          21
   6    11      100         121
   7    11      101         121
   8    11      110         121
   9    11      111         121
  10    11      120         121
  11    11      121         121
  12    17      200         221
  13    17      201         221
  14    17      210         221
		

Crossrefs

Programs

  • PARI
    See Links section.

A136574 Row sums of triangle A136573.

Original entry on oeis.org

1, 1, 2, 7, 30, 149, 868, 5907, 46226, 409105, 4037904, 43954703, 522956302, 6749977101, 93928268300, 1401602636299, 22324392524298, 378011820620297, 6780385526348296, 128425485935180295, 2561327494111820294
Offset: 0

Views

Author

Gary W. Adamson, Jan 07 2008

Keywords

Comments

For n > 0, a(n) gives the smallest number requiring n terms to be expressed as a sum of terms in A200748 - David Eppstein, Dec 21 2017

Examples

			a(4) = 149 = 4!*(5) = 120 + the sum of the first five terms of A033312: (0, 0, 1, 5, 23) = 29, added to 120 = 149.
a(4) = 149 = A003422(5) + A000142(5) - (n+1) = 34 + 120 - 5.
		

Crossrefs

Programs

Formula

Row sums of triangle A136573.
a(n) = A003422(n+1) + A000142(n+1) - (n+1).
a(n) = n!*(n+1) + the sum of the first (n+1) terms of A033312: (0, 0, 1, 5, 23, 119, 719, ...), where A033312 = (k! - 1, k=0,1,2,...).
a(n) = a(n-1) + n! - 1. - David Eppstein, Dec 21 2017

Extensions

More terms from Vladimir Joseph Stephan Orlovsky, Nov 08 2008
Showing 1-7 of 7 results.