This problem is part of a larger proof I've been working on. Long story short, I'm trying to prove a particular explicit formula for the recursive function
$$ t(p, 0) = 0 \\ t(p, k+1) = \left\lfloor \dfrac{t(p, k)}{3} \right\rfloor + p $$
where $p=2n+1, n \in \mathbb{N}$. The inductive step of proving my particular explicit formula includes the following question:
Can we show algebraically that
$$ \left\lfloor \dfrac{1}{3} - \dfrac{1}{3} \left\lfloor \dfrac{2n-1}{2(3^{k-1})} + \dfrac{1}{2} \right\rfloor \right\rfloor \ \ = \ \ (-1) \left\lfloor \dfrac{2n-1}{2(3^k)} + \dfrac{1}{2} \right\rfloor$$
is true for all $k,n = 1, 2, 3, ...$ ? I used Python to test it and it seems to be true, at least for all $k≤1000, \ n≤1000$. Can anyone prove this rigorously? I tried using induction on $k$ but was not successful. I did not try induction on $n$.
Any help is appreciated.
Proof. We have \begin{align} \Bigl\lfloor \frac{-\lfloor x \rfloor+m}{n} \Bigr\rfloor &=\Bigl\lceil \frac{-\lfloor x \rfloor+m-n+1}{n} \Bigr\rceil\tag{1}\\ &=-\Bigl\lfloor \frac{\lfloor x \rfloor-m+n-1}{n} \Bigr\rfloor\tag{2}\\ &=-\Bigl\lfloor \frac{\lfloor x-m+n-1 \rfloor}{n} \Bigr\rfloor\tag{3}\\ &=-\Bigl\lfloor \frac{ x-m+n-1 }{n} \Bigr\rfloor\tag{4} \end{align} where we used well-known identities:
$\square$
Set $m=1,n=3,x=\dfrac{2n-1}{2(3^{k-1})} + \dfrac{1}{2}$ to get your result.
Note. Adding the ceiling version of the claim as an exercise and to make search engines happy (same $m,n,x$ restrictions): $$ \Bigl\lceil \frac{-\lceil x \rceil+m}{n} \Bigr\rceil = -\Bigl\lceil \frac{x-m-n+1}{n} \Bigr\rceil. $$