Skip to main content
2 of 2
added 559 characters in body
loopy walt
  • 16.8k
  • 2
  • 11
  • 69

Python 2, 37 bytes (-1 @Steffan, -2 @dingledooper)

f=lambda x,n:[1][n:]or[x**n]+f(x,n/2)

Attempt This Online!

Old Python, 40 bytes

f=lambda x,n:[x**n]+(n*[n]and f(x,n//2))

Attempt This Online!

Doesn't actually implement the algorithm. But produces correct output.

loopy walt
  • 16.8k
  • 2
  • 11
  • 69