target/2 - 1
if target
is even, or target/2
if target
is odd.n
natural numbers using the formula n * (n + 1) / 2
.excluded
natural numbers using the same formula.excluded
numbers at the end of the sequence starting from target
.n
natural numbers and add the sum of the excluded
numbers at the end.10^9 + 7
.