Ad
  • Default User Avatar

    It's fine. Just write some goddamn comments.

  • Default User Avatar

    It depends on what your goals are. This is a constant time solution, so it doesn't take longer to run as the number gets large. Efficient algorithms are the goal of the Project Euler site from which this problem was taken. Also, I'd rather the coder that comes after me have to figure something out than write code in such a way that neither of us learns anything. :) I would certainly be disappointed to learn the coder in front of me chose a less appropriate algorithm out of fear it would be too hard for me.