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 A377266 #39 Dec 30 2024 16:55:03 %S A377266 2,3,5,7,11,13,17,31,47,53,59,61,71,107,137,149,173,227,251,277,313, %T A377266 347,349,359,367,373,409,419,443,463,467,479,491,499,521,523,541,563, %U A377266 577,599,607,613,617,631,643,647,677,683,739,751,757,809,811,821,823,827,829 %N A377266 Primes p with the property that there exist nonnegative integers m,n such that m!*n! is congruent to either +1 or -1 mod p^2, with m + n = p - 1. %C A377266 The generalization of Wilson's Theorem that x!*(p-1-x)! is either +1 or -1 mod p when p is prime is known. This is investigated here for cases of p such that there is an x with x!*(p-1-x)! congruent to either +1 or -1 mod p^2. %H A377266 Robert Israel, <a href="/A377266/b377266.txt">Table of n, a(n) for n = 1..4011</a> %e A377266 0!*4! + 1 = 5^2 and 4+0 = 5-1, so 5 is in the sequence. %e A377266 1!*9! - 1 = 11^2*2999 and 1+9 = 10-1, so 11 is in the sequence. %e A377266 0!*12! + 1 = 13^2*2834329 and 0+12 = 13-1, so 13 is in the sequence. %e A377266 10!*6! + 1 = 17^2*83*108923 and 10+6=17-1, so 17 is in the sequence. %e A377266 19!*39!-1 is divisible by 59^2 and 19+39=59-1, so 59 is in the sequence. %p A377266 filter:= proc(p) local m,n,A,v; %p A377266 A:= Array(0..p); %p A377266 A[0]:= 1: %p A377266 for n from 1 to p do A[n]:= n*A[n-1] mod p^2 od: %p A377266 for m from 0 to (p-1)/2 do %p A377266 v:= A[m] * A[p-1-m] mod p^2; %p A377266 if v = 1 or v = p^2-1 then return true fi; %p A377266 od; %p A377266 false %p A377266 end proc: %p A377266 select(filter, [seq(ithprime(i),i=1..150)]); # _Robert Israel_, Dec 30 2024 %o A377266 (PARI) isok(p)={if(isprime(p), for(m=0, p\2, my(t=(m!*(p-1-m)!%p^2)); if(t==1||t==p^2-1, return(1)))); 0} \\ _Andrew Howroyd_, Oct 22 2024 %Y A377266 A007540 is a subsequence. %Y A377266 Cf. A157249, A157250. %K A377266 nonn %O A377266 1,1 %A A377266 _Richard Peterson_, Oct 22 2024 %E A377266 a(14) onwards from _Andrew Howroyd_, Oct 22 2024