Skip to main content
2 of 3
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/

#Groovy, 26 bytes

This answer was basically stolen from @Geobits.

a={n->n--?a(n)*~-a(n)+1:2} 

Took that answer and, using groovy shortcuts, optimized it further.

Magic Octopus Urn
  • 20.9k
  • 6
  • 66
  • 140