login
A034704
Largest number that can be made using only the digits of n, exponentiation and concatenation.
1
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 21, 31, 41, 51, 61, 71, 81, 91, 20, 21, 22, 32, 42, 52, 64, 128, 256, 512, 30, 31, 32, 33, 81, 243, 729, 2187, 6561, 19683, 40, 41, 42, 81, 256, 1024, 4096, 16384, 65536, 262144, 50, 51, 52, 243, 1024, 3125, 15625, 78125
OFFSET
1,2
EXAMPLE
Using exponentiation and concatenation, the digits of 25 can be arranged to yield: 25, 52, 2^5, 5^2. The largest of these is 52, so a(25) = 52.
Using exponentiation and concatenation, the digits of 26 can be arranged to yield: 26, 62, 2^6, 6^2. The largest of these is 2^6, so a(26) = 2^6 = 64.
PROG
(Python)
def a(n):
if n < 10: return n
d = sorted(map(int, list(str(n))))
for q in [1, 0]:
while q in d and (i := d.index(q)) != len(d)-1:
d.pop(i)
d[-1] = (d[-1]*10)+q
for q, r in [(2, 5), (3, 3)]:
if (len(d)) == 1: return d[0]
if d[-2] == q and d[-1] <= r:
d.pop(-2)
d[-1] = (d[-1]*10)+q
for i in range(len(d)-2, -1, -1): d[i] = d[i] ** d[i+1]
return d[0] # Dominic McCarty, Mar 15 2025
CROSSREFS
Sequence in context: A225805 A068637 A004186 * A362076 A276512 A023792
KEYWORD
nonn,base,nice
STATUS
approved