NPS-INR-Codewars-2022

The 2022 edition of the NPS Indiranagar interhouse Cyber Programming contest.

View on GitHub

Mars 101

Problem Statement:

Mars is the fourth planet from the Sun and the second-smallest planet in the Solar System, being larger than only Mercury. In the English language, Mars is named for the Roman god of war. Mars is a terrestrial planet with a thin atmosphere (less than 1% that of Earth's), and has a crust primarily composed of elements similar to Earth's crust, as well as a core made of iron and nickel. Mars has surface features such as impact craters, valleys, dunes, and polar ice caps. It has two small and irregularly shaped moons: Phobos and Deimos.

Some of the most notable surface features on Mars include Olympus Mons, the largest volcano and highest known mountain on any planet in the Solar System, and Valles Marineris, one of the largest canyons in the Solar System. The Borealis basin in the Northern Hemisphere covers approximately 40% of the planet and may be a large impact feature.[^1] Days and seasons on Mars are comparable to those of Earth, as the planets have a similar rotation period and tilt of the rotational axis relative to the ecliptic plane. Liquid water on the surface of Mars cannot exist due to low atmospheric pressure, which is less than 1% of the atmospheric pressure on Earth.[^2][^3] Both of Mars's polar ice caps appear to be made largely of water.[^4][^5] In the distant past, Mars was likely wetter, and thus possibly more suited for life. However, it is unknown whether life has ever existed on Mars.

Mars has been explored by several uncrewed spacecraft, beginning with Mariner 4 in 1965. NASA's Viking 1 lander transmitted in 1976 the first images from the Martian surface. Two countries have successfully deployed rovers on Mars, the United States first doing so with Sojourner in 1997 and China with Zhurong in 2021.[^6] There are also planned future missions to Mars, such as a Mars sample-return mission set to happen in 2026, and the Rosalind Franklin rover mission, which was intended to launch in 2018 but was delayed to 2024 at the earliest, with a more likely launch date at 2028.

Mars can be viewed from Earth with the naked eye, as can its reddish coloring. This appearance, due to the iron oxide prevalent on its surface, has led to Mars often being called the Red Planet.[^7][^8] It is among the brightest objects in Earth's sky, with an apparent magnitude that reaches −2.94, comparable to that of Jupiter and surpassed only by Venus, the Moon and the Sun.[^9] Historically, Mars has been observed since ancient times, and over the millennia, has been featured in culture and the arts in ways that have reflected humanity's growing knowledge of it.

Historical observations

The history of observations of Mars is marked by the oppositions of Mars when the planet is closest to Earth and hence is most easily visible, which occur every couple of years. Even more notable are the perihelic oppositions of Mars, which are distinguished because Mars is close to perihelion, making it even closer to Earth.[^10]

Ancient and medieval observations

The ancient Sumerians named Mars Nergal, the god of war and plague. During Sumerian times, Nergal was a minor deity of little significance, but, during later times, his main cult center was the city of Nineveh.[^11] In Mesopotamian texts, Mars is referred to as the "star of judgement of the fate of the dead."[^12] The existence of Mars as a wandering object in the night sky was also recorded by the ancient Egyptian astronomers and, by 1534 BCE, they were familiar with the retrograde motion of the planet.[^13] By the period of the Neo-Babylonian Empire, the Babylonian astronomers were making regular records of the positions of the planets and systematic observations of their behavior. For Mars, they knew that the planet made 37 synodic periods, or 42 circuits of the zodiac, every 79 years. They invented arithmetic methods for making minor corrections to the predicted positions of the planets.[^14][^15] In Ancient Greece, the planet was known as .[^16] Commonly, the Greek name for the planet now referred to as Mars, was Ares. It was the Romans who named the planet Mars, for their god of war, often represented by the sword and shield of the planet's namesake.[^17]

In the fourth century BCE, Aristotle noted that Mars disappeared behind the Moon during an occultation, indicating that the planet was farther away.[^18] Ptolemy, a Greek living in Alexandria,[^19] attempted to address the problem of the orbital motion of Mars. Ptolemy's model and his collective work on astronomy was presented in the multi-volume collection later called the Almagest (from the Arabic for "greatest"), which became the authoritative treatise on Western astronomy for the next fourteen centuries.[^20] Literature from ancient China confirms that Mars was known by Chinese astronomers by no later than the fourth century BCE.[^21] In the East Asian cultures, Mars is traditionally referred to as the "fire star" (Chinese: ), based on the Wuxing system.[^22][^23][^24]

During the seventeenth century A.D., Tycho Brahe measured the diurnal parallax of Mars that Johannes Kepler used to make a preliminary calculation of the relative distance to the planet.[^25] From Brahe's observations of Mars, Kepler deduced that the planet orbited the Sun not in a circle, but in an ellipse. Moreover, Kepler showed that Mars sped up as it approached the Sun and slowed down as it moved farther away, in a manner that later physicists would explain as a consequence of the conservation of angular momentum.[^26] When the telescope became available, the diurnal parallax of Mars was again measured in an effort to determine the Sun-Earth distance. This was first performed by Giovanni Domenico Cassini in 1672. The early parallax measurements were hampered by the quality of the instruments.[^27] The only occultation of Mars by Venus observed was that of 13 October 1590, seen by Michael Maestlin at Heidelberg.[^28] In 1610, Mars was viewed by Italian astronomer Galileo Galilei, who was first to see it via telescope.[^29] The first person to draw a map of Mars that displayed any terrain features was the Dutch astronomer Christiaan Huygens.[^30]

Martian "canals"

By the 19th century, the resolution of telescopes reached a level sufficient for surface features to be identified. On 5 September 1877, a perihelic opposition of Mars occurred. The Italian astronomer Giovanni Schiaparelli used a telescope in Milan to help produce the first detailed map of Mars. These maps notably contained features he called canali, which were later shown to be an optical illusion. These canali were supposedly long, straight lines on the surface of Mars, to which he gave names of famous rivers on Earth. His term, which means "channels" or "grooves", was popularly mistranslated in English as "canals".[^31][^32]

Influenced by the observations, the orientalist Percival Lowell founded an observatory which had 30- and 45-centimetre (12- and 18-in) telescopes. The observatory was used for the exploration of Mars during the last good opportunity in 1894 and the following less favorable oppositions. He published several books on Mars and life on the planet, which had a great influence on the public.[^33][^34] The canali were independently observed by other astronomers, like Henri Joseph Perrotin and Louis Thollon in Nice, using one of the largest telescopes of that time.[^35][^36]

The seasonal changes (consisting of the diminishing of the polar caps and the dark areas formed during Martian summer) in combination with the canals led to speculation about life on Mars, and it was a long-held belief that Mars contained vast seas and vegetation. As bigger telescopes were used, fewer long, straight canali were observed. During observations in 1909 by Antoniadi with an telescope, irregular patterns were observed, but no canali were seen.[^37]

Physical characteristics

Mars is approximately half the diameter of Earth, with a surface area only slightly less than the total area of Earth's dry land.[^38] Mars is less dense than Earth, having about 15% of Earth's volume and 11% of Earth's mass, resulting in about 38% of Earth's surface gravity. The red-orange appearance of the Martian surface is caused by iron(III) oxide, or rust.[^39] It can look like butterscotch;[^40] other common surface colors include golden, brown, tan, and greenish, depending on the minerals present.[^41]

Internal structure

Like Earth, Mars has differentiated into a dense metallic core overlaid by less dense materials.[^42][^43] Current models of its interior imply a core consisting primarily of iron and nickel with about 16–17% sulfur.[^44] This iron(II) sulfide core is thought to be twice as rich in lighter elements as Earth's.[^45] The core is surrounded by a silicate mantle that formed many of the tectonic and volcanic features on the planet, but it appears to be dormant. Besides silicon and oxygen, the most abundant elements in the Martian crust are iron, magnesium, aluminium, calcium, and potassium. The average thickness of the planet's crust is about , with a maximum thickness of .[^46] By comparison, Earth's crust averages in thickness.[^47]

Mars is seismically active. InSight has detected and recorded over 450 marsquakes and related events in 2019.[^48][^49] In 2021 it was reported that based on eleven low-frequency Marsquakes detected by the InSight lander the core of Mars is indeed liquid and has a radius of about and a temperature around 1900–2000 K. The Martian core radius is more than half the radius of Mars and about half the size of the Earth's core. This is somewhat larger than models predicted, suggesting that the core contains some amount of lighter elements like oxygen and hydrogen in addition to the iron–nickel alloy and about 15% of sulfur.[^50][^51]

The core of Mars is overlaid by the rocky mantle, which, however, does not seem to have a layer analogous to the Earth's lower mantle. The Martian mantle appears to be solid down to the depth of about 500 km, where the low-velocity zone (partially melted asthenosphere) begins.[^52] Below the asthenosphere the velocity of seismic waves starts to grow again and at the depth of about 1050 km there lies the boundary of the transition zone.[^53] At the surface of Mars there lies a crust with the average thickness of about 24–72 km.[^54]

Surface geology

(USGS, 2014)[^55]|left|338x338px](USGS-MarsMap-sim3292-20140714-crop.png “Geologic map of Mars (USGS, 2014)|left|338x338px”)

Mars is a terrestrial planet with a surface that consists of minerals containing silicon and oxygen, metals, and other elements that typically make up rock. The Martian surface is primarily composed of tholeiitic basalt,[^56] although parts are more silica-rich than typical basalt and may be similar to andesitic rocks on Earth, or silica glass. Regions of low albedo suggest concentrations of plagioclase feldspar, with northern low albedo regions displaying higher than normal concentrations of sheet silicates and high-silicon glass. Parts of the southern highlands include detectable amounts of high-calcium pyroxenes. Localized concentrations of hematite and olivine have been found.[^57] Much of the surface is deeply covered by finely grained iron(III) oxide dust.[^58]

Although Mars has no evidence of a structured global magnetic field,[^59] observations show that parts of the planet's crust have been magnetized, suggesting that alternating polarity reversals of its dipole field have occurred in the past. This paleomagnetism of magnetically susceptible minerals is similar to the alternating bands found on Earth's ocean floors. One theory, published in 1999 and re-examined in October 2005 (with the help of the Mars Global Surveyor), is that these bands suggest plate tectonic activity on Mars four billion years ago, before the planetary dynamo ceased to function and the planet's magnetic field faded.[^60]

Scientists have theorized that during the Solar System's formation Mars was created as the result of a random process of run-away accretion of material from the protoplanetary disk that orbited the Sun. Mars has many distinctive chemical features caused by its position in the Solar System. Elements with comparatively low boiling points, such as chlorine, phosphorus, and sulfur, are much more common on Mars than Earth; these elements were probably pushed outward by the young Sun's energetic solar wind.[^61]

After the formation of the planets, all were subjected to the so-called "Late Heavy Bombardment". About 60% of the surface of Mars shows a record of impacts from that era,[^62][^63][^64] whereas much of the remaining surface is probably underlain by immense impact basins caused by those events. There is evidence of an enormous impact basin in the Northern Hemisphere of Mars, spanning , or roughly four times the size of the Moon's South Pole – Aitken basin, the largest impact basin yet discovered.[^65] This theory suggests that Mars was struck by a Pluto-sized body about four billion years ago. The event, thought to be the cause of the Martian hemispheric dichotomy, created the smooth Borealis basin that covers 40% of the planet.[^66][^67]

The geological history of Mars can be split into many periods, but the following are the three primary periods:[^68][^69]

Geological activity is still taking place on Mars. The Athabasca Valles is home to sheet-like lava flows created about 200 mya. Water flows in the grabens called the Cerberus Fossae occurred less than 20 Mya, indicating equally recent volcanic intrusions.[^73] The Mars Reconnaissance Orbiter has captured images of avalanches.[^74][^75]

Soil

soil and boulders after crossing the "Dingo Gap" sand dune](PIA17944-MarsCuriosityRover-AfterCrossingDingoGapSanddune-20140209.jpg “fig:Curiosity view of Martian soil and boulders after crossing the “Dingo Gap” sand dune”) The Phoenix lander returned data showing Martian soil to be slightly alkaline and containing elements such as magnesium, sodium, potassium and chlorine. These nutrients are found in soils on Earth. They are necessary for growth of plants.[^76] Experiments performed by the lander showed that the Martian soil has a basic pH of 7.7, and contains 0.6% of the salt perchlorate,[^77][^78] concentrations that are toxic to humans.[^79][^80]

Streaks are common across Mars and new ones appear frequently on steep slopes of craters, troughs, and valleys. The streaks are dark at first and get lighter with age. The streaks can start in a tiny area, then spread out for hundreds of metres. They have been seen to follow the edges of boulders and other obstacles in their path. The commonly accepted theories include that they are dark underlying layers of soil revealed after avalanches of bright dust or dust devils.[^81] Several other explanations have been put forward, including those that involve water or even the growth of organisms.[^82][^83]

Hydrology

Water in its liquid form cannot exist on the surface of Mars due to low atmospheric pressure, which is less than 1% that of Earth's,[^84] except at the lowest elevations for short periods.[^85][^86] The two polar ice caps appear to be made largely of water.[^87][^88] The volume of water ice in the south polar ice cap, if melted, would be enough to cover the entire surface of the planet with a depth of .[^89] Large quantities of ice are thought to be trapped within the thick cryosphere of Mars. Radar data from Mars Express and the Mars Reconnaissance Orbiter (MRO) show large quantities of ice at both poles,[^90][^91] and at middle latitudes.[^92] The Phoenix lander directly sampled water ice in shallow Martian soil on 31 July 2008.[^93]

Landforms visible on Mars strongly suggest that liquid water has existed on the planet's surface. Huge linear swathes of scoured ground, known as outflow channels, cut across the surface in about 25 places. These are thought to be a record of erosion caused by the catastrophic release of water from subsurface aquifers, though some of these structures have been hypothesized to result from the action of glaciers or lava.[^94][^95] One of the larger examples, Ma'adim Vallis, is long, much greater than the Grand Canyon, with a width of and a depth of in places. It is thought to have been carved by flowing water early in Mars's history.[^96] The youngest of these channels are thought to have formed only a few million years ago.[^97] Elsewhere, particularly on the oldest areas of the Martian surface, finer-scale, dendritic networks of valleys are spread across significant proportions of the landscape. Features of these valleys and their distribution strongly imply that they were carved by runoff resulting from precipitation in early Mars history. Subsurface water flow and groundwater sapping may play important subsidiary roles in some networks, but precipitation was probably the root cause of the incision in almost all cases.[^98]

Along crater and canyon walls, there are thousands of features that appear similar to terrestrial gullies. The gullies

Your task is to print this statement: The origin of the two moons is not well understood.

tend to be in the highlands of the Southern Hemisphere and to face the Equator; all are poleward of 30° latitude. A number of authors have suggested that their formation process involves liquid water, probably from melting ice,[^99][^100] although others have argued for formation mechanisms involving carbon dioxide frost or the movement of dry dust.[^101][^102] No partially degraded gullies have formed by weathering and no superimposed impact craters have been observed, indicating that these are young features, possibly still active.[^103] Other geological features, such as deltas and alluvial fans preserved in craters, are further evidence for warmer, wetter conditions at an interval or intervals in earlier Mars history.[^104] Such conditions necessarily require the widespread presence of crater lakes across a large proportion of the surface, for which there is independent mineralogical, sedimentological and geomorphological evidence.[^105] Further evidence that liquid water once existed on the surface of Mars comes from the detection of specific minerals such as hematite and goethite, both of which sometimes form in the presence of water.[^106]

that appears bright blue in this enhanced-color view from the MRO.](Mars_exposed_subsurface_ice.jpg “A cross-section of underground water ice is exposed at the steep slope that appears bright blue in this enhanced-color view from the MRO.”)

Observations and findings of water evidence

In 2004, Opportunity detected the mineral jarosite. This forms only in the presence of acidic water, showing that water once existed on Mars.[^107][^108] The Spirit rover found concentrated deposits of silica in 2007 that indicated wet conditions in the past, and in December 2011, the mineral gypsum, which also forms in the presence of water, was found on the surface by NASA's Mars rover Opportunity.[^109][^110][^111] It is estimated that the amount of water in the upper mantle of Mars, represented by hydroxyl ions contained within Martian minerals, is equal to or greater than that of Earth at 50–300 parts per million of water, which is enough to cover the entire planet to a depth of .[^112][^113]

On 18 March 2013, NASA reported evidence from instruments on the Curiosity rover of mineral hydration, likely hydrated calcium sulfate, in several rock samples including the broken fragments of "Tintina" rock and "Sutton Inlier" rock as well as in veins and nodules in other rocks like "Knorr" rock and "Wernicke" rock.[^114][^115] Analysis using the rover's DAN instrument provided evidence of subsurface water, amounting to as much as 4% water content, down to a depth of , during the rover's traverse from the Bradbury Landing site to the Yellowknife Bay area in the Glenelg terrain.[^116] In September 2015, NASA announced that they had found strong evidence of hydrated brine flows in recurring slope lineae, based on spectrometer readings of the darkened areas of slopes.[^117][^118][^119] These streaks flow downhill in Martian summer, when the temperature is above −23° Celsius, and freeze at lower temperatures.[^120] These observations supported earlier hypotheses, based on timing of formation and their rate of growth, that these dark streaks resulted from water flowing just below the surface.[^121] However, later work suggested that the lineae may be dry, granular flows instead, with at most a limited role for water in initiating the process.[^122] A definitive conclusion about the presence, extent, and role of liquid water on the Martian surface remains elusive.[^123][^124]

Researchers suspect much of the low northern plains of the planet were covered with an ocean hundreds of meters deep, though this theory remains controversial.[^125] In March 2015, scientists stated that such an ocean might have been the size of Earth's Arctic Ocean. This finding was derived from the ratio of water to deuterium in the modern Martian atmosphere compared to that ratio on Earth. The amount of Martian deuterium is eight times the amount that exists on Earth, suggesting that ancient Mars had significantly higher levels of water. Results from the Curiosity rover had previously found a high ratio of deuterium in Gale Crater, though not significantly high enough to suggest the former presence of an ocean. Other scientists caution that these results have not been confirmed, and point out that Martian climate models have not yet shown that the planet was warm enough in the past to support bodies of liquid water.[^126] Near the northern polar cap is the wide Korolev Crater, which the Mars Express orbiter found to be filled with approximately of water ice.[^127]

Input Format:

No input

Output Format:

Print a single line containing the required string (look at line 404 of the problem statement)

Constraints:

No constraints

Sample Input:

Sample Output:

<figure it out>

Solution:

print('The origin of the two moons is not well understood.')