OFFSET
1,2
COMMENTS
gcd(n^n, lcm(1..n)) must be limited to products of all the distinct prime divisors p of n. We can regard lcm(1..n) as the product of a "regular" factor r produced by primes that also divide n and a coprime factor s produced by primes that are coprime to n. Since the distinct prime divisors p of n are the only distinct prime divisors of n^n, we need only consider r and can ignore s when considering gcd(n^n, lcm(1..n)). Because r is the product of the largest power e_1 of each distinct prime divisor p, and since the power e_2 of the corresponding primes that divide n^n must always be such that e_2 >= e_1, it is sufficient to compute r to determine a(n). - Michael De Vlieger, Oct 26 2015
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10000 (First 1000 terms from Harry J. Smith)
FORMULA
a(n) = gcd(A000142(n), A000312(n), A003418(n)) = gcd(A000312(n), A003418(n)) = gcd(A051696(n), A003418(n)).
a(n) = Product_{prime p | n} p^floor(log_p(n)). - Robert Israel, Oct 26 2015
a(n) = e^(Sum_{k=1..n} (floor(n^k/k) - floor((n^k - 1)/k))*Mangoldt(k)) where Mangoldt is the Mangoldt function. - Anthony Browne, Jun 16 2016
EXAMPLE
n=6: a(6) = gcd(720, 60, 46656) = 12.
Since only 1 and 5 are relatively prime to 6, a(6) = lcm(1,2,3,4,5,6) / lcm(1,5) = 60/5 = 12.
MAPLE
A064446 := n -> ilcm(seq(i, i=1..n))/ilcm(op(select(k->igcd(n, k)=1, [$1..n])));
seq(A064446(i), i=0..61); # Peter Luschny, Jun 25 2011
N:= 1000: # to get a(1) to a(N)
Primes:= select(isprime, [2, seq(2*i+1, i=1..floor((N-1)/2))]):
A:= Vector(N, 1):
for p in Primes do
for d from 1 to floor(log[p](N)) do
for j from p^d to min(N, p^(d+1)-p) by p do
A[j]:= A[j]*p^d
od od od:
convert(A, list); # Robert Israel, Oct 26 2015
MATHEMATICA
Table[GCD[n!, n^n, LCM@@Range[n]], {n, 70}] (* Harvey P. Dale, Jun 25 2011 *)
f[n_] := Block[{p = First /@ FactorInteger@ n}, Times @@ Power @@@ Transpose[{p, Floor@ Log[#, n] & /@ p}]]; {1}~Join~Table[f@ n, {n, 2, 10000}] (* Michael De Vlieger, Oct 26 2015 *)
PROG
(PARI) L=1; for (n=1, 1000, L=lcm(L, n); write("b064446.txt", n, " ", gcd(n^n, L))) \\ Harry J. Smith, Sep 14 2009
(PARI) a(n)=my(f=factor(n)); for(i=1, #f~, f[i, 2]=logint(n, f[i, 1])); factorback(f) \\ Charles R Greathouse IV, Nov 19 2015
(PARI) a(n) = gcd(n^n, lcm(vector(n, k, k))); \\ Michel Marcus, Mar 18 2018
(GAP) List([1..70], n->Gcd(Factorial(n), n^n, Lcm([1..n]))); # Muniru A Asiru, Mar 20 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Labos Elemer, Oct 02 2001
STATUS
approved