I would like to be able to obtain a (non-convergent) sequence of numbers by a simple calculation that would look like this: `0, 1, -1, 2, -2, 3, -3, 4, -4 ...`

By simple calculation I mean being able to do it with a single variable that would start from 1 (or 0) without having to rearrange this sequence.

I made several (unsuccessful) attempts in Lua, here is what it should look like in principle (this example only alternates 0s and 1s):

```
do
    local n = 0
    for i = 1, 10 do print(n)
        n = n==0 and 1 or -n + (n/n)
    end
end

```

Is this possible and how?

**Update:**

I just succeeded like this:

```
local n, j = 0, 2
for i = 1, 10 do print(n)
    n = n==0 and 1 or j%2==0 and -(n+(n/math.abs(n))) or -n
    j = j + 1
end

```

But I have to help myself with a second variable, I would have liked to know if with only `n` it would be possible to do it?