You need to use "format_number":
Code:
program: format_number(divide(booksize(),add(raw_field("#pages"),1)),"{0:,.0f}")
The template editor has some details about the format string.
And using "raw_field" is a bit safer. I had an error on books with more than 1000 pages as my pages columns is formatted with commas.