October 2017 Fiendish Function

The Fiendish Function posed during October 2017 had the following sample guesses and replies:

  • GUESS
  • REPLY
  • 1
  • 0
  • 2
  • 5
  • 3
  • 21
  • 4
  • 45
  • 5
  • 117
  • 10
  • 837

The rule was: "The nth prime, square it, then subtract four".

Suppose the guess was 12:

  • Find the twelfth prime, giving 37.
  • Multiply the number by itself, giving 1369.
  • Subtract four, giving 1365.

So the result is 1365.