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!)
A249355 Remainder of n!+2 divided by n+2 1
1, 0, 0, 3, 2, 3, 2, 2, 2, 3, 2, 3, 2, 2, 2, 3, 2, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 3, 2, 3, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 3, 2, 3, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 3, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 3, 2, 2 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,4
LINKS
FORMULA
If n+2 = p > 4 is prime, then a(n) = 3. Indeed, it is known that (p-2)! = 1 (mod p) for all primes p. Thus n!+2 = 1+2 = 3 (mod n+2).
If n+2 is composite and n > 2 then a(n) = 2. There are two cases: n+2 = a*b with a < b <= n (so n! is divisible by a*b), or n+2 = a^2 with 2*a <= n (so n! is divisible by a*(2*a)). - Robert Israel, Oct 27 2014
MATHEMATICA
Table[Mod[n!+2, n+2], {n, 0, 100}] (* Harvey P. Dale, Sep 01 2022 *)
PROG
(PARI) a(n)=lift(prod(k=2, n, k, Mod(1, n+2))+2)
(PARI) A249355(n)=if(n>2, isprime(n+2)+2, !n) \\ M. F. Hasler, Oct 31 2014
(Magma) [(Factorial(n)+2) mod(n+2): n in [0..100]]; // Vincenzo Librandi, Oct 27 2014
CROSSREFS
Sequence in context: A096835 A237838 A262880 * A355034 A064654 A162229
KEYWORD
nonn
AUTHOR
M. F. Hasler, Oct 26 2014
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 15 05:03 EDT 2024. Contains 372536 sequences. (Running on oeis4.)