Suppose there are n lockers that're all initially closed. For which positive integers $k\leq 10$ can one find a sequence of operations $T_{i_1},\cdots, T_{i_j}$, where each operation $T_i$ changes some lockers by toggling all multiples of $i$, so that at the end of the operations, all lockers that remain open are precisely those that are $k$th powers (and at most n)?
Clarification: the original question was trivial, asking if one could pick which lockers were toggled. The idea was to generalize the result for the perfect square case.
Obviously $k=1,2$ work. But I'm not sure about $k=3$. I know that each prime factor of a perfect cube has an exponent that's a multiple of 3. I also know some variants of this problem (e.g. to generate perfect squares, have $T_k$ toggle all lockers that're multiples of $k$, to generate all numbers that are twice a perfect square, have $T_k$ toggle all lockers that're multiples of $2k$, and to generate all numbers that are of the form $an^2$ for any integer a, just let $T_k$ toggle all multiples of $ak$). So as a specific example, if $n=9,$ I'd only want to keep lockers $1,8$ open, meaning that they're toggled an odd number of times.
This is always possible for any set of numbers. I’m assuming that $T_k$ flips multiples of $k$ and we can choose some subset of all such operations to actually run.
Let’s do induction - it’s trivial to correctly satisfy everything in the empty set ($n=0$). Let’s say we’ve toggled some subset of $T_1,…,T_{n-1}$ to correctly set everything less than $n$. This will leave the $n$th locker in some state. Note that $T_n$ toggles $n$ and nothing less than $n$, so we can use it (or not) to correctly set the $n$th locker without touching anything lower. This gives us the desired solution for setting the first $n$ lockers.
Let's derive the exact relationship between the set of open lockers (call it $S$) and the set of toggled operations (call it $R$).
We know that $s\in S$ iff the number of divisors of $s$ which get all there multiples toggled is odd. In mathematical language using indicator functions: $1_S(s) \equiv \sum_{m|s} 1_R(M) \mod 2$
The Mobius Inversion formula (https://en.wikipedia.org/wiki/M%C3%B6bius_inversion_formula) gives the inverse of the above formula when $S$ is a multiplicative set (meaning that if $a,b\in S$ then $ab\in S$). Simplifying it (the original formula uses the Mobius function which is -1,0, or 1, but can be simplified mod 2) gives that $T_m$ is used iff $\sum_{a| m, a\text{ squarefree}}1_S(m/a)$ is even.
For powers of order $k$, this simplifies to the following: for $n=\prod p_i^{e_i}$, $T_n$ is used iff for all $i$, $e_i\mod k$ is 0 or 1.