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

A226570 a(n) = Sum_{k=1..n} (k+1)! mod n.

Original entry on oeis.org

0, 0, 2, 0, 2, 2, 4, 0, 8, 2, 10, 8, 8, 4, 2, 8, 11, 8, 7, 12, 11, 10, 19, 8, 12, 8, 8, 4, 15, 2, 0, 24, 32, 28, 32, 8, 3, 26, 8, 32, 2, 32, 14, 32, 17, 42, 16, 8, 46, 12, 11, 8, 11, 8, 32, 32, 26, 44, 26, 32, 20, 0, 53, 24, 47, 32, 63, 28, 65, 32, 66, 8, 53, 40, 62, 64, 32, 8, 18, 72, 62, 2, 25, 32, 62, 14, 44, 32, 74, 62, 60, 88, 62, 16, 7, 56, 78, 46, 98
Offset: 1

Views

Author

M. F. Hasler, Jun 11 2013

Keywords

Comments

Motivated by sequence A100083, numbers such that a(n) = 0.
Note that this is a different sequence from A086330: in this one, the factorials are added up and then the remainder of the total divided by n is taken, whereas in A086330 each factorial is computed modulo n prior to being added up. - Alonso del Arte, Jun 11 2013

Examples

			a(3) = 2 because 2!, 3! and 4! are 2, 6 and 24 respectively, which add up to 32, and modulo 3 that is 2.
a(4) = 0 because 2!, 3!, 4! and 5! add up to 152, and modulo 4 that is 0 (note that this is different from A086330(4) = 4).
		

Crossrefs

Programs

  • Mathematica
    Table[Mod[Sum[(k + 1)!, {k, n}], n], {n, 75}] (* Alonso del Arte, Jun 11 2013 *)
  • PARI
    a(n)=lift(sum(m=2,n-1,Mod(m!,n)))
    
  • PARI
    a(n)=my(t=Mod(1,n)); lift(sum(m=2,n+1,t*=m)) \\ Charles R Greathouse IV, Jun 11 2013
    
  • Python
    def A226570(n):
        a, c = 0, 1
        for m in range(2,n):
            c = c*m%n
            if c==0:
                break
            a = (a+c)%n
        return a # Chai Wah Wu, Apr 16 2024

Formula

a(n) = A086330(n) mod n. - Chai Wah Wu, Apr 16 2024
a(n) = Sum_{k=1..A002034(n)-2} (k+1)! mod n. - David A. Corneth, Apr 16 2024
Showing 1-1 of 1 results.