Can a signed arithmetic progression reach all integers?

28 Views Asked by At

$F:=\big\{f\,\big|\,\text{function }f: \mathbf N\rightarrow \{1,2\}\big\}$. $S:=\big\{\sum_{i=1}^k (-1)^{f(i)}i\,\big|k\in\mathbf N, f\in F\big\}$. Is $S=\mathbf Z$?

I had thought of using dynamic programming to solve this problem. However, the fact that the number of summands $k$ is unbounded seems to make this unfeasible.

1

There are 1 best solutions below

0
On BEST ANSWER

By induction, $S_k = \{\sum_{i=1}^k (-1)^{f(i)} i \mid f \in F\}$ consists of all integers $x$ with $|x| \le k(k+1)/2$ and $x \equiv k(k+1)/2 \mod 2$.