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 A290171 #38 Jul 28 2021 04:26:22 %S A290171 5,13,563,1277,780887 %N A290171 Numbers k such that (k-1)^2 < (k-1)! mod k^2. %C A290171 The Wilson primes (A007540) are terms of this sequence. %C A290171 a(n) is prime or twice a prime. Otherwise (k-1)! mod k^2 = 0 for k > 9 where k is not a prime and not twice a prime. - _David A. Corneth_, Jul 23 2017 %t A290171 Select[Range[10^4],(#-1)^2<Mod[(#-1)!,#^2]&] (* _Giorgos Kalogeropoulos_, Jul 23 2021 *) %o A290171 (PARI) for(n=1,1e5,a=(n-1)!%n^2;if((n-1)^2<a,print1(n", "))) %o A290171 (PARI) is(n) = (n-1)^2 < lift(Mod((n-1)!, n^2)) \\ _Felix Fröhlich_, Jul 23 2017 %o A290171 (PARI) val(n, p) = my(r=0); while(n, r+=n\=p); r %o A290171 is(n) = my(f = factor(n), r = Mod(1, n^2)); if(#f~ > 2, return(0), if(#f~==2, if(f[1,1]!=2, return(0)))); forprime(p=2,n-1, r*=Mod(p,n^2)^val(n-1,p)); (n-1)^2 < lift(r) \\ _David A. Corneth_, Jul 23 2017 %o A290171 (Python) %o A290171 def ok(n): %o A290171 nn = n**2; f = 1%nn %o A290171 for k in range(1, n): f = f*k%nn %o A290171 return (n-1)**2 < f %o A290171 print(list(filter(ok, range(1, 1300)))) # _Michael S. Branicky_, Jul 23 2021 %o A290171 (Python) # faster for initial segment of sequence %o A290171 from math import factorial %o A290171 def afind(limit, startk=1): %o A290171 k = startk; kkprev = (k-1)**2; f = factorial(k-1) %o A290171 while k < limit: %o A290171 kk = k*k %o A290171 if kkprev < f%kk: print(k, end=", ") %o A290171 kkprev = kk; f *= k; k += 1 %o A290171 afind(10000) # _Michael S. Branicky_, Jul 25 2021 %Y A290171 Cf. A007540. %K A290171 nonn,hard,more %O A290171 1,1 %A A290171 _Gionata Neri_, Jul 23 2017 %E A290171 a(5) from _Chai Wah Wu_, Jul 30 2017