Revision 5102aa4b-e02d-4c04-94e2-b3a89fa19aab - Code Golf Stack Exchange
#[05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 26 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
Z©bgL®gãUεVXεYSym}OsN>èå}P
Takes the input as a list (i.e. `[526,853]`).
Can definitely be golfed. I traded in some bytes to make the performance a lot better so it can run `[1,1000]` with ease. Test cases containing numbers in the range `[1,9999]` are done in about a second on TIO. Test cases in the range `[10000,99999]` in about 10-15 seconds on TIO. Above that it will timeout.
[Try it online](https://tio.run/##ATQAy/9vc2FiaWX//1rCqWJnTMKuZ8OjVc61VljOtVlTeW19T3NOPsOow6V9UP//WzUyNiw4NTNd) or [verify all test cases with numbers in the range `[1,9999]`](https://tio.run/##NU69agJhEHyVw3qKfLvfz22jjWVIAiFBc1zhgRwWkkIQrrD1AfIKIaBNUgnWd6VwD5EXOb/90GpnZ2Zn9nOzqFbLYdtMRtn//isbTZrpZT98tMeqfmx/6@77rT@9z/rT/LVZ757bv/78NO4O3c/uZcBQFAamRGEIzHESwds4czhDujMCByUEuSQDwYlKjjxyp0diPcRrTADZBwVkYYk0ickzJHDEWSzTSwZppCAZklXZWGXcDTDdu5Im7CCSHiPrYE3sLa8).
**Explanation:**
<!-- language-all: lang-python -->
Z # Push the max of the (implicit) input-list (without popping)
# i.e. [526,853] → 853
© # Store it in the register (without popping)
b # Convert to binary
# i.e. 853 → 1101010101
g # Take its length
# i.e. 1101010101 → 10
L # Pop and push a list [1, n]
# i.e. 10 → [1,2,3,4,5,6,7,8,9,10]
® # Push the max from the register
g # Take its length
# i.e. 853 → 3
ã # Cartesian product the list that many times
# i.e. [1,2,3,4,5,6,7,8,9,10] and 3
# → [[1,1,1],[1,1,2],[1,1,3],...,[10,10,8],[10,10,9],[10,10,10]]
U # Pop and store it in variable `X`
ε } # Map both values of the input list:
V # Store the current value in variable `Y`
Xε } # Map `y` over the numbers of variable `X`
Y # Push variable `Y`
S # Convert it to a list of digits
# i.e. 526 → [5,2,6]
ym # Take each digit to the power of the current cartesian product sublist
# i.e. [5,2,6] and [3,9,3] → [125,512,216]
O # Take the of each inner list
# i.e. [[5,2,6],[5,2,36],[5,2,216],...,[125,512,216],...]
# → [13,43,223,...,853,...]
s # Swap so to take the (implicit) input
N> # Push the index + 1
# i.e. 0 → 1
è # Index into the input-list (with automatic wraparound)
# i.e. [526,853] and 1 → 853
å # Check if it's in the list of sums
# i.e. [13,43,223,...,853,...] and 853 → 1
P # Check if it's truthy for both both (and output implicitly)
# i.e. [1,1] → 1