%I #33 Sep 08 2022 08:46:11
%S 1,0,0,1,130,1329,1707670,27502484,209927657739,130904517147542068,
%T 3673771932850374193,69623451054783204822486486,
%U 3724616892817543661693877073170,149157913707716515940392007441860,12429106799179771738076359013310638297
%N a(n) = (A060371(n) - A094998(n))/A056604(n) for n > 1, with a(1)=1.
%C Let theta(p) be the smallest nonnegative solution z to the system of congruences z == 0 (mod p), z == 1 (mod v(p-1)), where p is a prime and v(p-1) = lcm(1,...,p-1). Theta(p) is unique mod lcm(p, v(p-1)), therefore it is unique mod v(p). Since both (p-1)!+1 and theta(p) are solutions to these congruences, ((p-1)!+1 - theta(p))/v(p) is always an integer. The sequence lists the values of this ratio (assuming theta(2)=0 and p=prime(n)).
%H Bruno Berselli, <a href="/A254924/b254924.txt">Table of n, a(n) for n = 1..50</a>
%H Umberto Cerruti, <a href="/A254924/a254924.pdf">Il Teorema Cinese dei Resti</a> (in Italian), 2015. The sequence is on page 21.
%e For n=5, a(5) = (A060371(5) - A094998(5))/A056604(5) = (3628801 - 25201)/27720 = 130.
%p with(numtheory): P:=proc(q) local a,j,k,ok,n; print(1); a:=[1];
%p for n from 3 to q do k:=0; a:=[op(a),n]; if isprime(n) then ok:=0; while ok=0 do ok:=1;
%p k:=k+1; for j from 2 to n-1 do if not (k*n mod j)=1 then ok:=0; break; fi; od; od;
%p print((((n-1)!+1)-k*n)/lcm(op(a))); fi; od; end: P(100); # _Paolo P. Lava_, Feb 16 2015
%t r[k_] := LCM @@ Range[k]; s[k_] := PowerMod[k, -1, r[k - 1]] k; w[k_] := ((k - 1)! + 1 - s[k])/r[k]; Table[w[Prime[n]], {n, 1, 20}]
%o (Magma) [(Factorial(p-1)+1-Modinv(p,Lcm([1..p-1]))*p)/Lcm([1..p]): p in PrimesUpTo(50)];
%Y Cf. A000040, A056604, A060371, A094998, A254939, A255010.
%K nonn
%O 1,5
%A _Bruno Berselli_, Feb 12 2015 - proposed by Umberto Cerruti (Department of Mathematics "Giuseppe Peano", University of Turin, Italy)
|