Suppose that you add all of the page numbers in a book. If the total is 21, the book could only have 6 pages because 1 + 2 + 3 + 4 + 5 + 6 = 21. If the total were 25, that would be impossible because the next number in the series is 28 (21 + 7).
Create a function that, given the total number of pages as an argument, returns True if it is a valid total and False if it is not.
Can you devise a solution that is more efficient than simply adding consecutive integers as I did above?
pages_in_book(5) β False
pages_in_book(4005) β True
pages_in_book(9453) β True
N/A