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

A003422 Left factorials: !n = Sum_{k=0..n-1} k!.

Original entry on oeis.org

0, 1, 2, 4, 10, 34, 154, 874, 5914, 46234, 409114, 4037914, 43954714, 522956314, 6749977114, 93928268314, 1401602636314, 22324392524314, 378011820620314, 6780385526348314, 128425485935180314, 2561327494111820314, 53652269665821260314, 1177652997443428940314
Offset: 0

Views

Author

Keywords

Comments

Number of {12, 12*, 1*2, 21*}- and {12, 12*, 21, 21*}-avoiding signed permutations in the hyperoctahedral group.
a(n) is the number of permutations on [n] that avoid the patterns 2n1 and n12. An occurrence of a 2n1 pattern is a (scattered) subsequence a-n-b with a > b. - David Callan, Nov 29 2007
Also, numbers left over after the following sieving process: At step 1, keep all numbers of the set N = {0, 1, 2, ...}. In step 2, keep only every second number after a(2) = 2: N' = {0, 1, 2, 4, 6, 8, 10, ...}. In step 3, keep every third of the numbers following a(3) = 4, N" = {0, 1, 2, 4, 10, 16, 22, ...}. In step 4, keep every fourth of the numbers beyond a(4) = 10: {0, 1, 2, 4, 10, 34, 58, ...}, and so on. - M. F. Hasler, Oct 28 2010
If s(n) is a second-order recurrence defined as s(0) = x, s(1) = y, s(n) = n*(s(n - 1) - s(n - 2)), n > 1, then s(n) = n*y - n*a(n - 1)*x. - Gary Detlefs, May 27 2012
a(n) is the number of lists of {1, ..., n} with (1st element) = (smallest element) and (k-th element) <> (k-th smallest element) for k > 1, where a list means an ordered subset. a(4) = 10 because we have the lists: [1], [2], [3], [4], [1, 3, 2], [1, 4, 2], [1, 4, 3], [2, 4, 3], [1, 3, 4, 2], [1, 4, 2, 3]. Cf. A000262. - Geoffrey Critzer, Oct 04 2012
Consider a tree graph with 1 vertex. Add an edge to it with another vertex. Now add 2 edges with vertices to this vertex, and then 3 edges to each open vertex of the tree (not the first one!), and the next stage is to add 4 edges, and so on. The total number of vertices at each stage give this sequence (see example). - Jon Perry, Jan 27 2013
Additive version of the superfactorials A000178. - Jon Perry, Feb 09 2013
Repunits in the factorial number system (see links). - Jon Perry, Feb 17 2013
Whether n|a(n) only for 1 and 2 remains an open problem. A published 2004 proof was retracted in 2011. This is sometimes known as Kurepa's conjecture. - Robert G. Wilson v, Jun 15 2013, corrected by Jeppe Stig Nielsen, Nov 07 2015.
!n is not always squarefree for n > 3. Miodrag Zivkovic found that 54503^2 divides !26541. - Arkadiusz Wesolowski, Nov 20 2013
a(n) gives the position of A007489(n) in A227157. - Antti Karttunen, Nov 29 2013
Matches the total domination number of the Bruhat graph from n = 2 to at least n = 5. - Eric W. Weisstein, Jan 11 2019
For the connection with Kurepa trees, see A. Petojevic, The {K_i(z)}{i=1..oo} functions, Rocky Mtn. J. Math., 36 (2006), 1637-1650. - _Aleksandar Petojevic, Jun 29 2018
This sequence converges in the p-adic topology, for every prime number p. - Harry Richman, Aug 13 2024

Examples

			!5 = 0! + 1! + 2! + 3! + 4! = 1 + 1 + 2 + 6 + 24 = 34.
