login
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.
2
2, 3, 5, 7, 11, 13, 17, 31, 47, 53, 59, 61, 71, 107, 137, 149, 173, 227, 251, 277, 313, 347, 349, 359, 367, 373, 409, 419, 443, 463, 467, 479, 491, 499, 521, 523, 541, 563, 577, 599, 607, 613, 617, 631, 643, 647, 677, 683, 739, 751, 757, 809, 811, 821, 823, 827, 829
OFFSET
1,1
COMMENTS
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.
LINKS
EXAMPLE
0!*4! + 1 = 5^2 and 4+0 = 5-1, so 5 is in the sequence.
1!*9! - 1 = 11^2*2999 and 1+9 = 10-1, so 11 is in the sequence.
0!*12! + 1 = 13^2*2834329 and 0+12 = 13-1, so 13 is in the sequence.
10!*6! + 1 = 17^2*83*108923 and 10+6=17-1, so 17 is in the sequence.
19!*39!-1 is divisible by 59^2 and 19+39=59-1, so 59 is in the sequence.
MAPLE
filter:= proc(p) local m, n, A, v;
A:= Array(0..p);
A[0]:= 1:
for n from 1 to p do A[n]:= n*A[n-1] mod p^2 od:
for m from 0 to (p-1)/2 do
v:= A[m] * A[p-1-m] mod p^2;
if v = 1 or v = p^2-1 then return true fi;
od;
false
end proc:
select(filter, [seq(ithprime(i), i=1..150)]); # Robert Israel, Dec 30 2024
PROG
(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
CROSSREFS
A007540 is a subsequence.
Sequence in context: A003459 A276132 A202264 * A253717 A186307 A321420
KEYWORD
nonn
AUTHOR
Richard Peterson, Oct 22 2024
EXTENSIONS
a(14) onwards from Andrew Howroyd, Oct 22 2024
STATUS
approved