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.

A249355 Remainder of n!+2 divided by n+2.

This page as a plain text file.
%I A249355 #31 Jun 02 2025 10:15:59
%S A249355 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,
%T A249355 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,
%U A249355 2,3,2,3,2,2,2,2,2,3,2,2,2,3,2,2,2,2,2,3,2,2
%N A249355 Remainder of n!+2 divided by n+2.
%H A249355 Antti Karttunen, <a href="/A249355/b249355.txt">Table of n, a(n) for n = 0..2048</a>
%F A249355 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).
%F A249355 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
%t A249355 Table[Mod[n!+2,n+2],{n,0,100}] (* _Harvey P. Dale_, Sep 01 2022 *)
%o A249355 (PARI) a(n)=lift(prod(k=2,n,k,Mod(1,n+2))+2)
%o A249355 (PARI) A249355(n)=if(n>2,isprime(n+2)+2,!n) \\ _M. F. Hasler_, Oct 31 2014
%o A249355 (Magma) [(Factorial(n)+2) mod(n+2): n in [0..100]]; // _Vincenzo Librandi_, Oct 27 2014
%Y A249355 Cf. A055976, A242707.
%K A249355 nonn
%O A249355 0,4
%A A249355 _M. F. Hasler_, Oct 26 2014