Let $x$ be an arbitrary state composed of $N$ qubits and $k$ be an integer such that $0\leq k \leq N.$
The task is to ignore the $k$-th bit and to flip the sign of $x$ if any of the remaining bits are equal to 1. In other words, flipping the sign of $x$ is independent of the $k$-th bit, but it is dependent on the existence of 1's lurking in $x$.
The solution I came up with is the following, which, unfortunately, I cannot implement.
Regardless of what $x$ is we flip its sign. There are two cases we should correct for, namely, the binary representations of 0 and $2^k$. Could not we take care of these two scenarios by using the ControlledOnInt function by setting $\textit{numberstate}$ to 0 (first we have the $X$ gate act on $x[k]$, so that $Z$ flips $x$) and $2^k$, the $\textit{oracle}$ to $Z$, the $\textit{control register}$ to $[x]$ and the $\textit{target register}$ to $x[k]$? Also, why can't the control and target registers be the same?
How could we implement the above with an auxiliary qubit?
In the second case where $x$ is the binary representation of $2^k$, we could use the task 3.2 from the same tutorial (flips the sign of $x$ if the $k$-th qubit is 1), but I am also having trouble with that task. I have been able to implement the OR oracle (task 3.1 of the same tutorial), but it was done with a marking oracle, not a phase oracle.