Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #26 Oct 07 2021 02:00:05
%S 0,1,2,3,4,5,6,1,8,9,10,1,12,13,1,1,16,17,18,1,1,21,22,1,24,25,26,1,
%T 28,1,30,1,1,33,1,1,36,37,1,1,40,1,42,1,1,45,46,1,48,49,1,1,52,53,1,1,
%U 1,57,58,1,60,61,1,1,1,1,66,1,1,1,70,1,72,73,1,1,1,1,78,1,80,81,82,1,1,85,1,1
%N Phi-torial of n (A001783) modulo n.
%C Is a(n)<> 1 iff n in A033948, n>2? [_R. J. Mathar_, May 21 2009]
%C Same as A103131, except there -1 appears instead of n-1. By Gauss's generalization of Wilson's theorem, a(n)=-1 means n has a primitive root (n in A033948) and a(n)=1 means n has no primitive root (n in A033949). [_T. D. Noe_, May 21 2009]
%H Amiram Eldar, <a href="/A160377/b160377.txt">Table of n, a(n) for n = 1..10000</a>
%H John B. Cosgrave and Karl Dilcher, <a href="http://www.emis.de/journals/INTEGERS/papers//i39/i39.Abstract.html"> Extensions of the Gauss-Wilson Theorem</a>, Integers: Electronic Journal of Combinatorial Number Theory, Vol. 8 (2008), Article #A39.
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/WilsonsTheorem.html">Wilson's Theorem</a>.
%F a(n) = A001783(n) mod n. - _R. J. Mathar_, May 21 2009
%F For n>2, a(n)=n-1 if A060594(n)=2; otherwise a(n)=1. - _Max Alekseyev_
%F a(n) = Gauss_factorial(n, n) modulo n. (Definition of the Gauss factorial in A216919.) - _Peter Luschny_, Oct 20 2012
%e Phi-torial of 12 equals 1*5*7*11=385 which leaves a remainder of 1 when divided by 12.
%e Phi-torial of 14 equals 1*3*5*9*11*13=19305 which leaves a remainder of 13 when divided by 14.
%p copr := proc(n) local a,k ; a := {1} ; for k from 2 to n-1 do if gcd(k,n) = 1 then a := a union {k} ; fi; od: a ; end:
%p A001783 := proc(n) local c; mul(c,c= copr(n)) ; end:
%p A160377 := proc(n) A001783(n) mod n ; end: seq( A160377(n),n=1..100) ; # _R. J. Mathar_, May 21 2009
%p A160377 := proc(n) local k, r; r := 1:
%p for k to n do if igcd(n,k) = 1 then r := modp(r*k, n) fi od;
%p r end: seq( A160377(i), i=1..88); # _Peter Luschny_, Oct 20 2012
%t Table[nn = n; a = Select[Range[nn], CoprimeQ[#, nn] &];
%t Mod[Apply[Times, a], nn], {n, 1, 88}] (* _Geoffrey Critzer_, Jan 03 2015 *)
%o (Sage)
%o def A160377(n):
%o r = 1
%o for k in (1..n):
%o if gcd(n, k) == 1: r = mod(r*k, n)
%o return r
%o [A160377(n) for n in (1..88)] # _Peter Luschny_, Oct 20 2012
%Y Cf. A124740 (one of just four listing "product of coprimes").
%K nonn
%O 1,3
%A _J. M. Bergot_, May 11 2009
%E Edited and extended by _R. J. Mathar_ and _Max Alekseyev_, May 21 2009