all tests passed, now works for all numbers