The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A226570 a(n) = Sum_{k=1..n} (k+1)! mod n. 1
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 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,3
COMMENTS
Motivated by sequence A100083, numbers such that a(n) = 0. - Hasler
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
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
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
EXAMPLE
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.
MATHEMATICA
Table[Mod[Sum[(k + 1)!, {k, n}], n], {n, 75}] (* Alonso del Arte, Jun 11 2013 *)
PROG
(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
CROSSREFS
Sequence in context: A029906 A094907 A343401 * A158380 A051734 A157898
KEYWORD
nonn
AUTHOR
M. F. Hasler, Jun 11 2013
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 21 08:47 EDT 2024. Contains 372732 sequences. (Running on oeis4.)