The program should run but will not be summing every Fibonacci number whose values do not exceed four million.
I believe you mean that the program does not print the correct number to solve the problem.
The while statement has the ‘b < 4000000’ which prevents the Fibonacci sequence from exceeding four million. If you put 1000000 then the Fibonaci sequence does not exceed one million, which will not be enough values to produce the correct sum.
Not your question, but note that the even ones are precisely the ones in positions multiples of 3 (indexing as F_0=0, F_1=1, F_2=1, F_3=2, ...).
We also have the sum
\sum_{k=0}^{n}F_{3n}=\frac{F_{3n+2}-1}{2}
So, you could not be computing sum += b every time. All you need is that when you get to the first F_{3n+3} \geq 4000000, you return the previous Fibonacci F_{3n+2} minus 1 and divided by 2.
There are different approaches to a problem like this and yours is a bit more advanced than a straightforward one. What confused me a bit was not your thoughts but the way they displayed in my mailer. So I looked online and your equations became nicely readable as compared to the TeX equations I am shown in raw form such as:
\sum_{k=0}^{n}F_{3n}=\frac{F_{3n+2}-1}{2}
What I want to know is how you entered the equations so it does show on-line.
I have tried various ways and what seems to work within Discord is using single dollar signs as brackets.
\sum_{k=0}^{n}F_{3n}=\frac{F_{3n+2}-1}{2}
But if it does not get sent to the email version, it is less useful and I am wondering what I might tune, such as maybe what email format I receive.
Yes, enclosing in dollar signs. However, the transformation from TeX to HTML, MathML, SVG, or other ways to display the equations, happens in the browser. The webpage tells the browser to load and run scripts from MathJax.