写一个程序来解决这个问题:你被要求找到雷卡曼序列的第一个n个项 (包括项0.雷卡曼序列使用以下规则: - 项0是零. - 为了找到序列中的一个项,从前一个项中减去项数. - 如果这个数是负数或已经出现在序列中的一个数,你将需要将项数添加到前一个项中.
Here's a Python code to find the first n terms of Recaman's sequence:

```
def recaman_sequence(n):
    sequence = [0]
    for i in range(1, n):
        current = sequence[i-1] - i
        if current < 0 or current in sequence:
            current = sequence[i-1] + i
        sequence.append(current)
    return sequence
```

To use the function, simply call `recaman_sequence(n)` where `n` is the number of terms you want to find. For example, `recaman_sequence(10)` will return `[0, 1, -1, 4, -2, 5, -3, 6, -4, 7]`.