I'm back... math + bsearch