List<int> hailstone(int n) {
  if(n<=0) {
    throw new IllegalArgumentException("start value must be >=1)");
  }
  Queue<int> seq=new Queue<int>();
  seq.add(n);
  while(n!=1) {
    n=n%2==0?(n/2).toInt():3*n+1;
    seq.add(n);
  }
  return new List<int>.from(seq);
}