A354153 a(n) is the smallest value of a+b+c for nonnegative integers such that a^b + c = n.
0, 1, 2, 3, 4, 5, 6, 5, 5, 6, 7, 8, 9, 10, 11, 6, 7, 8, 9, 10, 11, 12, 13, 14, 7, 8, 6, 7, 8, 9, 10, 7, 8, 9, 10, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23
Offset: 1
Keywords
Examples
a(1) = 0 because 0^0 + 0 = 1 and 0 + 0 + 0 = 0. a(9) = 5 because 3^2 + 0 = 9 and 3 + 2 + 0 = 5 and there is no ordered triple (a,b,c) such that a^b + c = 9 with a+b+c < 5.
Programs
-
Python
def a(n): minSum = n-1 for a in range(n-1): for b in range(n-a-1): if a**b>n: break c = n-a**b if a+b+c
Comments