Click the flag and run the code. The largest variable value is the nth term. The program stops at n=1000. This program answers Round 2 Question 4 of the “Trollgonometry” Relay math contest. (Don’t go searching for this contest because this contest is not an actual official contest.
The sequence has the first three terms 1, 5, and 19. Every term after that is the sum of the previous three. So, the next two terms would be 25 and 49. The 1000th term has 266 digits! (according to this program. If there are errors in the code, then notify me in the comments and make a corrected remix.)