OFFSET
1,4
COMMENTS
a(n) > 1 if and only if n is composite. - Charles R Greathouse IV, Jan 04 2013
LINKS
T. D. Noe, Table of n, a(n) for n = 1..200
OEIS Wiki, Generalizations of the factorial
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
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 *)
PROG
(Haskell)
a051190 n = product $ map (gcd n) [1..n-1]
-- Reinhard Zumkeller, Nov 22 2011
(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
CROSSREFS
KEYWORD
nonn,nice
AUTHOR
Antti Karttunen, Oct 21 1999
STATUS
approved