Fixed fast partition function