Came up with the idea for this one while I was scratching my head over another "what comes next" puzzle here on Puzzling.SE

I wrote a small application which takes an integer and returns another integer.

Sometimes the application finds multiple integers to return, so it always returns the smallest one it finds.

Starting with '3' (seemed like a good number to start with), I used each integer that was returned as the next input, until I found the perfect place to stop!

3, 9, 5, 4, 2, 6, 7, 13, 110, 174, 155, ?

What was the number I stopped on and why is it the perfect place to stop?


1 Answer 1



The program finds what position the input string is in pi. You started on 3 because it is the first digit in pi. 3 is in the 9th position (excluding the first one), 9 is in the 5th position, 5 is in the 4th position, etc.

314 is the perfect place to stop because it is visually similar to a very common approximation of pi, 3.14.

As a side note, I'm embarrassed to admit that I found the sequence on the Online Encyclopaedia of Integer Sequences; you might want to check that in the future ;)

  • $\begingroup$ Heck! I wouldn't have imagined it would've appeared there, good find all the same! $\endgroup$
    – Dmihawk
    Dec 28, 2018 at 21:30
  • 1
    $\begingroup$ @Rolodophone Further evidence: "Producing Integers" is abbreviated P.I. $\endgroup$ Dec 29, 2018 at 20:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.