Kaj Sotala said:
[I]f you punish yourself for trying and failing, you stop wanting to try in the first place, as it becomes associated with the negative emotions. Also, accepting and being okay with the occasional failure makes you treat it as a genuine choice where you have agency, not something that you're forced to do against your will.
So maybe we should celebrate failed attempts more often ... I for one can't think of anything I've failed at recently, which is probably a sign that I'm not trying enough new things.
So, what specific things have you failed at recently?
Project Euler problem 384. I thought I'd be able to crack it in an afternoon, but a couple week's later I'm still stumped. I finally moved to another problem in the hopes of being able to return to 384 with fresh eyes, but no joy just yet.
I'm not sure if there's a lesson to learn from the failure, except that to do a good estimate about how much work something will take often itself requires a bit of work.
At first glance I see a few sub-problems that don't look hard, but the list s(n) will get huge but have a ton of repetition so you could just make a list of occurrences of each number instead of just the list of s(n), and this would make finding the nth occurrence trivial. You wouldn't need to keep much of the list, only the fibonacci numbers.