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.

A064446 a(n) = gcd(n!, n^n, lcm(1, 2, ..., n)), or gcd(n^n, lcm(1, 2, ..., n)).

Original entry on oeis.org

1, 2, 3, 4, 5, 12, 7, 8, 9, 40, 11, 72, 13, 56, 45, 16, 17, 144, 19, 80, 63, 176, 23, 144, 25, 208, 27, 112, 29, 10800, 31, 32, 297, 544, 175, 864, 37, 608, 351, 800, 41, 6048, 43, 352, 675, 736, 47, 864, 49, 800, 459, 416, 53, 864, 275, 1568, 513, 928, 59, 21600, 61
Offset: 1

Views

Author

Labos Elemer, Oct 02 2001

Keywords

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

Examples

			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.
		

Crossrefs

Cf. A000142, A000312, A051696. Equals A003418(n)/A038610(n).

Programs

  • GAP
    List([1..70],n->Gcd(Factorial(n),n^n,Lcm([1..n]))); # Muniru A Asiru, Mar 20 2018
  • 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 *)
  • 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
    

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