chef jumping,it is showing wrong answer,can someone help

my logic is I found the nth term in sequence (like 1,3,6,7,9,12 in this sequence 1,7,13…belong to one series similarly two more series exits)finding its nth place and substituting in the series should give the same value

solution link

Your code gives no as output for input = 9 the correct answer would be yes.