Start with $x_0$ units of flour, where one unit is required for each idol. After washing if you have $2x_0$ units. You use $1$ unit in the first temple, so you have $x_1=2x_0-1=2(x_0-1)+1$ units when you go to the second temple. After washing this you have $2x_1=2^2(x_0-1)+2$ units; you use $1$ unit in the second temple and take $x_2=2x_1-1=2^2(x_0-1)+1$ units to the third temple. Wash it to get $2^3(x_0-1)+2$ units, leave $1$ unit in the third temple, and take $x_3=2x_2-1=2^3(x_0-1)+1$ units to the fourth temple.
It’s not hard to see (and to prove by induction on $k$, if you wish) that $x_k=2^k(x_0-1)+1$ for each $k\ge 0$, where $x_k$ is the amount of flour left after the $k$-th temple. We want to choose $x_0$ so that no flour is left after the seventh temple has been visited. This means choosing $x_0$ so that $x_7=0$, i.e., so that $2^7(x_0-1)+1=0$; this is an easy equation to solve.