Skip to main content
4 of 4
Commonmark migration

R, 34 60 64 bytes

f=pryr::f;g=f(as.numeric(paste(x,collapse='')));f(g(1:n)+g(n:1))

Assumes pryr package is installed. this gives f as a shorthand for creating functions.

Edit added 26 bytes but returns a function that works, not something entirely wrong.

Edit added another 4 bytes to handle cases above n=10 where strtoi (previously used) was returning NA

mnel
  • 954
  • 7
  • 10