Then it has infinite complexity.

If you suspect that it is intended to finish eventually then post the code you are using. And describe the program's behaviour: especially the output suggested by...