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.

A261969 Product of primes dividing n with maximum multiplicity.

Original entry on oeis.org

1, 2, 3, 2, 5, 6, 7, 2, 3, 10, 11, 2, 13, 14, 15, 2, 17, 3, 19, 2, 21, 22, 23, 2, 5, 26, 3, 2, 29, 30, 31, 2, 33, 34, 35, 6, 37, 38, 39, 2, 41, 42, 43, 2, 3, 46, 47, 2, 7, 5, 51, 2, 53, 3, 55, 2, 57, 58, 59, 2, 61, 62, 3, 2, 65, 66, 67, 2, 69, 70, 71, 2, 73, 74, 5, 2, 77, 78, 79, 2, 3, 82, 83, 2, 85, 86, 87, 2, 89, 3, 91
Offset: 1

Views

Author

Keywords

Comments

a(1) = 1 by convention.
If n is prime then a(n) = n; e.g., a(2) = 2, a(3) = 3, a(5) = 5, etc. Also if n is nonsquare semiprime then a(n) = n; e.g., a(6) = 6, a(10) = 10, a(14) = 14, a(15) = 15, etc. - Zak Seidov, Sep 07 2015
a(n)= n precisely when n is squarefree. - Franklin T. Adams-Watters, Feb 16 2019

Examples

			18 = 2^1 * 3^2. 2 is the maximum exponent, 3 is the only prime with that exponent, so a(18) = 3.
36 = 2^2 * 3^2, maximum exponent 2 for both 2 and 3, so a(36) = 2*3 = 6.
		

Crossrefs

Cf. A007947.
Cf. A000040, A001358. - Zak Seidov, Sep 07 2015

Programs

  • Haskell
    a261969 n = product $ map fst $ filter ((== emax) . snd) $ zip ps es
        where emax = maximum es
              ps = a027748_row n; es = a124010_row n
    -- Reinhard Zumkeller, Sep 08 2015
  • Maple
    a:= n-> (l->(m->mul(`if`(m=j[2], j[1], 1), j=l))(
             max(seq(i[2], i=l))))(ifactors(n)[2]):
    seq(a(n), n=1..100);  # Alois P. Heinz, Sep 07 2015
  • Mathematica
    f[n_] := Block[{pf = FactorInteger@ n}, Times @@ Take[First /@ pf, Flatten@ Position[Last /@ pf, Max[Last /@ pf]]]]; f /@ Range@ 91 (* Michael De Vlieger, Sep 07 2015 *)
  • PARI
    a(n) = my(fm=factor(n),m); if(n<2,return(n)); m=vecmax(fm[,2]~); prod(k=1,#fm[,2]~,if(fm[k,2]==m,fm[k,1],1))
    
  • PARI
    a(n) = {my(f = factor(n)); if (n>1, m = vecmax(f[,2])); for (i=1, #f~, f[i,2] = (f[i,2]==m)); factorback(f);} \\ Michel Marcus, Sep 08 2015