login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A371035
a(n) = A086330(prime(n)).
1
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,2
COMMENTS
The sequence sometimes decreases, as for example at a(29) = 5186 < 5284 = a(28).
EXAMPLE
For n = 3, a(n) = A086330(prime(3)) = A086330(5) = (2! mod 5) + (3! mod 5) + (4! mod 5) = 2 + 1 + 4 = 7.
PROG
(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
(PARI) a(n) = my(p=prime(n)); sum(m=2, p, m! % p); \\ Michel Marcus, Apr 11 2024
CROSSREFS
Sequence in context: A147611 A007991 A037294 * A076857 A243717 A337482
KEYWORD
easy,nonn
AUTHOR
Alexandre Herrera, Apr 10 2024
STATUS
approved