RESN05 Codechef Campus ReSnackdown

in the abv problem i have found the following recurrence:

S(n)= number of terms in n = 2*S(n-1)+1

example: S(3)=7 as (1)+(2)+(3)+(1+2)+(2+3)+(3+4)+(1+2+3)

F(n)=as defined in problem statement = 2*F(n-1) + (S(n-1)+1)*n)

i believe my recurrence is correct, i want to know:
how does the solution begin to repeat after n=22

is there some algorithm from which we can make out that solution repeats after 22?