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.

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

This page as a plain text file.
%I A226570 #36 Feb 23 2025 01:30:10
%S A226570 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,
%T A226570 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,
%U A226570 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
%N A226570 a(n) = Sum_{k=1..n} (k+1)! mod n.
%C A226570 Motivated by sequence A100083, numbers such that a(n) = 0.
%C A226570 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
%H A226570 Charles R Greathouse IV, <a href="/A226570/b226570.txt">Table of n, a(n) for n = 1..10000</a>
%F A226570 a(n) = A086330(n) mod n. - _Chai Wah Wu_, Apr 16 2024
%F A226570 a(n) = Sum_{k=1..A002034(n)-2} (k+1)! mod n. - _David A. Corneth_, Apr 16 2024
%e A226570 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.
%e A226570 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).
%t A226570 Table[Mod[Sum[(k + 1)!, {k, n}], n], {n, 75}] (* _Alonso del Arte_, Jun 11 2013 *)
%o A226570 (PARI) a(n)=lift(sum(m=2,n-1,Mod(m!,n)))
%o A226570 (PARI) a(n)=my(t=Mod(1,n)); lift(sum(m=2,n+1,t*=m)) \\ _Charles R Greathouse IV_, Jun 11 2013
%o A226570 (Python)
%o A226570 def A226570(n):
%o A226570     a, c = 0, 1
%o A226570     for m in range(2,n):
%o A226570         c = c*m%n
%o A226570         if c==0:
%o A226570             break
%o A226570         a = (a+c)%n
%o A226570     return a # _Chai Wah Wu_, Apr 16 2024
%Y A226570 Cf. A002034, A086330, A100083, A007489, A003422.
%K A226570 nonn
%O A226570 1,3
%A A226570 _M. F. Hasler_, Jun 11 2013