[Question]
  [
A [**powerful number**](https://en.wikipedia.org/wiki/Powerful_number) is a positive integer \$n\$ such that for every prime \$p\$ that divides \$n\$, \$p^2\$ also divides \$n\$. Or equivalently, \$n\$ is powerful if and only if it can be written in the form \$n = a^2b^3\$, where \$a\$ and \$b\$ are positive integers.
For example, \$972 = 2^2 \times 3^5\$ is powerful, because \$2^2\$ and \$3^2\$ both divide \$972\$. And we have \$972 = 6^2 \times 3^3\$.
\$961 = 31^2\$ is also powerful, because \$31^2\$ divides \$961\$. And we have \$961 = 31^2 \times 1^3\$.
On the other hand, \$1001 = 7 \times 11 \times 13\$ is not powerful, because \$7^2\$ does not divide \$1001\$. It is not possible to write \$1001\$ in the form \$a^2b^3\$.
Here is a list of all the powerful numbers less than 1000:
```
1, 4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 72, 81, 100, 108, 121, 125, 128, 144, 169, 196, 200, 216, 225, 243, 256, 288, 289, 324, 343, 361, 392, 400, 432, 441, 484, 500, 512, 529, 576, 625, 648, 675, 676, 729, 784, 800, 841, 864, 900, 961, 968, 972
```
This is sequence [A001694](https://oeis.org/A001694) in the OEIS.
## Task
Given a positive integer \$n\$, determine whether or not it is a powerful number.
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest code in bytes wins.
This is also a [decision-problem](/questions/tagged/decision-problem "show questions tagged 'decision-problem'") so you may use your language's convention for truthy/falsy (swapping truthy and falsy is allowed), or use two distinct, fixed values to represent true or false.
  
[Answer]
# [Python 3](https://docs.python.org/3/), 43 bytes
Returns `False` for a powerful number, and `True` otherwise.
```
f=lambda n,i=1:i>n or(n/i)**.5%i>0<f(n,i+1)
```
[Try it online!](https://tio.run/##JZDNbsMgEITveYrtoZJxUWow5ietI@VR3NZukWJsYXrI07s77gHE7M58C6yP8rOkdo/zuuRC22N7w3bexpLHz9@8xSXd4xxLpZq6tmKf@vswf3wNlGTs1SVeEy25Sq9R1PW5e47X5n2quPeixH6jnpQkI8lLCpKUlaQ7Xk5Sq3mxNly37HCsPZtV02DjgNKQ8CsNaQwIwARw4NMH8UCaFmxI77EFjOBEi0ZrGdUGHmEQMxhuDK7m2dKh1imudZpjnWOKBdQaRlmHE2oOXYeER8ID4HH3ABkwI1i81OnTaVoyJYqJ8pC@x@r/ZY24nChOxD8k6KmnKlFaClw3dGjNMRX@vcMg9j8 "Python 3 – Try It Online")
Checks the condition that `n` is in the form `a^2*b^3` by asserting that `n/a^3` is a perfect square. In Python this would look something like `(n/a**3)**.5%1==0`. This condition can be rearranged so that it is slightly golfier:
```
(n/a**3)**.5%1==0
n**.5/a**1.5%1==0
n**.5/a**.5/a%1==0
(n/a)**.5/a%1==0
(n/a)**.5%a==0
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 4 bytes
```
ÆE1e
```
[Try it online!](https://tio.run/##HY@xFcIwDERX8QAuIluW5AEYJQ0vC9BBAy0tFWNAQZeGNcgi5i6F/HzS3Zd9nJflNMZ6Pcg8vq/t/Fhv6/33fm6XzxiSk@YUOfWcxHIqDeU51YKCVvQNDocOmGWaeCAghZJ@KZSqJBDTyaGv7MQdqZVsyggenSuQqBxUA6p2rFDGlMtV@bSApbHXBL1WEGsOihFqCpQ5b@w5p85EMBEEBN/eKTt3dONPvfwB "Jelly – Try It Online")
Inverted native truthy/falsy semantics: 0 for powerful numbers, 1 otherwise.
```
  1e    Is 1 an element of
ÆE      the array of the input's prime exponents?
```
[Answer]
# [R](https://www.r-project.org), 24 bytes
```
\(n)all((n/1:n)^.5%%1:n)
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m72waMGiNNulpSVpuhY7YjTyNBNzcjQ08vQNrfI04_RMVVVBDIj0TYM0DUNNrjQNIxBhDCJMQISpJld5RmZyhoZicWJBQU6lhqGVoYGBTpomVN-CBRAaAA)
Port of [@dingledooper's approach](https://codegolf.stackexchange.com/a/263443/55372).
---
### [R](https://www.r-project.org), 26 bytes
```
\(n,i=1:n)n%in%(i^2%o%i^3)
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m72waMGiNNulpSVpuha7YjTydDJtDa3yNPNUM_NUNTLjjFTzVTPjjDUhCm7qp2kYanKlaRiBCGMQYQIiTDW5yjMykzM0ihMLCnIqNQytLC0tddI0odoWLIDQAA)
Uses the alternative characterization from the question.
[Answer]
# [Python](https://docs.python.org/3.8/), 43 bytes
```
f=lambda n,c=1:f(n,c+1)if c**n%n else n/c%c
```
[Try it online!](https://tio.run/##DYtBCoAgFAXXdYq/CbKC@rQJwcOYaQn1FHPT6c3VzGImfvkKWLeYSnHq1s9@aMJkFEvXV44svCMzDOhA9n4tYTadKS4kAnlQ0jhtzxMvLGTb1BghU32FjMkjVyk/ "Python 3.8 (pre-release) – Try It Online")
Outputs Truthy/Falsey reversed. A different method than [dingledooper's solution](https://codegolf.stackexchange.com/a/263443/20260), without using square roots.
The idea is to find the square-free part `c` of `n`, that is, the product of the distinct prime factors of `n`. We do this by counting up to the smallest `c` where `c**n%n` is 0, which checks that the prime factors of `c`, if copied many times, cover those of `n`.
Having found `c`, we check whether `n/c%c` is zero, which is equivalent to `n` being divisible by `c**2`. This confirms that `n` includes each of its prime factors at least twice. This also works in Python 2 where `/` is integer division rather than float division, since `n` is divisible by `c`, for a solution with only exact integer arithmetic.
Rather than finding the smallest `c` with `c**n%n`, we could instead check all values of `c` from `1` to `n` for one where `c**n%n` and `n/c%c` are both 0. This could look like:
**44 bytes**
```
f=lambda n,c=1:c>n or(c**n%n+n/c%c)*f(n,c+1)
```
[Try it online!](https://tio.run/##DcpBCsMgEEbhdXqK2QTUBNKhmyCkdzGT2gjprwxuenrj7sH3yr@eGa@1aGtxu8JvPwJhlo29vEFZjTiHERMWGcW6aDpObFvMSqAE0oDvx/DMT7b@MaRIyJX6Z33RhNqj3Q "Python 3.8 (pre-release) – Try It Online")
**39 bytes with exit code**
```
def f(n,c=1):c**n%n+n/c%c>0!=f(n,-~c%n)
```
[Try it online!](https://tio.run/##FYwxDoMwEARreMVRWMKECCyayBH8BV1soFlOh4vQ5OsOdCONZuRM647hJZrzJ0SKNVoenfXcNDB4oGPDU1@Nt3j@2MDmuCuBNpDOWELtWtdfQVkkPf09sG/RDemCsghfDpI8yXwc@Q8 "Python 3.8 (pre-release) – Try It Online")
From *@loopy walt*
## [Python 2](https://docs.python.org/2/), 42 bytes
```
d=n=input()
while n%d**2:d-=1
print d**n%n
```
[Try it online!](https://tio.run/##JcpBCsIwEEDR/ZxiCBTa2kKmy8BcIRcQF9FEG6jTEFLU08egy/956VPWXZZ63zNajILZySP0NJHWNBhoKx2FN/e8emcsYMpRCtoJMLzDTSlVPQv/VD/Aa41bQOn8OC7Gz0zw962lk9r42cx0OaFi1grrFw "Python 2 – Try It Online")
Finds the largest value `d` where `n` is divisible by `d**2`, then checks that it includes each distinct prime factor of `n` via `d**n%n` being zero.
[Answer]
# TI-BASIC (TI-84 Plus/Plus CE), ~~35~~ 27 Bytes
-8 bytes thanks to Bbrk24
```
Prompt A:For(B,1,A:If not(fPart(√(A/B:Stop:End:Disp 0
```
The thing right after `A/B` is a cube (3). The thing right before the `A/B` is a sqrt symbol.
Does nothing and terminates if your number is powerful and prints `0` and terminates if your number is not powerful.
**Ungolfed**
```
Prompt A
For(B,1,A
If not(fPart(√(A/B
Stop
End
Disp 0
```
**Explained**
```
Prompt A              Asks user for input A
For(B,1,A             For loop: increase B by 1 from 1 until it reaches A
If                    If...
            √(        square root of...
              A/B    A/B^3...
  not(fPart(          is a whole number...
Stop                  then stop execution.
End                   End of while loop, go back to While A>B
Disp 0                If, eventually, B does exceed A, then A is not a powerful number.
```
TI-BASIC programs are scored by tokens bytes, not characters.  
TI-BASIC also completes parentheses for you.
### Edit: Test cases
**Truthy**:  
[![1](https://i.stack.imgur.com/A1ApC.png)](https://i.stack.imgur.com/A1ApC.png)[![2](https://i.stack.imgur.com/hZBqj.png)](https://i.stack.imgur.com/hZBqj.png)[![3](https://i.stack.imgur.com/o873j.png)](https://i.stack.imgur.com/o873j.png)
**Falsy**:  
[![4](https://i.stack.imgur.com/nr7Mf.png)](https://i.stack.imgur.com/nr7Mf.png)[![5](https://i.stack.imgur.com/ErSyE.png)](https://i.stack.imgur.com/ErSyE.png)[![6](https://i.stack.imgur.com/TiOfH.png)](https://i.stack.imgur.com/TiOfH.png)
[Answer]
# Excel, 42 bytes
```
=LET(a,SEQUENCE(A1),OR(a^2*TOROW(a^3)=A1))
```
Input in cell `A1`.
[Answer]
# [J](http://jsoftware.com/), ~~12 10~~ 8 bytes
```
1 e._&q:
```
[Try it online!](https://tio.run/##HY/NTgMxDITvPMWoSLSrZlfrxPnxSpyQOHHiBTigVoUL4gV49WWmB0cZZ@az870fluMVzxuOSFixseYFL@9vr7vhsnw8/W779HD5vP3gdHr8s/l6OE@w89cSERPmDZbgCSMhEqwl5MrqCSWzqJ39RkenHjTbuupgwLKk/JYl3UUQJsSRL9@Jd6QXsSXH0BEawUTRQ2lEleAIV8w13F2rDVqqetXYq5mx2klpgjYnqnXd1Ot67UoMJYYAQ7uHZGhGNP205/0f "J – Try It Online")
*-2 by using Unrelated String's approach of checking for 1 instead of verifying that every exponents was 2 or more*
*-2 thanks to Bubbler for a shorter way to get prime exponents*
* `_&q:` shows the number's prime exponents
* `1 e.` checks if all exponents are greater than 1, by checking if 1 is an element and using 0 for truthy and 1 for falsy
[Answer]
# [K (ngn/k)](https://codeberg.org/ngn/k), 18 bytes
```
{|/~1!%x%/3#,1+!x}
```
[Try it online!](https://ngn.codeberg.page/k#eJxlkFluwzAMRP99ChmFE1sVIGuxNiDoRYIG9kdyBSGLz94ZJy3Q9kOCyOE8kjqX212vpu1qp92bMu9tfTTNpdz6U+2WoV1kWYq879Z+lnNp69DuXwWfvdKL1GWWS6FG6/AB8UKkroe/IhUIB216KNqc5PHZsQzHH9Nv5Zv2b8BrEUYJr0RSIithghJ2wolKOIuD2CMfUBERJxSbceQFg7EMWW8sQ+9JICaTwzq7ETekd2QzTIlXZgs4HAUXgHIZLTxtns2952gJJRNzk0FusrBNEZRAaPBAhcgXc5FqpCPRkQhInD0zzOyRAzflLthjbK6r4KfuznuBH9lS8xfCsWJT)
Works more like [dingledooper's Python solution](https://codegolf.stackexchange.com/a/263443/78410).
```
{|/~1!%x%/3#,1+!x}
             1+!x   1..x
       x%/3#,       starting from x, divide by above three times
      %             square root of each
 |/~1!              test if any of them has zero fractional part
```
---
# [K (ngn/k)](https://codeberg.org/ngn/k), 22 bytes
```
{|//x=*/:/1_*\3#,1+!x}
```
[Try it online!](https://ngn.codeberg.page/k#eJxlT1uKAjEQ/J9TJCyrMzGQyfsBsheRlcmHXmFQ17NbJSLs7keaVNeju0/tejNm3SvTjD2qg//QdifXn2E4t+t4XD/7JLtqvanb5j4uamlyneT2JfgetemwLqo3crROXyDPr9i/JBkQe2PH3xPbdHib/u9yacJqEbQoWlQtbNLCRbyshXd4wAH9BEUGLhDbeWaBwTpC6q0jDIEJjKnMoc49E5+RwTObsBSWyhFweBI+IcpXjAi0BQ4PgasVSCJ70aIXHWwxIyUxNAVEpcwfe5lspqPQURhQuHslrJxREy/lLbhjHi53YXeb0xZVsvEATeNcwg==)
A bit of a convoluted way to check if the given number `x` is `a^2 * b^3`. Returns 1 if `x` is a powerful number, 0 otherwise.
```
{|//x=*/:/1_*\3#,1+!x}
                 1+!x   1..x inclusive -> A
              3#,       an array that contains three copies of A
            *\     cumulative product (A; A^2; A^3)
          1_       drop first
      */:/    reduce by cartesian product by multiplication
    x=        boolean matrix indicating each number is equal to input
 |//          max of all booleans
```
[Answer]
# Dyalog APL, 21 bytes
```
⊢(⊣|*⍨)0⌈/∘⍸⍤=⊢|⍨2*⍨⍳
```
port of xnor's [Python](https://codegolf.stackexchange.com/a/263481) answer. Outputs inverse truthy value
```
⊢(⊣|*⍨)0⌈/∘⍸⍤=⊢|⍨2*⍨⍳ ⍝ implicit n
                    ⍳ ⍝ list values 1..n
                 2*⍨ ⍝ square each value
              ⊢|⍨    ⍝ mod by n
        0   =        ⍝ find where index is 0
         ⌈/∘⍸⍤        ⍝ Get max index divisible (d)
⊢(⊣|*⍨)              ⍝ then check d^n mod n
```
[Answer]
# C, ~~69~~ 63 bytes
-6 bytes thanks to [@c--](https://codegolf.stackexchange.com/users/112488/c) suggesting to reverse the loops and pointing out that I'd managed to leave in an unused variable.
```
i,j;f(n){for(i=n;i;i--)for(j=n;j;j--)n*=i*i*j*j*j!=n;return!n;}
```
[Try it online!](https://tio.run/##bU5BCsMgELz7ik2goCaCOW99TDG1rNBNkTSX4NutQkMO7exhZ3aGYb15eF8KjRGDZLWHJUlyjIRkjGoqVhUxVsXakSYd23T1mu7rO3HHmAvxCs8bsdwWmpXYBXxRG0A2l8HBhHVdYbLWIgwDKziDByiAbJ/88w68Um0Msr/M0I/ACn@SWZwslw8)
[Answer]
# [Factor](https://factorcode.org) + `math.primes.factors math.unicode`, ~~30~~ 29 bytes
```
[ group-factors unzip 1 ∋ ]
```
[Try it online!](https://tio.run/##NYwxDsIwEAT7vGIfAFFCCQ9ANDSIKkphzCVYJGdzZxfwAiR@yUdMIKLb1YymMzZ6ycfDbr9dYzTxUgZxI2nZ/YjCqHqruJIwDbOR2Fl/pvmI4Z4USrdEbKcVhGK8TxWO2BTFqqrQ1ItTmxv04lNY/suJHy6gxvv5wpeyj2hh/Ri8Ejo3RBKUsAMZyR8 "Factor – Try It Online")
Port of Unrelated String's [Jelly answer](https://codegolf.stackexchange.com/a/263440/97916).
-1 by using `unzip` instead of `values` to get at the exponents
* `group-factors` get an associative array of a number's prime factors and exponents
* `unzip` get just the exponents
* `1 ∋` is 1 in this?
[Answer]
# [Octave](https://www.gnu.org/software/octave/), 22 bytes
```
@(n)n-(t=1:n).^2'*t.^3
```
* The output for powerful input is a matrix containing at least one entry equal to 0, which is falsy in Octave.
* The output for a non-powerful input is a non-empty matrix with all entries different than zero, which is truthy.
[Try it online!](https://tio.run/##y08uSSxL/Z9mq6en999BI08zT1ejxNbQKk9TL85IXatEL874f6WCrUKahqW5kaY1V2aaRqUml4KCQkpmcYGGul9@iUJBfnlqUVppjromV2pOcSpCMgBJIi/lPwA "Octave – Try It Online") The footer code contains truthiness/falsihood test.
Or [verify all test cases](https://tio.run/##y08uSSxL/Z9mq6en999BI08zT1ejxNbQKk9TL85IXatEL874f1p@kUKegq2CoZWlpSWXAhBUAnlpQMXWYF5mmkalJpgFBCmZxQUa6rq66hCR1JziVBSpPKh4XgoXEP8HAA). The footer code displays the input number if powerful (falsy output), or `--` otherwise (truthy output).
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 4 bytes
```
ǏΠ²Ḋ
```
[Try it Online!](https://vyxal.pythonanywhere.com/?v=2#WyJBIiwiIiwix4/OoMKy4biKIiwiIiwiMVxuMlxuM1xuNFxuNVxuNlxuN1xuOFxuOVxuMTBcbjExXG4xMlxuMTNcbjE0XG4xNVxuMTYiXQ==)
Uses [Command Master's insight](https://codegolf.stackexchange.com/questions/263438/is-this-a-powerful-number#comment576718_263438) that these are numbers where the product of the distinct prime factors of the input is divisible by the input.
```
ǏΠ²Ḋ  # implicit input of integer
Ǐ     # distinct prime factors
 Π    # the product of this list
  ²   # squared
   Ḋ  # is divisible by the (implicit) input
```
[Answer]
# [Nekomata](https://github.com/AlephAlpha/Nekomata) + `-e`, 3 bytes
```
ƒ1>
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m70iLzU7PzexJHHBVktLS4WYosS89FRDhZi0zJyS1CKF6qWlJWm6FkuOTTK0W1KclFy8ACKwAEoDAA)
```
ƒ1>
ƒ       Factor
 1>     Check if all exponents are greater than 1
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 3 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
Ó1å
```
Outputs an inverted 05AB1E boolean: \$1\$ if it's NOT a powerful numbers; \$0\$ if it is a powerful number (only `1` is truthy in 05AB1E).
Port of [*@UnrelatedString*'s Jelly answer](https://codegolf.stackexchange.com/a/263440/52210), so make sure to upvote that answer as well!
[Try it online](https://tio.run/##yy9OTMpM/f//8GTDw0v//7c0NwIA) or [verify all test cases](https://tio.run/##ATQAy/9vc2FiaWX/4oKER04/IiDihpIgIj9O/8OTMcOl/0Q/acO1w6siIChwb3dlcmZ1bCkifSz/).
**Explanation:**
```
Ó    # Get a list of exponents of the (implicit) input's prime factorization
 1å  # Does this list contain a 1?
     # (after which the result is output implicitly)
```
[Answer]
# [Arturo](https://arturo-lang.io), ~~33~~  30 bytes
```
$=>[in? 1tally factors.prime&]
```
[Try it!](http://arturo-lang.io/playground?XIEcmv)
Port of Unrelated String's [Jelly answer](https://codegolf.stackexchange.com/a/263440/97916).
```
$=>[               ; a function where input is assigned to &
    in? 1          ; is 1 in
    tally          ; counts of
    factors.prime& ; input's prime factors
]                  ; end function
```
[Answer]
# [Racket](https://racket-lang.org/), 101 bytes
```
(define(f n)((λ(D ?)(=(count(λ(p)(and(? p n)(?(sqr p)n)))D)(length D)))(prime-divisors n)divides?))
```
[Try it online!](https://tio.run/##XVBLboMwEN1zihFRpZkFKmyRKjY5QNQuqy5cGBKrZkxsSJQNF@sdeiU6RmrU1rtnv6@DaT94WnfOyBHCBjIMfJ5tYEAv7lZYgcFMJ@jsxXYcGxiDHbhIMPoQiVbsuLfC2IMQ4tcn7qEhfMLWzzIlPBIa6VClidFgPAcYSYhoT@hYjmq/V4R/rZX8E7ql2Dg6c3MC2PugnSB/5ji7qYbFLA@5XoN2N506UZb94ucvuoilZfA9HPyVQz87kHl4Z03pgx@gKqqyLAGttG6O9sJU53T3yABwMVvuo7NxAnzVFkE/jaECVVb0ppx/Z1dfT5za6hC6P6fZa5J8Aw "Racket – Try It Online")
---
## Explanation
We create a function `f` that takes one input `n`. We find the list of prime divisors of `n` and call it `D`. We then iterate through the list and check whether `n` is divisable by each element and `n` is divisable by each element squared. If both conditions are satisfied, we increment a counter. After iterating through list, we retrieve the total count and test whether the count is the same as the length of the list of divisors. If it is, then the number is a Powerful Number.
The ungolfed version is simpler to understand:
```
(define (f n)
  (let ([D (prime-divisors n)])
    (= (count (lambda (p)
                (and (divides? p n)
                     (divides? (sqr p) n)))
              D)
       (length D))))
```
*Have a wonderful weekend ahead!*
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 7 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
```
k e@vX²
```
[Try it here](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=ayBlQHZYsg&input=OTcy)
[Answer]
# JavaScript, 32 bytes
A port of [xnor's solution](https://codegolf.stackexchange.com/a/263481) to JavaScript:
```
f=(n,c=1)=>c**n%n?f(n,c+1):n/c%c
```
[Answer]
# [Thunno 2](https://github.com/Thunno/Thunno2) `G`, 2 [bytes](https://github.com/Thunno/Thunno2/blob/main/docs/codepage.md)
```
ḟḅ
```
[Try it online!](https://Not-Thonnu.github.io/run#aGVhZGVyPSZjb2RlPSVFMSVCOCU5RiVFMSVCOCU4NSZmb290ZXI9JmlucHV0PTk3MiZmbGFncz1H)
or [verify the first few powerful numbers](https://Not-Thonnu.github.io/run#aGVhZGVyPSVDMyVBNiZjb2RlPSVFMSVCOCU5RiVFMSVCOCU4NSZmb290ZXI9R34maW5wdXQ9MTAwJmZsYWdzPU4=)
Port of Unrelated String's Jelly answer. Output with inverted booleans. Add the `!` flag to take the logical NOT.
#### Explanation
```
    # Implicit input
ḟ   # Get the list of prime factor exponents
 ḅ  # Check for each if it equals one
    # Take the maximum of this list
    # Implicit output
```
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 8 bytes
```
Ċ^₂ʰ^₃ᵗ×
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/r//0hX3KOmplMbgGTzw63TD0////@/pbkRAA "Brachylog – Try It Online")
Takes input as the Output variable. Outputs `true.` or `false.` as you would expect.
### Explanation
It’s just a description of the alternative definition.
```
Ċ          Take a couple of 2 variables
 ^₂ʰ       Square the first one
    ^₃ᵗ    Cube the last one
       ×   Multiply them: it must be equal to the given input
           Brachylog will implicitly check if such a couple of variables Ċ exists
```
[Answer]
# APL(NARS), 8 chars
```
1∊≢¨⊂⍨π⎕
```
It return `0` if the number is as question ask, `1` otherwise.
It is read in reverse `⎕π⍨⊂¨≢∊1`
`⎕`Call for input,`π` return the list of factors of input,
`⍨⊂` doing partition as input`⊂`input,`¨≢` for each element list, of partition
return the lenght,`∊1` see if in the last list there is 1
test:
```
      1∊≢¨⊂⍨π⎕
⎕:
      36
0
~
      a/⍨∼{1∊≢¨⊂⍨π⍵}¨a←⍳100
┌14─────────────────────────────────────┐
│ 1 4 8 9 16 25 27 32 36 49 64 72 81 100│
└~──────────────────────────────────────┘
```
[Answer]
# Mathematica, ~~40~~ ~~39~~ ~~38~~ ~~36~~ 27 bytes
```
FactorInteger@#1∨#==1&
```
The first `` is `\[VectorGreater]`, the second `∨` is `\[Or\]`. Assuming UTF-8 encoding, they both occupy 3 bytes.
[Try this online!](https://tio.run/##y00syUjNTSzJTE78n2b73y0xuSS/yDOvJDU9tShaOfb9hC2GjzpWKNvaGqr9DyjKzCuJDkrMS091MDQwMKgLTs1JTS6pS4v9DwA)
[Answer]
# Regex (ECMAScript or better), 50 bytes
```
^((?=(xx+?)\2+$)((?=\2+$)(?=(x+)(\4+$))\5){2,})*x$
```
[Try it online!](https://tio.run/##TY/NbsIwEIRfhUYIdgkJSQQ94BpOPXDh0B5LK1mwOG6NY9kGUn6ePU1UVeptZr6RRvMpTsJvnbIh8VbtyB0q80XfjeOGzr0Xks@1BbjwxWTUfAAsOdR1vMRNEfexs7@ii2OEzbQ1uJnhtRjfcVT3m9HkgmmoXoNTRgKmXqstweM4mSIyzzN2LpUmAM0diZ1WhgDxgZuj1niVXKfeahVgmAyRqT2A4TLVZGQocVHcbsqvxRoUt8J5WpkA8i17R/wD9B@YRb7M5x3GULrqHK3MSWi16zlhJM17UazZvnLA1BMnpuIY28GojlJHlkQAhelBhG0JDvHqBwPbXgrQvciZPQYfXFth93uTJ8Usy34A "JavaScript (SpiderMonkey) – Try It Online") - ECMAScript  
[Try it online!](https://tio.run/##RY7LasMwEEV/ZQgi1tQ2flBvIit2IN121V2diLTEIFASV3JBRai/7spOoJthzp3HvcNZq2q6/ADRDJy6fZ4UkIwF5PV@97bbeuhvmhLDc1ZvGTqQfSB0g5bXEVbddcU8tIqbQcmRRmmUmO8PM4YTkaRFUuD5a15q/tU86LghAtn8ywTHk25VXaJr1Xtx4KHmB/bwlQ8ksubLOHRxjE72QGlkI7AQlhCB/0JGdIaOmPV6CbdkC8ELds9KJPPeC/HyuhdiOlLacGpt3GBXxgRnvDezHCPtngNgV6ErE49PlkxTkZZVnv8B "Perl 5 – Try It Online") - Perl  
[Try it online!](https://tio.run/##bVJdb9swDHzvr@CMDpGSVE2C9WWqUWzDBgxot6F9TDJAseVErUx7kty4DfLbM8rxPgrULxTJ81F34r16VGf3@cPBlHXlAtxTLkwlhhL@rzTB2FdrTq91S52TullZk0FmlfdwowzCDvqaDypQeKxMDiV12F1wBteg3NrPlxzCxlVbD5/bTNfBVPTnCcAXYzUUKeptd2SJyKpcC@onXH5sikI7nd9qlWsHqw72ssj@/NmnBeeyn@vHQW43kZ8xn65Ig8qvDWrG@ZsUG2u5KZgX@lejrGfJ@XA4TDjfvYQeGRgLrxLsiCH8ZSCCc2JYEe5B@lE6WOAgxiD3x9r@hwpBOwSX9idSW9ZxgOeS3FhVldUK4TktiFFLuMsUIkk3WDcBUohq@xq7e/JBl8Igl9Dr7GBio/w33Qa6ZmcxQG@IpbsTxxGEhOgl9v35Eiy1I0r42prAkjN6BMIHwAl1vmKgNXCiVs5rSpidT5Z8DDh9tSmsxnXYXM7gCiIS3lOYLokx2yg3X7a9ni7D6VLCB@fUkxeFsZa140E76EwBKCoXtdE1UpxIwMsUpxRGIxJ4o0K2IYdKYnOiPGas21ykBf9E5MeNEVunataPyKr66Xtxq3CtadJkjJxHpQWwksZjTt7Ft33mvckVObZ1JmgWH5XL5zS4Jr7Pv3ZNHoaCJW99QpZwuY/fSdyqw0/GrlLWtqMrvpiNTnlMj4dYHnG2eEcJX1zw3Wy858P29BB36TA9m11MJr8B "Java (JDK) – Try It Online") - Java  
[Try it online!](https://tio.run/##NY5NasMwEIX3PsUgspiJZSO57caOyEFsF0KrNCqKbEYqdSg9u2sldPd@@B5vvqXLFJ5Wd50nThBvUbKVn3EKHbBhIcT6ing0uCzlkYam3FG2D5HjknB43gwNL/TTyF/aL7t1w3rdVnrswBlVnCcGDy7k@TqmdxfaArzxdZy9SygqQQW4M3gb0NOhacH3ejS@V2MBGQ4Z5lP4sOhCwlyQfCg9Uqlp28sDbOtoT/x2QZYgFrEP9yZXroWZM0L3wOju/830lepvdsliTIyBaNWVVkr9AQ "Python 3 – Try It Online") - Python  
[Try it online!](https://tio.run/##PY5RS8MwFIXf/RXXMliyriEp@rIaRnFFfJmw@dbOoCzrAiEracYion@9JpvuIZec755z77XHj8/BAoeVbKXviJEnWJSvJbHyfTu9wNns@Wn5sqoey3VVgOK0gNNeaQmat9L1NwBqB7rO2IbzpDFJERq6poRk@aYAabbBEQjpO60cGmdj/BchWprW7RF@yEOmDvkQu0Z2BwsGlIEIiTsIhRjFhETjVQbfeRZKfDIxGPgP2CICdRvv7I6uP8@Ld7OgrTIOzP@KWOMTolouhBjeEJpz5H06x02ejnCUl0/EKUbNXRC4ucdf@fQbT/xoGFjGKKW/ "Ruby – Try It Online") - Ruby  
[Try it online!](https://tio.run/##XVDBasMwDL33K4wxxGrcNgntRnFDL9tgMHbYdms6k2ZuE5Y6xnEhUPrtndzttIOFnqT3nixb2@tqbWtLmCM5oTNKpsQ6fVBO27asNI9m0/Faqbpsvaq6o21a7QpegCzeZn0kSIRvj0V10GHAeG18z5V6en55VAoESQElUViOGtOoXntObeX0dFdW395hUG1zbDwVhM6z5Xx5d58tFxTkaN85zpo8kazN96je8/ePh@dXkHAmzZ6zdtN712qDGUzSbZ7TwlDA4f60ww6WRSImKQS@HmzbfWlOJ1TguER@1Z2MD9xVhqQNCmBMtnJEyM3Z/GFmVvmtj1kcA1oTfrvQsfRVzZkTaBbOpUvPoyESzAAAOYcVG9BV3YW9JMGvpJIETJiRF7S5/DsrB3n95Hyd82GI11BkMYMAf5NQjoEXcwRQLOCciQuMB3a9ppNskSQ/ "PHP – Try It Online") - PCRE  
[Try it online!](https://tio.run/##RY/RioMwEEV/RWTATNMUle1LJbSwz/0CdUHcaQ1kE4kpSiXfbnXLsm9zDpfLnd6O5IaOtF7AydLRnab6dDI0skuyfDF2lmya@BmrnANu@D42zZFVHytgdcQ53wfcTbAkl338aX96pek7xgKeMi1u1lHTdgx0pEwEyvQPjzM0ErQYeq18LOJC3Rg0h9Y@jBfaR/kW4BKaMq3DWsDAyFIZX/@aAozQ9MfZxpzjvHW4w7XxbUcDS6ZkBwbf@onz6JQn0dnBh3VWVvxzJIxdX9bKUAQmhLBkIj@m6Qs "PowerShell – Try It Online") - .NET
I adapted this on 2018-12-26, as a slight modification to the regex that [matches numbers of the form \$n^k\$](https://codegolf.stackexchange.com/questions/19262/match-strings-whose-length-is-a-fourth-power/21951#21951), where \$k\$ is a constant. In its implementation, that regex actually matches numbers that are either \$0\$ or of the form \$n^k=\prod\_{i=0}^{q} p\_i^{k\_i}=p\_0^{k\_0}p\_1^{k\_1}p\_2^{k\_2}...p\_q^{k\_q}\$ where all \$p\_m\$ are distinct primes, all \$k\_m=k\$, and \$q\ge 0\$.
The only changes here, to match powerful numbers instead, are to make \$k\_m\ge 2\$ (which takes 1 extra byte), and not to match \$0\$ (which saves 1 byte).
In other words, this regex works by dividing away each prime factor, from smallest to largest, asserting along the way that each distinct prime is divided away at least twice, with an end result of \$1\$.
```
^                     # N = input number (initial value of tail)
(                     # Loop/iterate the following:
    (?=(xx+?)\2+$)        # \2 = smallest prime factor of tail
    (                     # Loop/iterate the following:
        (?=\2+$)              # Assert tail is still divisible by \2
        (?=(x+)(\4+$))        # \4 = largest proper divisor of tail
                                   = tail / \2 (implicitly);
                              # \5 = tail - \4 (a tool to make tail = \4)
        \5                    # tail -= \5, i.e. tail = \4
    ){2,}                 # Iterate the above at least 2 times
)*                    # Iterate the above any number of times, minimum 0
x$                    # Assert tail == 1
```
# [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), 56 bytes
```
.+
$*
^((?=(11+?)\2+$)((?=\2+$)(?=(1+)(\4+$))\5){2,})*1$
```
[Try it online!](https://tio.run/##JY09DsIwGEP3d44iJRShfD9pkwF15BIVgoGBhQGxIc4eUjHZfrLs1/39eN7aLpyv7Tgy7LmEsJyCyLjEVcchbvFvNjzGsHoPcc3xo4dv3MvQmuAUKjKhGZ0xxSa80pXMxIwkRBBFDHEkIx0WpJcSKqiihjraVwpasYQJZphjGeu7Bat4wvul4oY7nvF@NuPlBw "Retina 0.8.2 – Try It Online")
[Answer]
# [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), 64 bytes
```
.+
$*
^((.){2,})(?<!^\3+(..+))\1*$(?<!^\4*(?(2)$)(((?<-2>)\1)+))
```
[Try it online!](https://tio.run/##K0otycxL/K@q4Z7wX0@bS0WLK05DQ0@z2kinVlPD3kYxLsZYW0NPT1tTM8ZQSwUiYqKlYa9hpKmiqaEBFNA1sgPKaQJV/P9vyGXEZcxlwmXKZcZlzmXBZQkA "Retina 0.8.2 – Try It Online") Link includes test cases. Outputs `0` for a powerful number, `1` if not. Explanation:
```
.+
$*
```
Convert to unary.
```
^((.){2,})
```
Search for a nontrival integer...
```
(?<!^\3+(..+))
```
... that is not composite...
```
\1*$
```
... and is a factor of the input...
```
(?<!^\4*(?(2)$)(((?<-2>)\1)+))
```
... and whose square is not a factor of the input.
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 25 bytes
```
Ｎθ⊙…·²θ∧∧¬﹪θι﹪θ×ιι⬤…²ι﹪ιλ
```
[Try it online!](https://tio.run/##RUy9CsIwEN59iowXiEsXkU4dO1hEfIE0DXpwvZg0Kfj018bBfvAN36972@SCJZGePyUPZR59gqjb0z0hZ@j4Cz07Kguu/mH55aExKmqjOp6gcggZbmEqFCAahXqPDvnE2S@AP79uiOB/gkdzL5CuaEWul0bOK20 "Charcoal – Try It Online") Link is to verbose version of code. Outputs an inverted Charcoal boolean, i.e. `-` if the input is not a powerful number, nothing if it is. Explanation:
```
Ｎθ                          Input as an integer
   …·                       Inclusive range from
     ²                      Literal integer `2` to
      θ                     Input integer
  ⊙                         Any value satisfies
           θ                Input integer
         ¬﹪                 Is divisible by
            ι               Current value
        ∧                   Logical And
              θ             Input integer
             ﹪              Is not divisible by
               ×ιι          Current value squared
       ∧                    Logical And
                   …        Range from
                    ²       Literal integer `2` to
                     ι      Current value
                  ⬤         All satisfy
                       ι    Outer value
                      ﹪     Is not divisible by
                        λ   Inner value
                            Implicitly print
```
[Answer]
# [Ruby](https://www.ruby-lang.org/) `-rprime`, 32 bytes
`Prime.prime_division` returns a number's prime factors \$\prod\_{k=1}^\infty {p\_k}^{e\_k}\$ in the form `[ [p1, e1], [p2, e2], ... ]` so this function checks whether every exponent is 2 or more.
```
->n{n.prime_division.all?{_2>1}}
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m72kqDSpcnW0km5RQVFmbqpS7OI025ilpSVpuhY3FXTt8qrz9MAS8SmZZZnFmfl5eok5OfbV8UZ2hrW1EHVbChQ0DPX0LC0tNfWKU3NSk0sU1NIgUgsWQGgA)
[Answer]
# [Desmos](https://desmos.com/calculator), 47 bytes
```
f(k)=0^{∏_{n=1}^{k^{.5}}mod((k/n^2)^{1/3},1)}
```
In case it bothers anyone, `k/n^2` can't be shortened to `k/nn` because `k/nn` is parsed as `k/n * n` when we actually want `k/(n*n)`.
[Try It On Desmos!](https://www.desmos.com/calculator/mnbfsa7ujf)
[Try It On Desmos! - Prettified](https://www.desmos.com/calculator/4wfmwybazs)
[Answer]
# [Perl 5](https://www.perl.org/) `-ap`, 43 bytes
```
//&map$\+=$_**2*$'**3=="@F",@;for@;=1..$_}{
```
[Try it online!](https://tio.run/##K0gtyjH9/19fXy03sUAlRttWJV5Ly0hLRV1Ly9jWVsnBTUnHwTotv8jB2tZQT08lvrb6/38jU8t/@QUlmfl5xf91fU31DAwN/usWJAIA "Perl 5 – Try It Online")
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal/tree/version-2) `g`, 23 [bitsv2](https://github.com/Vyxal/Vyncode/blob/main/README.md), 2.875 bytes
```
∆Ǐċ
```
[Try it Online!](https://vyxal.pythonanywhere.com/?v=2#WyJBZz0iLCIiLCLiiIbHj8SLIiwiIiwiMVxuMlxuM1xuNFxuNVxuNlxuN1xuOFxuOVxuMTBcbjExXG4xMlxuMTNcbjE0XG4xNVxuMTYiXQ==)
Bitstring:
```
00010101110001100111100
```
Prime exponents, check if not equal to one, minimum of that list (will always be greater than one for a powerful number)
]