We use the function next several times:
Prelude> next 6
3
Prelude> next 3
10
Prelude> next 10
5
Prelude> next 5
16
Prelude> next 16
8
Prelude> next 8
4
Prelude> next 4
2
Prelude> next 2
1
The answer is 9 numbers.