It's not central to the topic, but there's this subtopic running through this thread I want to comment on. It's the notion that all you have to do to solve problems like this is 'follow the math' and the like. There are problems with this approach to physics derivations. First, the symbols used are not abstract entities that can be pushed about they way they would in abstract algebra derivations, for instance. I believe this subconscious equivalence can lead one to use a symbol, say ' V ', to represent more than one physical entity. In reading the posts above, I see that this error has been made more than once. For instance, in one derivation V was used to stand for the voltage of the battery (or other power sources), which is assumed to be constant over time. Then it was used as the voltage over the capacitor, which increases as the cap is charged, or the voltage drop in the resistor, which decreases over the charging time, since the current is decreasing then. The math that followed lead to confusing and in some cases downright incorrect, results; because the capacitor voltage or resistor voltage cannot factored out of a time integral the way the battery voltage can. If the physical situation, in which battery voltage, resistive voltage drop and capacitor voltage are all different, is clear in one's head, such mistakes can be avoided. Furthermore, if all three voltages (designated by distinct symbols) are included in the integration in their proper places, the expressions for the energy lost to dissipation and the energy stored in the cap will both reveal themselves. In that case, the math will show how the 2 energies are equal, their sum equal to the energy delivered to the system by the battery.
Another mathematical assumption used in this problem, that the current around the circuit is equal everywhere, is very convenient. You can write expressions for the current through the resistor or into the capacitor and use the result anywhere. This is correct, but why? Again, picturing the physical set up shows you that this must be so. Pushing symbols around won't do this for you. You must bear in mind that all 3 elements in the circuit are in series. Then you can apply a physical law, which in itself is derived from the physical concept that charge is conserved throughout the circuit. That law is known as Kirchoff's Current Law. It states that the sum of the currents flowing into (positive sign) and out of (- sign) any circuit node must be zero. In a series circuit like this one, the junctions between the components have exactly one input and one output. There are no points where the current branches in more than one direction. Therefore, the currents flowing into and out of every component are the same. If you are not aware of this and you are presented with system with branching nodes, you may not realize that you need to compute the currents in the different branches according to the elements in them.
Of course I realize most of you already know the principles used in this problem. Rather, my point is that to do physics, you need to know physics, and physics cannot be reduced to mathematics alone. Otherwise, who needs experiments? Maybe you know that as well. If you do, then please stop saying it isn't so.