Fixpoint div2 (n:nat) : nat := match n with | 0 => 0 | 1 => 0 | S (S p) => S (div2 p) end.
n = 2 * (div2 n) + mod2 n