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.
%I A061006 #36 Feb 19 2024 10:30:12 %S A061006 0,1,2,2,4,0,6,0,0,0,10,0,12,0,0,0,16,0,18,0,0,0,22,0,0,0,0,0,28,0,30, %T A061006 0,0,0,0,0,36,0,0,0,40,0,42,0,0,0,46,0,0,0,0,0,52,0,0,0,0,0,58,0,60,0, %U A061006 0,0,0,0,66,0,0,0,70,0,72,0,0,0,0,0,78,0,0,0,82,0,0,0,0,0,88,0,0,0,0,0 %N A061006 a(n) = (n-1)! mod n. %C A061006 It appears that a(n) = (n!*h(n)) mod n, where h(n) = Sum_{k = 1..n} 1/k. - _Gary Detlefs_, Sep 04 2010 %C A061006 Indeed: It is easy to show n!*h(n) - (n-1)! = n*(n-1)!*h(n-1). Since (n-1)!*h(n-1) is integral, n!*h(n) == (n-1)! mod n. - _Franz Vrabec_, Apr 08 2017 %H A061006 Seiichi Manyama, <a href="/A061006/b061006.txt">Table of n, a(n) for n = 1..1000</a> %H A061006 Wikipedia, <a href="http://en.wikipedia.org/wiki/Wilson's_theorem">Wilson's theorem</a> %F A061006 a(4) = 2, a(p) = p - 1 for p prime (Wilson's_theorem), a(n) = 0 otherwise. Apart from n = 4, a(n) = (n-1)*A061007(n) = (n-1)*A010051(n). %e A061006 a(4) = 2 since (4-1)! = 6 = 2 mod 4. %e A061006 a(5) = 4 since (5-1)! = 24 = 4 mod 5. %e A061006 a(6) = 0 since (6-1)! = 120 = 0 mod 6. %t A061006 Table[Mod[(n - 1)!, n], {n, 100}] (* _Alonso del Arte_, Feb 16 2014 *) %o A061006 (PARI) a(n)=if(isprime(n),n-1,if(n==4,2,0)) \\ _Charles R Greathouse IV_, Mar 31 2014 %Y A061006 Positive for all but the first term of A046022. Cf. A000040, A000142, A061007, A061008, A061009. %K A061006 nonn,easy %O A061006 1,3 %A A061006 _Henry Bottomley_, Apr 12 2001