Let's do something simple but useful for geographical data science: drawing a map in Python. I will assume you are using the Anaconda distribution.
Unfortunately, there are many mapping libraries for different programming ecosystems and it's a little hard to find out which you should use. For a long time in Python, Basemap was the standard, but that project will soon be no longer maintained in favour of a newer library, Cartopy. That is what we will be using today, along with matplotlib. To install these in Anaconda, use:
|
1 2 |
conda install -c conda-forge matplotlib conda install -c conda-forge cartopy |
Once you install these, here is minimal Python code to draw a map:
…read the rest of this post!
Take a number written in decimal, like $25$. Take the sum of squares of its digits: $2^2 + 5^2 = 29$. Can you ever get the number you started with?
A perfect number is a positive integer $n$ such that $n$ is the sum of its proper divisors. For example $6 = 1 + 2 + 3$. The symbol $\sigma(n)$ is usally used for the sum of all the divisors of a positive integer $n$, so that a number is perfect if and only if $\sigma(n) = 2n$. All known perfect numbers are even, and they correspond to Mersenne primes. These are primes of the form $2^k – 1$. For example, if $k=5$ then $2^5 – 1 = 31$, a prime number. The correspondence between Mersenne primes and even perfect numbers is given by: