This assumes Earth and Mars are spherical.
The equation we need is : d = R*arccos[R/(R + h)], where,
d = distance along surface of planet, from observer to centre of mountain (km).
R = mean radius of planet (Earth: R = 6371.0 km , Mars: R = 3386.2 km)
h = height of mountain (Mt. Everest: 8.848 km , Olympus Mons: 21 km)
For Mt. Everest, d = 6371.0*arccos[6371.0/(6371.0 + 8.848)] = 336 km.
For Olympus Mons, d = 3386.2*arccos[3386.2/(3386.2 + 21)] = 376 km.
This difference of 40 km doesn't seem like much, but it's because Mars is much
smaller than Earth. If Olympus Mons was on Earth, the distance would be 517 km.
Similarly, if Mt. Everest was on Mars, the distance would be 245 km.