x + 2*x^2 + 4*x^3 + 10*x^4 + 34*x^5 + 154*x^6 + 874*x^7 + 5914*x^8 + 46234*x^9 + ...
From _Arkadiusz Wesolowski_, Aug 06 2012: (Start)
Illustration of initial terms:
.
. o        o         o            o                         o
.          o         o            o                         o
.                   o o          o o                       o o
.                              ooo ooo                   ooo ooo
.                                             oooo oooo oooo oooo oooo oooo
.
. 1        2         4            10                        34
.
(End)
The tree graph. The total number of vertices at each stage is 1, 2, 4, 10, ...
    0 0
    |/
    0-0
   /
0-0
   \
    0-0
    |\
    0 0
- _Jon Perry_, Jan 27 2013
		

References

  • Richard K. Guy, Unsolved Problems Number Theory, Section B44.
  • D. Kurepa, On the left factorial function !n. Math. Balkanica 1 1971 147-153.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Haskell
    a003422 n = a003422_list !! n
    a003422_list = scanl (+) 0 a000142_list
    -- Reinhard Zumkeller, Dec 27 2011
    
  • Maple
    A003422 := proc(n) local k; add(k!,k=0..n-1); end proc:
    # Alternative, using the Charlier polynomials A137338:
    C := proc(n, x) option remember; if n > 0 then (x-n)*C(n-1, x) - n*C(n-2, x)
    elif n = 0 then 1 else 0 fi end: A003422 := n -> (-1)^(n+1)*C(n-1, -1):
    seq(A003422(n), n=0..22); # Peter Luschny, Nov 28 2018
    # third Maple program:
    a:= proc(n) option remember; `if`(n=0, 0, a(n-1)+(n-1)!) end:
    seq(a(n), n=0..23);  # Alois P. Heinz, Feb 24 2022
  • Mathematica
    Table[Sum[i!, {i, 0, n - 1}], {n, 0, 20}] (* Stefan Steinerberger, Mar 31 2006 *)
    Join[{0}, Accumulate[Range[0, 25]!]] (* Harvey P. Dale, Nov 19 2011 *)
    a[0] = 0; a[1] = 1; a[n_] := a[n] = n*a[n - 1] - (n - 1)*a[n - 2]; Array[a, 23, 0] (* Robert G. Wilson v, Jun 15 2013 *)
    a[n_] := (-1)^n*n!*Subfactorial[-n-1]-Subfactorial[-1]; Table[a[n] // FullSimplify, {n, 0, 22}] (* Jean-François Alcover, Jan 09 2014 *)
    RecurrenceTable[{a[n] == n a[n - 1] - (n - 1) a[n - 2], a[0] == 0, a[1] == 1}, a, {n, 0, 10}] (* Eric W. Weisstein, Jan 11 2019 *)
    Range[0, 20]! CoefficientList[Series[(ExpIntegralEi[1] - ExpIntegralEi[1 - x]) Exp[x - 1], {x, 0, 20}], x] (* Eric W. Weisstein, Jan 11 2019 *)
    Table[(-1)^n n! Subfactorial[-n - 1] - Subfactorial[-1], {n, 0, 20}] // FullSimplify (* Eric W. Weisstein, Jan 11 2019 *)
    Table[(I Pi + ExpIntegralEi[1] + (-1)^n n! Gamma[-n, -1])/E, {n, 0, 20}] // FullSimplify (* Eric W. Weisstein, Jan 11 2019 *)
  • Maxima
    makelist(sum(k!,k,0,n-1), n, 0, 20); /* Stefano Spezia, Jan 11 2019 */
    
  • PARI
    a003422(n)=sum(k=0,n-1,k!) \\ Charles R Greathouse IV, Jun 15 2011
    
  • Python
    from itertools import count, islice
    def A003422_gen(): # generator of terms
        yield from (0,1)
        c, f = 1, 1
        for n in count(1):
            yield (c:= c + (f:= f*n))
    A003422_list = list(islice(A003422_gen(),20)) # Chai Wah Wu, Jun 22 2022
    
  • Python
    def a(n):
        if n == 0: return 0
        s = f = 1
        for k in range(1, n):
            f *= k
            s += f
        return round(s)
    print([a(n) for n in range(24)])  # Peter Luschny, Mar 05 2024

Formula

D-finite with recurrence: a(n) = n*a(n - 1) - (n - 1)*a(n - 2). - Henry Bottomley, Feb 28 2001
Sequence is given by 1 + 1*(1 + 2*(1 + 3*(1 + 4*(1 + ..., terminating in n*(1)...). - Jon Perry, Jun 01 2004
a(n) = Sum_{k=0..n-1} P(n, k) / C(n, k). - Ross La Haye, Sep 20 2004
E.g.f.: (Ei(1) - Ei(1 - x))*exp(-1 + x) where Ei(x) is the exponential integral. - Djurdje Cvijovic and Aleksandar Petojevic, Apr 11 2000
a(n) = Integral_{x = 0..oo} [(x^n - 1)/(x - 1)]*exp(-x) dx. - Gerald McGarvey, Oct 12 2007
A007489(n) = !(n + 1) - 1 = a(n + 1) - 1. - Artur Jasinski, Nov 08 2007. Typos corrected by Antti Karttunen, Nov 29 2013
Starting (1, 2, 4, 10, 34, 154, ...), = row sums of triangle A135722. - Gary W. Adamson, Nov 25 2007
a(n) = a(n - 1) + (n - 1)! for n >= 2. - Jaroslav Krizek, Jun 16 2009
E.g.f. A(x) satisfies the differential equation A'(x) = A(x) + 1/(1 - x). - Vladimir Kruchinin, Jan 19 2011
a(n + 1) = p(-1) where p(x) is the unique degree-n polynomial such that p(k) = A182386(k) for k = 0, 1, ..., n. - Michael Somos, Apr 27 2012
From Sergei N. Gladkovskii, May 09 2013 to Oct 22 2013: (Start)
Continued fractions:
G.f.: x/(1-x)*Q(0) where Q(k) = 1 + (2*k + 1)*x/( 1 - 2*x*(k+1)/(2*x*(k+1) + 1/Q(k+1))).
G.f.: G(0)*x/(1-x)/2 where G(k) = 1 + 1/(1 - x*(k+1)/(x*(k+1) + 1/G(k+1))).
G.f.: 2*x/(1-x)/G(0) where G(k) = 1 + 1/(1 - 1/(1 - 1/(2*x*(k+1)) + 1/G(k+1))).
G.f.: W(0)*x/(1+sqrt(x))/(1-x) where W(k) = 1 + sqrt(x)/(1 - sqrt(x)*(k+1)/(sqrt(x)*(k+1) + 1/W(k+1))).
G.f.: B(x)*(1+x)/(1-x) where B(x) is the g.f. of A153229.
G.f.: x/(1-x) + x^2/(1-x)/Q(0) where Q(k) = 1 - 2*x*(2*k+1) - x^2*(2*k+1)*(2*k+2)/(1 - 2*x*(2*k+2) - x^2*(2*k+2)*(2*k+3)/Q(k+1)).
G.f.: x*(1+x)*B(x) where B(x) is the g.f. of A136580. (End)
a(n) = (-1)^(n+1)*C(n-1, -1) where C(n, x) are the Charlier polynomials (with parameter a=1) as given in A137338. (Evaluation at x = 1 gives A232845.) - Peter Luschny, Nov 28 2018
a(n) = (a(n-3)*(n-2)^2*(n-3)! + a(n-1)^2)/a(n-2) (empirical). - Gary Detlefs, Feb 25 2022
a(n) = signum(n)/b(1,n) with b(i,n) = i - [iMohammed Bouras, Sep 07 2022
Sum_{n>=1} 1/a(n) = A357145. - Amiram Eldar, Oct 01 2022

A061062 Sum of squared factorials: (0!)^2 + (1!)^2 + (2!)^2 + (3!)^2 +...+ (n!)^2.

Original entry on oeis.org

1, 2, 6, 42, 618, 15018, 533418, 25935018, 1651637418, 133333531818, 13301522971818, 1606652445211818, 231049185247771818, 39006837228880411818, 7639061293780877851818, 1717651314017980301851818
Offset: 0

Views

Author

Jason Earls, May 27 2001

Keywords

Comments

There is a Kurepa-like conjecture (see A049782) for this sequence: for primes p>3, p does not divide a(p-1). However, the conjecture fails for p=20879. - T. D. Noe, Dec 08 2004

Examples

			a(2) = 0!*0! + 1!*1! + 2!*2! = 6.
		

Crossrefs

Cf. A001044, A100288 (primes of the form (1!)^2 + (2!)^2 + (3!)^2 +...+ (k!)^2), A104344 (if sum starts at k=1), A049782.

Programs

  • Maple
    A061062:=n->sum((k!)^2, k=0..n): seq(A061062(n), n=0..15); # Zerinvary Lajos, Jan 22 2008
  • Mathematica
    s=0; Table[s=s+(n!)^2, {n, 0, 20}]
    Accumulate[(Range[0,20]!)^2] (* Harvey P. Dale, Apr 19 2015 *)
  • PARI
    { a=0; for (n=0, 100, write("b061062.txt", n, " ", a+=(n!)^2) ) } \\ Harry J. Smith, Jul 17 2009

Formula

a(n) = sum(k=0...n, (n-k)!^2 ). - Ross La Haye, Sep 21 2004
Recurrence: a(0) = 1, a(1) = 2, a(n) = (n^2+1)*a(n-1) - n^2*a(n-2). - Vladimir Reshetnikov, Oct 28 2015

Extensions

More terms from T. D. Noe, Dec 08 2004

A057245 Numbers m such that m | Sum_{k=1..m} k!.

Original entry on oeis.org

1, 3, 9, 11, 33, 99
Offset: 1

Views

Author

Robert G. Wilson v, Sep 21 2000

Keywords

Comments

n such that A067462(n) = 0. - T. D. Noe, May 13 2010
For any terms in this sequence, their LCM also belongs to this sequence. Term a(7), if it exists, is prime. - Max Alekseyev, Oct 14 2012
n > 1 is in this sequence iff A049782(n) = 1. - Max Alekseyev, Apr 17 2016
If it exists, a(7) > 12000000. - Bert Dobbelaere, Oct 28 2018
If it exists, a(7) > 1.6*10^8. - Giovanni Resta, Nov 09 2018

References

  • Richard K. Guy, Unsolved Problems in Number Theory, Springer, Third Ed., 2004, Section B44.

Crossrefs

Programs

  • GAP
    Filtered([1..1500],m->Sum([1..m],k->Factorial(k)) mod m = 0); # Muniru A Asiru, Oct 28 2018
  • Mathematica
    a = 0; b = 1; k = 2; While[k < 250001, c = k*b - (k - 1) a;
    If[ Mod[c, k] == 1, Print[k]]; a = b; b = c; k++] (* Robert G. Wilson v, Jun 15 2013 *)

A100612 a(n) = (0! + 1! + ... + (p-1)!) mod p, where p = prime(n).

Original entry on oeis.org

0, 1, 4, 6, 1, 10, 13, 9, 21, 17, 2, 5, 4, 16, 18, 13, 28, 22, 65, 68, 55, 20, 27, 76, 80, 13, 50, 43, 65, 109, 56, 81, 93, 134, 82, 10, 131, 4, 30, 104, 29, 170, 104, 165, 9, 122, 130, 42, 225, 50, 69, 12, 128, 60, 147, 52, 16, 56, 7, 218, 154, 264, 198, 48, 299, 205, 251, 101
Offset: 1

Views

Author

N. J. A. Sloane, Dec 02 2004

Keywords

Comments

The greedy inverse (indices of first occurrence of 1, 2, 3, ... in the sequence) is 2, 11, 91, 3, 12, 4, 59, -1, 8, 6, -1, 52, 7, 2550, -1, 14, 10, 15, 5461, 22, 9, 18, 205, 141, 4178, -1, 23, 17, 41, 39, -1, 5297, 937, -1, -1, -1, -1, 5248, 213, -1, 90, 48, 28, 4202, -1, 1718, 313, 64, 119, 27, ... where -1 means the number does not exist or is larger than 8000. - R. J. Mathar, Dec 19 2016
a(12397) = 31; a(54708) = 37. - Michel Marcus, May 11 2019
a(105527) = 35. - Michel Marcus, May 13 2019
a(16728884) = 26; a(62860131) = 35; sent by Milos Tatarevic. - Michel Marcus, May 18 2019

References

  • R. K. Guy, Unsolved Problems in Number Theory, B44: is a(n)>0 for n>2?

Crossrefs

See A049782 for more information. See also A003422, A236399.
Cf. A067462.

Programs

  • Maple
    lf:=n->add(k!,k=0..n-1);
    [seq(lf(ithprime(n)) mod ithprime(n),n=1..100)];
    # 2nd program:
    A100612 := proc(n)
        local p,f,a,k;
        f := 1 ;
        a := 0 ;
        p := ithprime(n) ;
        for k from 0 to p-1 do
            a := modp(a+f,p) ;
            f := modp(f*(k+1),p) ;
        end do:
        a ;
    end proc:
    seq(A100612(n),n=1..50) ; # R. J. Mathar, Dec 19 2016
  • Mathematica
    Table[Mod[Total[Range[0,n-1]!],n],{n,Prime[Range[70]]}] (* Harvey P. Dale, May 06 2013 *)
  • PARI
    a(n) = {my(p = prime(n), v = vector(p-1, k, Mod(k, p))); for (k=2, p-1, v[k] *= v[k-1];); lift(1+vecsum(v));} \\ Michel Marcus, May 05 2019

Formula

a(n) = A236399(n) mod prime(n).
a(n) = A067462(prime(n)) + 1, unless A067462(prime(n)) == - 1 (mod n). - Michel Marcus, May 05 2019

A067462 a(n) = (1! + 2! + ... + (n-1)!) mod n.

Original entry on oeis.org

0, 1, 0, 1, 3, 3, 5, 1, 0, 3, 0, 9, 9, 5, 3, 9, 12, 9, 8, 13, 12, 11, 20, 9, 13, 9, 9, 5, 16, 3, 1, 25, 0, 29, 33, 9, 4, 27, 9, 33, 3, 33, 15, 33, 18, 43, 17, 9, 47, 13, 12, 9, 12, 9, 33, 33, 27, 45, 27, 33, 21, 1, 54, 25, 48, 33, 64, 29, 66, 33, 67, 9, 54, 41, 63, 65, 33, 9, 19, 73, 63
Offset: 1

Views

Author

Alex Fink, Feb 24 2002

Keywords

Crossrefs

Cf. A049782.

Programs

  • Mathematica
    Mod[ #[[1]], #[[2]]]&/@Transpose[{Rest[FoldList[Plus, 0, Factorial[Range[90]]]], Range[90]}]
    Table[Mod[Total[Range[n-1]!],n],{n,90}] (* Harvey P. Dale, Jan 23 2023 *)
  • PARI
    a(n) = my(s=0, p=1); for (i=1, n-1, f = Mod(i, n); p*=f; s += p); lift(s); \\ Michel Marcus, Aug 19 2019
    
  • Python
    n = 0
    while n < 200:
        n,f,fs,i = n+1,1,0,1
        while i < n:
            f,i = (f*i)%n,i+1
            fs = (fs+f)%n
        print(n,fs) # A.H.M. Smeets, Aug 19 2019

A176787 a(n) = (0!-1!+2!-3!....(-1)^(n-1)*(n-1)!) mod n.

Original entry on oeis.org

0, 0, 2, 0, 0, 2, 4, 4, 8, 0, 5, 8, 0, 4, 5, 12, 9, 8, 15, 0, 11, 16, 19, 20, 20, 0, 17, 4, 20, 20, 10, 28, 5, 26, 25, 8, 0, 34, 26, 20, 2, 32, 6, 16, 35, 42, 7, 44, 11, 20, 26, 0, 21, 44, 5, 4, 53, 20, 33, 20, 49, 10, 53, 60, 0, 38, 6, 60, 65, 60, 65, 44, 16, 0, 20, 72, 60, 26, 5, 60, 17
Offset: 1

Views

Author

Keywords

Examples

			a(1) = 0! mod 1 = 1 mod 1 = 0;
a(2) = (0!-1!) mod 2 = (1 - 1) mod 2 = 0;
a(3) = (0!-1!+2!) mod 3 = (1 - 1 + 2) mod 3 = 2.
		

Crossrefs

Cf. A049782, A064383 (n such that a(n) is 0).

Programs

Formula

a(n) = A058006(n) mod n. - R. J. Mathar, Jul 13 2012

Extensions

Edited by Johannes W. Meijer, Jun 28 2011

A176788 a(n) = (0!! + 1!! + 2!! + 3!! + ... + (n-1)!!) mod n.

Original entry on oeis.org

0, 0, 1, 3, 0, 0, 1, 7, 0, 2, 6, 3, 12, 10, 12, 3, 13, 6, 11, 7, 3, 8, 14, 15, 12, 22, 15, 3, 19, 12, 16, 11, 30, 14, 17, 15, 17, 34, 9, 7, 26, 24, 36, 19, 42, 8, 2, 3, 24, 12, 48, 35, 2, 42, 52, 31, 15, 22, 51, 27, 32, 56, 24, 27, 22, 30, 6, 31, 54, 52, 12, 15, 7, 56, 12, 15, 52, 48
Offset: 1

Views

Author

Keywords

Examples

			0!! mod 1 = 1 mod 1 = 0.
(0!!+1!!) mod 2 = (1 + 1) mod 2 = 0.
(0!!+1!!+2!!) mod 3 = (1 + 1 + 2) mod 3 = 1.
		

Crossrefs

Programs

Formula

a(n) = A129981(n-1) mod n.

A176789 a(n) = (0!! - 1!! + 2!! - 3!! + ... + (-1)^(n-1)*(n-1)!!) mod n.

Original entry on oeis.org

0, 0, 2, 3, 2, 4, 5, 7, 4, 4, 2, 7, 3, 0, 4, 3, 5, 10, 3, 19, 7, 4, 3, 7, 14, 0, 10, 7, 5, 4, 29, 11, 4, 6, 14, 19, 4, 26, 13, 39, 13, 28, 2, 15, 19, 20, 11, 19, 14, 14, 40, 39, 0, 10, 4, 7, 7, 8, 7, 19, 26, 38, 28, 27, 39, 4, 57, 23, 43, 14, 5, 55, 30, 6, 64, 7, 70, 52, 50, 19, 37, 10, 75, 7
Offset: 1

Views

Author

Keywords

Comments

Alternating sum of double factorials modulo n.

Examples

			a(1) = 0!! mod 1 = 1 mod 1 = 0.
a(2) = (0!! - 1!!) mod 2 = (1 - 1) mod 2 = 0.
a(3) = (0!! - 1!! + 2!!) mod 3 = (1 - 1 + 2) mod 3 = 2.
		

Crossrefs

Programs

Formula

a(n) = (Sum_{k=0..n-1} (-1)^k*k!!) mod n = (1 + (-1)^(n-1)*A129831(n-1)) mod n.

A258944 Odd primes p that divide 2! + 3! + ... + (p-1)!.

Original entry on oeis.org

31, 373, 6855730873
Offset: 1

Views

Author

Jeppe Stig Nielsen, Nov 07 2015

Keywords

Comments

In other words, the odd primes p that divide A003422(p) - 2. Or the primes p with A049782(p) = 2.
Andrejic and Tatarevic found a(3).

Crossrefs

Programs

  • PARI
    forprime(p=3, 1e11, if(sum(k=2, p-1, k!) % p==0, print1(p, ", "))); \\ Altug Alkan, Nov 08 2015
Showing 1-9 of 9 results.