It seems from your code that you're trying find the longest sequence of steps for a

Collatz conjecture[

^] between 2 initial numbers.

In the function 'NumOfSquence' you should start from num = 0 instead of num = 1 to count the number of steps instead of the number values.

I hope this helps.