login
A254924
a(n) = (A060371(n) - A094998(n))/A056604(n) for n > 1, with a(1)=1.
3
1, 0, 0, 1, 130, 1329, 1707670, 27502484, 209927657739, 130904517147542068, 3673771932850374193, 69623451054783204822486486, 3724616892817543661693877073170, 149157913707716515940392007441860, 12429106799179771738076359013310638297
OFFSET
1,5
COMMENTS
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)).
LINKS
Umberto Cerruti, Il Teorema Cinese dei Resti (in Italian), 2015. The sequence is on page 21.
EXAMPLE
For n=5, a(5) = (A060371(5) - A094998(5))/A056604(5) = (3628801 - 25201)/27720 = 130.
MAPLE
with(numtheory): P:=proc(q) local a, j, k, ok, n; print(1); a:=[1];
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;
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;
print((((n-1)!+1)-k*n)/lcm(op(a))); fi; od; end: P(100); # Paolo P. Lava, Feb 16 2015
MATHEMATICA
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}]
PROG
(Magma) [(Factorial(p-1)+1-Modinv(p, Lcm([1..p-1]))*p)/Lcm([1..p]): p in PrimesUpTo(50)];
CROSSREFS
KEYWORD
nonn
AUTHOR
Bruno Berselli, Feb 12 2015 - proposed by Umberto Cerruti (Department of Mathematics "Giuseppe Peano", University of Turin, Italy)
STATUS
approved