Syracuse Sequence

Consider the Syracuse Sequence which we encountered in Python class. This time we want you to implement that with JavaScript.
  1. Design an HTML form to allow users to input a positive integer N.
  2. Generate the Syracuse Sequence of N.
  3. If N is not a positive integer, erase the result.

n
3n+1 3 10 5 16 8 4 2 1
n
3n+1