Re-arranging Equation with Integer Division I have an equation that uses integer division (for calculating days in a number of months):
$x=30m
+\left\lfloor \frac{m+10}{11} \right\rfloor
+\left\lfloor \frac{m+8}{11} \right\rfloor
+\left\lfloor \frac{m+6}{11} \right\rfloor
+\left\lfloor \frac{m+5}{11} \right\rfloor
+\left\lfloor \frac{m+3}{11} \right\rfloor
+\left\lfloor \frac{m+1}{11} \right\rfloor
$
where $m$ is an integer in the range $0 \leq m \leq 11$. The year is taken to start at March 1st. So m=1 results in x=31 (Days in march), m=2 results in x=61 (days in March+April) and so on up to m=11 resulting in x=337 (Days in March through Dec plus Jan).
I was wondering how do you re-arrange the equation to solve for $m$? Re-arranging the equation normally does not work because it will end up containing $\frac{10+8+6+5+3+1}{11} = 3$, where as the integer division can make the fractional parts sum to as low as zero.

A suitable reverse function to return which month $m$ a particular given day $d$ is in, returning $m=1$ for March etc. can take advantage of the regular near-alternation of the longer and shorter months:
$$m=\left \lfloor \frac{d-0.5}{30.6}+1 \right\rfloor$$
where $\lfloor\cdot\rfloor$ rounds down to the nearest integer.
