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.

A051190 a(n) = Product_{k=1..n-1} gcd(k,n).

Original entry on oeis.org

1, 1, 1, 2, 1, 12, 1, 16, 9, 80, 1, 3456, 1, 448, 2025, 2048, 1, 186624, 1, 1024000, 35721, 11264, 1, 573308928, 625, 53248, 59049, 179830784, 1, 1007769600000, 1, 67108864, 7144929, 1114112, 37515625, 160489808068608, 1, 4980736, 89813529
Offset: 1

Views

Author

Antti Karttunen, Oct 21 1999

Keywords

Comments

a(n) > 1 if and only if n is composite. - Charles R Greathouse IV, Jan 04 2013

Crossrefs

Programs

  • Haskell
    a051190 n = product $ map (gcd n) [1..n-1]
    -- Reinhard Zumkeller, Nov 22 2011
    
  • Maple
    A051190 := proc(n) local i; mul(igcd(n, i ), i = 1..(n-1)) end;
  • Mathematica
    a[n_] := If[PrimeQ[n], 1, Times @@ (GCD[n, #]& /@ Range[n-1])]; Table[a[n], {n, 1, 39}]  (* Jean-François Alcover, Jul 18 2012 *)
    Table[Times @@ GCD[n, Range[n-1]], {n, 50}] (* T. D. Noe, Apr 12 2013 *)
    Table[Product[GCD[k,n],{k,n-1}],{n,50}] (* Harvey P. Dale, Jan 29 2025 *)
  • PARI
    a(n)=my(f=factor(n)); prod(i=1, #f[,1], prod(j=1, f[i,2], f[i,1]^(n\f[i,1]^j)))/n \\ Charles R Greathouse IV, Jan 04 2013
    
  • PARI
    a(n) = prod(k=1,n-1,gcd(k,n)); /* Joerg Arndt, Apr 14 2013 */
    
  • Sage
    A051190 = lambda n: mul(gcd(n,i) for i in (1..n-1))
    [A051190(n) for n in (1..39)] # Peter Luschny, Apr 07 2013
    
  • Sage
    # A second, faster version, based on the prime factorization of a(n):
    def A051190(n):
        R = 1
        if not is_prime(n) :
            for p in primes(n//2+1):
                s = 0; r = n; t = n-1
                while r > 0 :
                    r = r//p; t = t//p
                    s += (r-t)*(r+t-1)
                R *= p^(s/2)
        return R
    [A051190(i) for i in (1..1000)]  # Peter Luschny, Apr 08 2013

Formula

a(n) = Product_{ d divides n, d < n } d^phi(n/d). - Peter Luschny, Apr 07 2013
a(n) = A067911(n) / n. - Peter Luschny, Apr 07 2013
Product_{j=1..n} Product_{k=1..j-1} gcd(j,k), n >= 1. - Daniel Forgues, Apr 11 2013
a(n) = sqrt( (1/n) * (A092287(n) / A092287(n-1)) ). - Daniel Forgues, Apr 13 2013