Let \$A\$ be a positive integer consisting of \$n\$ decimal digits \$d_1,d_2,...,d_n\$. Let \$B\$ be another positive integer.
For the purpose of this challenge, we call \$A\$ a copycat of \$B\$ if there exists at least one list of positive integers \$p_1,p_2,...,p_n\$ such that:
$$\sum_{i=1}^{n}{{d_i}^{p_i}}=B$$
\$A\$ and \$B\$ are called reciprocal copycats if \$A\$ is a copycat of \$B\$ and \$B\$ is a copycat of \$A\$.
Example
\$526\$ and \$853\$ are reciprocal copycats because:
$$5^3 + 2^9 + 6^3 = 853$$
and:
$$8^3 + 5^1 + 3^2 = 526$$
The challenge
Given two positive integers \$A\$ and \$B\$, your task is to print or return a truthy value if \$A\$ and \$B\$ are reciprocal copycats or a falsy value otherwise.
Clarifications and rules
- You may take \$A\$ and \$B\$ in any reasonable, unambiguous format (e.g. integers, strings, lists of digits, ...)
- \$A\$ and \$B\$ may be equal. If a number is a reciprocal copycat of itself, it belongs to A007532.
- Instead of truthy/falsy values, you may return two distinct consistent values.
- For \$1\le A<1000\$ and \$1\le B<1000\$, your code must complete in less than one minute. If it's taking too much time for higher values, it must however be able to solve them in theory.
- This is code-golf.
Test cases
Truthy:
1 1
12 33
22 64
8 512
23 737
89 89
222 592
526 853
946 961
7 2401
24 4224
3263 9734
86 79424
68995 59227
32028 695345
Falsy:
1 2
3 27
9 24
24 42
33 715
33 732
222 542
935 994
17 2401
8245 4153
17 2401 -> false
. I'm almost tripped on this. \$\endgroup\$