optimize mandel number calculation
refactor