for (i = 0; i < 100; i++) {
result.innerHTML += 'when "i" is ' + i + ", the result is ";
result.innerHTML += (i + seed) * (i + seed + 1) / 2 - seed + 1 + ";<br>";
}
when seed = 1; this equation should produce whole number outputs with the first being 1, but when the code is run the first result is 5.5 and continues to mess up from there. I have checked the equation many times and worked through the problem in Desmos but cannot figure out the answer.
I have debugged the inputs multiple times, but they are the correct whole number inputs. The first result, where i = 0 and seed = 1 should output 1, but instead outputs 5.5.
The result should be (0 + 1) * (0 + 1 + 1) / 2 - 1 + 1, which simplifies to 1 * 2 / 2, which equals 1, but somehow the computer doesn't calculate it this way. I used PEMDAS rules to attempt to get the correct result.