login
This site is supported by donations to The OEIS Foundation.

 

Logo

Thanks to everyone who made a donation during our annual appeal!
To see the list of donors, or make a donation, see the OEIS Foundation home page.

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A061006 a(n) = (n-1)! mod n. 11
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, 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, 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 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,3

COMMENTS

It appears that a(n) = (n!*h(n)) mod n, where h(n) = Sum_{k = 1..n} 1/k. - Gary Detlefs, Sep 04 2010

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

LINKS

Seiichi Manyama, Table of n, a(n) for n = 1..1000

Wikipedia, Wilson's theorem

FORMULA

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).

EXAMPLE

a(4) = 2 since (4-1)! = 6 = 2 mod 4.

a(5) = 4 since (5-1)! = 24 = 4 mod 5.

a(6) = 0 since (6-1)! = 120 = 0 mod 6.

MAPLE

P:=proc(n) local a, i, k, w; for i from 1 by 1 to n do w:=((i-1)! mod i); print(w); od; end: P(1000); # Paolo P. Lava, Apr 23 2007

MATHEMATICA

Table[Mod[(n - 1)!, n], {n, 100}] (* Alonso del Arte, Feb 16 2014 *)

PROG

(PARI) a(n)=if(isprime(n), n-1, if(n==4, 2, 0)) \\ Charles R Greathouse IV, Mar 31 2014

CROSSREFS

Positive for all but the first term of A046022. Cf. A000040, A000142, A061007, A061008, A061009.

Sequence in context: A246816 A127786 A030207 * A080736 A276151 A144412

Adjacent sequences:  A061003 A061004 A061005 * A061007 A061008 A061009

KEYWORD

nonn,easy

AUTHOR

Henry Bottomley, Apr 12 2001

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified January 18 04:47 EST 2019. Contains 319269 sequences. (Running on oeis4.)