There are several possible transfers to Mars. All these transfers trade departure energy, measured in fuel consumption (and eventually dollars) for time travel. The greater the departure energy the shorter the travel times are between Earth and Mars.
To show several possible transfers, the below table of constants were used for all calculations [1] Key constants are highlighted in yellow.
Mars
Earth
Semimajor axis (106 km)
227.920
149.600
Gravitational Constant - μ (km3/s2)
42828
398600
Sidereal orbit period (days)
686.980
365.256
Tropical orbit period (days)
686.973
365.242
Perihelion (106 km)
206.620
147.090
Aphelion (106 km)
249.230
152.100
Synodic period (days)
779.940
-
Mean orbital velocity (km/s)
24.130
29.780
Max. orbital velocity (km/s)
26.500
30.290
Min. orbital velocity (km/s)
21.970
29.290
Orbit inclination (deg)
1.850
0.000
Orbit eccentricity
0.094
0.017
Sidereal rotation period (hrs)
24.623
23.935
Length of day (hrs)
24.660
24.000
Obliquity to orbit (deg)
25.190
23.450
Gravitational Constant for the Sun is 1.3271244e11 (km3/s2)
Simplifying assuming for calculations:
Circular orbits (eccentricity equals zero)
Note that Earth and Mars have near circular orbits
Co-planar transfers (all orbits share the same plane)
There is only a 1.85 degree difference between the Earth and Mars orbital planes
The key gravitational force during the transfer is the Sun.