Works only for even numbers
Segmentation fault