‘b@
Try it online!
Returns the polynomial as a list of coefficients.
Since we know the polynomial has non-negative integer coefficients, f(b) can be interpreted as "the coefficients of the polynomial, taken as base b digits," by the definition of a base. This is subject to the condition that none of the coefficients exceeds or is equal to b, but we know that, because b is one greater than the sum of the coefficients (which is f(1)).
The program simply increments the first argument (‘
) to get 1+f(1), then calls the base convertion atom (b
) with the first argument as the base and the second argument as the number (using @
to swap the order of the arguments, since b
usually takes the number first and base second).
This was quite the clever challenge; thanks orlp!
f(1)
andf(1+f(1))
? \$\endgroup\$