The Euler formula can be utilized to calculate π in a variety of ways. Below is the MATLAB code implementing Euler’s series for approximating π:

n = 1000000; % Number of iterations
pi_estimate = 0;
for k = 0:n-1
    pi_estimate = pi_estimate + ((-1)^k)/(2*k+1);
end
pi_estimate = 4 * pi_estimate;
display(pi_estimate);

This code sums the infinite series based on Euler's formula to estimate the value of π. The accuracy of the result improves with more iterations.

This is part of the Project Euler challenges, a collection of mathematical problems to be solved using programming. The open-source solutions for these challenges help enhance programming and mathematical skills.