cp's OEIS Frontend

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.

A160377 Phi-torial of n (A001783) modulo n.

Original entry on oeis.org

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, 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, 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
Offset: 1

Views

Author

J. M. Bergot, May 11 2009

Keywords

Comments

Is a(n)<> 1 iff n in A033948, n>2? [R. J. Mathar, May 21 2009]
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]

Examples

			Phi-torial of 12 equals 1*5*7*11=385 which leaves a remainder of 1 when divided by 12.
Phi-torial of 14 equals 1*3*5*9*11*13=19305 which leaves a remainder of 13 when divided by 14.
		

Crossrefs

Cf. A124740 (one of just four listing "product of coprimes").

Programs

  • Maple
    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:
    A001783 := proc(n) local c; mul(c,c= copr(n)) ; end:
    A160377 := proc(n) A001783(n) mod n ; end: seq( A160377(n),n=1..100) ; # R. J. Mathar, May 21 2009
    A160377 := proc(n) local k, r; r := 1:
    for k to n do if igcd(n,k) = 1 then r := modp(r*k, n) fi od;
    r end: seq( A160377(i), i=1..88); # Peter Luschny, Oct 20 2012
  • Mathematica
    Table[nn = n; a = Select[Range[nn], CoprimeQ[#, nn] &];
    Mod[Apply[Times, a], nn], {n, 1, 88}] (* Geoffrey Critzer, Jan 03 2015 *)
  • Sage
    def A160377(n):
        r = 1
        for k in (1..n):
            if gcd(n, k) == 1: r = mod(r*k, n)
        return r
    [A160377(n) for n in (1..88)]  # Peter Luschny, Oct 20 2012

Formula

a(n) = A001783(n) mod n. - R. J. Mathar, May 21 2009
For n>2, a(n)=n-1 if A060594(n)=2; otherwise a(n)=1. - Max Alekseyev
a(n) = Gauss_factorial(n, n) modulo n. (Definition of the Gauss factorial in A216919.) - Peter Luschny, Oct 20 2012

Extensions

Edited and extended by R. J. Mathar and Max Alekseyev, May 21 2009