[Question]
  [
Given an integer `n >= 2`, output the largest exponent in its prime factorization. This is OEIS sequence [A051903](https://oeis.org/A051903).
## Example
Let `n = 144`. Its prime factorization is `2^4 * 3^2`. The largest exponent is `4`.
## Test Cases
```
2 -> 1
3 -> 1
4 -> 2
5 -> 1
6 -> 1
7 -> 1
8 -> 3
9 -> 2
10 -> 1
11 -> 1
12 -> 2
144 -> 4
200 -> 3
500 -> 3
1024 -> 10
3257832488 -> 3
```
  
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 2 bytes
```
ÓZ
```
[Try it online!](https://tio.run/##MzBNTDJM/f//8OSo//8NDYxMAA "05AB1E – Try It Online")
**How?**
```
Ó   exponents of prime factors
 Z  maximum
```
[Answer]
# [Python 2](https://docs.python.org/2/), ~~62~~ ~~57~~ 56 bytes
```
lambda n:max(k%n-n%(k/n+2)**(k%n)*n for k in range(n*n))
```
[Try it online!](https://tio.run/##RYyxDoIwGAZnfYpvaWhLifS3LiT6IupQo1WCfBACiT49ppPLJXfDjd/5NVDWhCMu6zv2t3sEmz5@dKdYUelux1KMtdmNJdIwoUNLTJHPh6alMWuO/Edx8HuDEmcfgoPUtcMhw9cSrs12M04tZxQqLKhOULIUUNB0SDrvfg "Python 2 – Try It Online")
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 3 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
ÆEṀ
```
**[Try it online!](https://tio.run/##y0rNyan8//9wm@vDnQ3///83NDAyAQA "Jelly – Try It Online")**
```
ÆEṀ  - Full program / Monadic link.
ÆE   - Array of exponents of prime factorization.
  Ṁ  - Maximum.
```
This also works in [M](https://github.com/DennisMitchell/m). [Try it online!](https://tio.run/##y/3//3Cb68OdDf///zc0MDIBAA "M – Try It Online")
[Answer]
# [Ohm v2](https://github.com/MiningPotatoes/Ohm), 2 bytes
```
n↑
```
[Try it online!](https://tio.run/##y8/INfr/P@9R28T//w1NTAA "Ohm v2 – Try It Online")
## Explanation?
No.
[Answer]
# [Python 2](https://docs.python.org/2/), 78 bytes
```
n=input()
e=m=0
f=2
while~-n:q=n%f<1;f+=1-q;e=q*-~e;m=max(m,e);n/=f**q
print m
```
[Try it online!](https://tio.run/##BcFBDoMgEAXQPafopolQiUK6Ev9hXAyBpDMFg7HdeHV8r/xb@orvXZClHG3QisCYVYRXZ8ofuqwsFfKMqwvxBWdrIFRjLwoM3n4Dj6SDTIjGVFX2LO3BvbvZv28 "Python 2 – Try It Online")
-5 thanks to [ovs](https://codegolf.stackexchange.com/users/64121/ovs).
This answer doesn't do prime checks. Instead, it takes advantage of the fact that the highest exponent of a prime factor will be greater than or equal to the exponent of any other factor in any factorization of a number.
[Answer]
# [Haskell](https://www.haskell.org/), ~~61~~ ~~60~~ ~~50~~ ~~48~~ 46 bytes
-2 bytes thanks to [xnor](https://codegolf.stackexchange.com/users/20260/xnor)
```
f n=maximum[a|k<-[2..n],a<-[1..n],n`mod`k^a<1]
```
[Try it online!](https://tio.run/##HcZNCsIwEAbQq2Sp8BkyMVUL7RE8QYh2QIshnbH4Ay68eywuHrwbP8t1mmodjfbCnyxvifwt3SZ6azWBl9F/Osj9MpQTd5SqcFbTG@H5eDar@ZH1Zce1iR5bBDTYYY8DWpADEciDQoB3Ds2CnA@p/gA "Haskell – Try It Online")
### 45 bytes with an import:
```
import NumberTheory
maximum.map snd.factorize
```
[Try it Online!](https://tio.run/##DcmxDoIwFAXQ3a/oqMlN0z5aqQOfoJObMaZqCQ08IKUk6s9XhjOdzi99GIZSIs9TyuKy8jOkaxem9N21DftP5JUl@1ks41u2/pWnFH@hsI@jaMQW54fYzymOWbYHcSNUMLA4oobDCVpBa2iCNgakFOxGKzKoyNauIuPcvfwB)
[Answer]
# [Japt](https://github.com/ETHproductions/japt) [`-h`](https://codegolf.meta.stackexchange.com/a/14339/), ~~9~~ 7 bytes
```
k ü mÊn
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&flags=LWg=&code=ayD8IG3Kbg==&input=MTQ0)
```
k ü mÊn     :Implicit input of integer
k           :Prime factors
  ü         :Group by value
    m       :Map
     Ê      :  Length
      n     :Sort
            :Implicit output of last element
```
[Answer]
# Mathematica, 27 bytes
```
Max[Last/@FactorInteger@#]&
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78n6Zgq/DfN7Ei2iexuETfwS0xuSS/yDOvJDU9tchBOVbtf0BRZl6JgkNatLGRqbmFsZGJhUXsfwA "Wolfram Language (Mathematica) – Try It Online")
[Answer]
# [MATL](https://github.com/lmendo/MATL), 4 bytes
```
YFX>
```
[Try it online!](https://tio.run/##y00syfn/P9Itwu7/f0MTEwA "MATL – Try It Online")
```
       % implicit input
YF     % Exponents of prime factors
X>     % maximum
       % implicit output
```
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 5 bytes
```
ḋḅlᵐ⌉
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/r//@GO7oc7WnMebp3wqKfz/39jI1NzC2MjEwuL/1EA "Brachylog – Try It Online")
### Explanation
```
ḋ          Prime decomposition
 ḅ         Group consecutive equal values
  lᵐ       Map length
    ⌉      Maximum
```
[Answer]
# [Husk](https://github.com/barbuz/Husk), 5 bytes
```
▲mLgp
```
[Try it online!](https://tio.run/##yygtzv7//9G0Tbk@6QX///83NDAyAQA "Husk – Try It Online")
* `p` – Gets the prime factors.
* `g` – Groups adjacent values.
* `mL` – Gets the lengths of each group.
* `▲` – Maximum.
[Answer]
# [APL (Dyalog)](https://www.dyalog.com/), 19 bytes
```
⎕CY'dfns'
⌈/1↓2pco⎕
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///qKM97f@jvqnOkeopaXnF6lyPejr0DR@1TTYqSM4HioMU/E/jsuDiSuMyNTAAUYYGRiYA "APL (Dyalog Unicode) – Try It Online")
**How?**
`2pco⎕` - 2D array of prime factors and exponents
`1↓` - drop the factors
`⌈/` - maximum
[Answer]
# Javascript 54 bytes
\*assuming infinite stack (as do in code-golf challenges)
```
P=(n,i=2,k)=>i>n?k:n%i?k>(K=P(n,i+1))?k:K:P(n/i,i,-~k)
console.log(P(2 )== 1)
console.log(P(3 )== 1)
console.log(P(4 )== 2)
console.log(P(5 )== 1)
console.log(P(6 )== 1)
console.log(P(7 )== 1)
console.log(P(8 )== 3)
console.log(P(9 )== 2)
console.log(P(10 )== 1)
console.log(P(11 )== 1)
console.log(P(12 )== 2)
console.log(P(144 )== 4)
console.log(P(200 )== 3)
console.log(P(500 )== 3)
console.log(P(1024 )== 10)
//console.log(P(3257832488 )== 3)
```
[Answer]
# PARI/GP, 24 bytes
```
n->vecmax(factor(n)[,2])
```
If I do not count the `n->` part, it is 21 bytes.
[Answer]
# [Octave](https://www.gnu.org/software/octave/), 25 bytes
```
@(n)[~,m]=mode(factor(n))
```
[**Try it online!**](https://tio.run/##y08uSSxL/Z9mq6en999BI08zuk4nN9Y2Nz8lVSMtMbkkvwgopvk/TcNYkytNwwREWIAIQxMw29DAyETzPwA "Octave – Try It Online")
### Explanation
`factor` produces the array of (possibly repeated) prime exponents
The second output of `mode` gives the number of times that the mode (i.e. the most repeated entry) appears.
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 7 bytes
```
eShMr8P
```
[Try it here.](http://pyth.herokuapp.com/?code=eShMr8P&input=1024&debug=0)
[Answer]
# [Python 2](https://docs.python.org/2/), ~~90~~ 84 bytes
```
f=lambda n,i=2,l=[0]:(n<2)*max(map(l.count,l))or n%i and f(n,i+1,l)or f(n/i,2,l+[i])
```
[Try it online!](https://tio.run/##DctBDsIgEIXhvaeYjQnYiQK2m0ZO0rBAa3USGBqCiZ4eZ/EW70@@/dfehV3vm08x39cIjOQdJr@YMCu@OX3K8aty3FU6P8qHGyatSwU@EkReYVMiBitVopwLofBhoaD7JomAGGrk11M5tFc9LHYc0RmDk8waN4b5ALBX4iaedP8D "Python 2 – Try It Online")
[Answer]
# [Gaia](https://github.com/splcurran/Gaia), 4 bytes
```
ḋ)⌠)
```
**[Try it online!](https://tio.run/##S0/MTPz//@GObs1HPQs0//83NgMA "Gaia – Try It Online")**
* `ḋ` - Computes the prime factorization as **[prime, exponent]** pairs.
	+ `⌠` - Map and collect the result with the maximal value.
	+ `)` - Last element (exponent).
	+ `)` - Last element (maximal exponent)
# [Gaia](https://github.com/splcurran/Gaia), 4 bytes
```
ḋ)¦⌉
```
[Try it online!](https://tio.run/##S0/MTPz//@GObs1Dyx71dP7/b2wGAA "Gaia – Try It Online")
* `ḋ` - Computes the prime factorization as **[prime, exponent]** pairs.
	+ `)¦` - Map with the last element (exponent).
	+ `⌉` - Gets the maximum element.
[Answer]
# [MY](https://bitbucket.org/zacharyjtaylor/my-language), 4 bytes
```
ωĖ⍐←
```
[Try it online!](https://tio.run/##y638//9855Fpj3onPGqb8P//fyMA "MY – Try It Online")
## Explanation?
```
ωĖ⍐←
ω    = argument
 Ė   = prime exponents
  ⍐  = maximum
   ← = output without a newline
