A student returned 4 overdue books to the library. The fine for each overdue book is $0.35 for the first day, $0.40 for each of the next 3 days, and $0.45 for each day after that. The total fine was $13.40. How many days overdue were the books?

Let x be the number of days the books were overdue.

For the first day, the fine is 0.35 * 1 = $<<0.35*1=0.35>>0.35.
For the next 3 days, the fine is 0.40 * 3 = $<<0.40*3=1.20>>1.20.
That leaves 13.4 - 0.35 - 1.20 = $<<13.4-0.35-1.2=11.85>>11.85 for the rest of the days.
So the books were overdue for (11.85 / 0.45) + 4 = <<11.85/0.45+4=31>>31 days. Answer: \boxed{31}.