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

A371035 a(n) = A086330(prime(n)).

Original entry on oeis.org

0, 2, 7, 18, 43, 73, 113, 159, 203, 334, 496, 706, 863, 874, 1097, 1124, 1560, 2033, 2073, 2409, 2462, 3336, 3345, 3634, 3958, 4657, 5198, 5284, 5186, 6096, 7801, 8594, 9270, 9167, 10659, 10578, 12375, 12227, 13221, 13769, 15958, 16458, 18820, 17919, 18722
Offset: 1

Views

Author

Alexandre Herrera, Apr 10 2024

Keywords

Comments

The sequence sometimes decreases, as for example at a(29) = 5186 < 5284 = a(28).

Examples

			For n = 3, a(n) = A086330(prime(3)) = A086330(5) = (2! mod 5) + (3! mod 5) + (4! mod 5) = 2 + 1 + 4 = 7.
		

Crossrefs

Programs

  • PARI
    a(n) = my(p=prime(n)); sum(m=2, p, m! % p); \\ Michel Marcus, Apr 11 2024
  • Python
    from sympy import isprime
    l = []
    for i in range(2,185):
        if isprime(i):
            sum = 0
            reminder = 1
            for j in range(2, i):
                reminder = (reminder * j) % i
                sum += reminder
            l.append(sum)
    print(l)
    
  • Python
    from sympy import prime
    def A371035(n):
        a, c, p = 0, 1, prime(n)
        for m in range(2,p):
            c = c*m%p
            a += c
        return a # Chai Wah Wu, Apr 16 2024
    

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