```
[Answer]
# [Octave](https://www.gnu.org/software/octave/): 30 bytes
```
@(x)max(histc(a=factor(x),a));
```
1. `a=factor(x)` returns a vector containing the prime factors of `x`. This is a vector sorted in ascending order where the multiplication of all numbers in `factor(x)` yields `x` itself such that each number in the vector is prime.
2. `histc(...,a)` calculates a histogram on the prime factor vector where the bins are the prime factors. The histogram counts up how many times we have seen each prime number thus yielding the exponent of each prime number. We can cheat here a bit because even though `factor(x)` will return duplicate numbers or bins, only one of the bins will capture the total amount of times we see a prime number.
3. `max(...)` thus returns the largest exponent.
## [Try it online!](https://tio.run/##DczLCsMgFIThV5nlEbLwlsZWAn2P0sXBGCo0CokpeXvrbv5vMSVU/sWWMeOlYWAx4oYJDncoCaWgNJS10LKX1BZGj5Mz2jr39u1Jl9j4ok86aiCeVw617B0HFsK3texI/VrhgXxu8UtZDFgoiY6cD8p9Co@Yl87tDw "Octave – Try It Online")
[Answer]
# [Racket](https://racket-lang.org/), ~~83~~ 79 bytes
```
(λ(n)(cadr(argmax cadr((let()(local-require math/number-theory)factorize)n))))
```
[Try it online!](https://tio.run/##HYxLDsIwDAX3PYUlNvai4iMuZFKnjUgcsByJcjXuwJVC6VvNzOIZh7t4P2TWGWyXASeJSQViU@j4/aASBp4M2ebCL9gZszgS5ho4jybPlkygsC9HbeUmNvoi1VaKHLxaegspbes04MOSOuD//ny6XLf4Aw "Racket – Try It Online")
(I'm not sure if there's a consensus on what constitutes a complete Racket solution, so I'm going with the Mathematica convention that a pure function counts.)
### How it works
`factorize` gives the factorization as a list of pairs: `(factorize 108)` gives `'((2 2) (3 3))`. The second element of a pair is given by `cadr`, a shorthand for the composition of `car` (head of a list) with `cdr` (tail of a list).
I feel silly doing `(cadr (argmax cadr list))` to find the maximum of the second elements, but `max` doesn't work on lists: `(max (map cadr list))` doesn't do what we want. I'm not an expert in Racket, so maybe there's a standard better way to do this.
# Racket, 93 bytes
```
(λ(n)(define(p d m)(if(=(gcd m d)d)(+(p d(/ m d))1)0))(p(argmax(λ(d)(p d n))(range 2 n))n))
```
[Try it online!](https://tio.run/##LY1LCsNADEP3OYWhG5kumoRse5gh82FoYgaTQu/WO/RKEzsUvJCeLKRhfaWj37YghfQyA2LKVRLlt1DH7wvhP0KjSDujZjxRVtMUOTLuHuBxWZ54ZEZD0LKHj/ftw4tiWG0n0ezarvOAplUOgo9N47wYPAE "Racket – Try It Online")
### How it works
An alternative version that doesn't import `factorize` and instead does everything from scratch, more or less. The function `(p m d)` finds the highest power of `d` that divides `m` and then we just find highest value of `(p n d)` for `d` between `2` and `n`. (We don't need to restrict this to primes, since there will not be a composite power that works better than prime powers.)
[Answer]
## [Alice](https://github.com/m-ender/alice), 17 bytes
```
/o
\i@/w].D:.t$Kq
```
[Try it online!](https://tio.run/##S8zJTE79/18/nysm00G/PFbPxUqvRMW78P9/QxMTAA "Alice – Try It Online")
### Explanation
```
/o
\i@/...
```
This is just a framework for simple-ish arithmetic programs with decimal I/O. The `...` is the actual program, which already has the input on the stack and leaves the output on top of the stack.
Alice actually has built-ins to get the prime factorisation of an integer (even with prime-exponent pairs), but the shortest I've come up with using those is 10 bytes longer than this.
Instead the idea is that we repeatedly divide one copy of each distinct prime factor out of the input, until we reach **1**. The number of steps this takes is equal to the largest prime exponent. We'll be abusing the tape head as the counter variable.
```
w      Remember the current IP position. Effectively starts a loop.
  ]      Move the tape head to the right, which increments our counter.
  .D     Duplicate the current value, and deduplicate its prime factors.
         That means, we'll get a number which is the product of the value's
         unique prime factors. For example 144 = 2^4 * 3^2 would become
         6 = 2 * 3.
  :      Divide the value by its deduplicated version, which decrements the
         exponents of its prime factors.
  .t     Duplicate the result and decrement it. This value becomes 0 once we
         reach a result of 1, which is when we want to terminate the loop.
$K     Jump back to the beginning of the loop if the previous value wasn't 0.
q      Retrieve the tape head's position, i.e. the number of steps we've taken
       through the above loop.
```
[Answer]
# Julia, 60 52 40 bytes
```
f(x)=maximum(collect(values(factor(x))))
```
-12 +correction thanks to [Steadybox](https://codegolf.stackexchange.com/users/61405/steadybox)
[Answer]
# [Actually](https://github.com/Mego/Seriously), 4 bytes
```
w♂NM
```
[Try it online!](https://tio.run/##S0wuKU3Myan8/7/80cwmP9///w0NjEwA "Actually – Try It Online")
```
w♂NM  - Full program.
w     - Pushes the prime factorization as [prime, exponent] pairs.
 ♂N   - Get the last element of each (the exponents).
   M  - Maximum.
```
[Answer]
# [Python 2](https://docs.python.org/2/), 64 bytes
*-4 bytes thanks to H.PWiz.*
```
lambda n:max(a*(n%k**a<1)for a in range(n)for k in range(2,-~n))
```
[Try it online!](https://tio.run/##RYzLDoIwFET3fMVsTFpyTdqKLyJfoi6uEbRBLgS60I2/XgsbJ5nNmckZPuHZi4tNdYkv7m53hpQdvxXnSlZtnvPJ6qYfwfCCkeVRK1lA@weO1l/ROoZ6ChMqnB1hQygIW8KOsCccCEeCNak2NR1skXZnEtkac82y2eln52IpM6QMo5eARnkdfw "Python 2 – Try It Online")
Port of [H.PWiz's Haskell answer](https://codegolf.stackexchange.com/a/145941/68615). I'm only sharing this because I'm proud that I was able to understand this piece of Haskell code and translate it. :P
[Answer]
# Axiom, 61 bytes
```
f n==(a:=factors n;reduce(max,[a.i.exponent for i in 1..#a]))
```
This is the first time i find it is possible define the function
without the use of () parenthesis. Instead of "f(n)==" "f n=="
one character less...
[Answer]
# J, 9 bytes
```
[:>./_&q:
```
Max of `<./` all prime exponents `_&q:`
[Try it online!](https://tio.run/##Xc@/DsIgEAbwnaf44mBtYurdARZJ8EUcHIzEuBjT2WdHWxOaY2D4wf35eJY8IUUQfqdc4nk4XLfvWHqzGdDlFDvs8YnIkzHmfnu8sMuQHglcaTXdTKn0@vWoOWqGmbbypEcx6WrmxtLUuyWLW4MT6QW@vWCSpYdp/Z74MVhx4R@ufAE "J – Try It Online")
[Answer]
# APL(NARS), 15 chars, 30 bytes
```
{⌈/+/¨v∘=¨v←π⍵}
```
test:
```
  f←{⌈/+/¨v∘=¨v←π⍵}
  f¨2..12
1 1 2 1 1 1 3 2 1 1 2 
  f¨144 200 500 1024 3257832488
4 3 3 10 3 
```
comment:
```
{⌈/+/¨v∘=¨v←π⍵}
          v←π⍵    π12 return 2 2 3; assign to v the array of prime divisors of argument ⍵
      v∘=¨        for each element of v, build one binary array, show with 1 where are in v array, else puts 0 
                  return one big array I call B, where each element is the binary array above
   +/¨            sum each binary element array of  B
 ⌈/               get the max of all element of B (that should be the max exponet)
```
]