For a long time I was getting the error that it took too long to validate. I am no longer getting that error. Now it just says it's not giving the correct output. The program completes for N=1000000 in "0" seconds. Result for N= 1000000: [1, 2, 3, 4, 5, 6, 7, 8, 9, 153, 370, 371, 407, 1634, 8208, 9474, 54748, 92727, 93084, 548834] Checking online, this appears to be the correct sequence (except for 0, which is listed online but the conditions specify only to search "natural numbers" which are integers greater than 0). I do have it set to handle N < 1, returning new long[0].