At time of writing, my reputation is \$16,256\$. As I noted in chat,
Oh cool my rep is the concatenation of two powers of 2: 16,256
Or even the concatenation of a power of 2 and its square, which is much more interesting
which then spawned a CMC about checking if a number has this property.
Given an integer \$n > 0\$, considered a decimal integer, and a power \$r > 1\$, return two distinct values which determine whether \$n\$ can be expressed as the concatenation of a power of \$r\$ and its square or not. For example, \$n = 16256\$ and \$r = 2\$ returns true (the concatenation of \$2^4\$ and \$(2^4)^2\$), while \$n = 39\$ and \$r = 2\$ does not. Note however that \$n = 39\$, \$r = 3\$ is true. The power of \$r\$ may be \$0\$, meaning that \$n = 11\$ is true for all \$r\$
The power of \$r\$ will always come "before" its square, so \$n = 62525, r = 5\$ is false.
You will never get an input \$n\$ where its validity depends on ignoring leading \$0\$s or not (for example \$101\$ is true for all \$r\$ if ignoring leading \$0\$s and false otherwise). However, you may still get inputs with the digit \$0\$ in (e.g. \$n = 1024, r = 2\$) where leading \$0\$s have no bearing on the validity of \$n\$ being such a concatenation.
Input and output may be in any accepted method and this is code-golf so the shortest code in bytes wins.
Test cases
n r 1
39 3 1
525 5 1
864 8 1
16256 2 1
11 r 1
416 7 0
39 2 0
15 5 0
1024 4 0
62525 5 0
Feel free to suggest more test cases.
r
value in11 r 1
? I guess it should be1
. \$\endgroup\$1
for allr
\$\endgroup\$