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.

A072230 a(n) = n! (mod n^2), that is, n factorial modulo n^2.

This page as a plain text file.
%I A072230 #26 Nov 26 2024 08:49:46
%S A072230 0,2,6,8,20,0,42,0,0,0,110,0,156,0,0,0,272,0,342,0,0,0,506,0,0,0,0,0,
%T A072230 812,0,930,0,0,0,0,0,1332,0,0,0,1640,0,1806,0,0,0,2162,0,0,0,0,0,2756,
%U A072230 0,0,0,0,0,3422,0,3660,0,0,0,0,0,4422,0,0,0,4970,0,5256,0,0,0,0,0,6162
%N A072230 a(n) = n! (mod n^2), that is, n factorial modulo n^2.
%C A072230 With the exception of n=4, if n is composite, a(n) = 0. If n is prime, a(n) = n*(n-1). For example, a(11) = 11*10 = 110, a(41) = 41*40 = 1640. - _Gary Detlefs_, May 01 2010
%F A072230  a(n) = A174530(n)*(A174530(n)-1) for n>=5. - _Filip Zaludek_, Oct 13 2016
%t A072230 Table[Mod[n!, n^2], {n, 79}] (* or *)
%t A072230 Table[Which[n == 4, Mod[n!, n^2], PrimeQ@ n, n (n - 1), True, 0], {n, 79}] (* _Michael De Vlieger_, Oct 14 2016 *)
%o A072230 (PARI) a(n)=if(isprime(n), n*(n-1), if(n==4, 8, 0)) \\ _Charles R Greathouse IV_, Dec 14 2015
%Y A072230 Cf. A002378, A008837.
%K A072230 nonn,easy
%O A072230 1,2
%A A072230 _Roman Stawski_, Jul 05 2002