Math Puzzles
The Wolfram Language is an excellent platform for working through challenging math problems and puzzles. Once you know the principles, exploration is easy.
Suppose you wanted to find the number of positive integers up to 1,000,000 that have no common factors with 1,000,000.
You could start by testing the first million positive integers against 1,000,000 with CoprimeQ:
In[1]:= |
Out[1]= | ![]() |
Automatically remove the False entries by replacing them with Nothing:
In[2]:= |
Out[2]= | ![]() |
Then find the Length of the resulting list:
In[3]:= |
Out[3]= | ![]() |
Combine these steps into one line:
In[4]:= |
Out[4]= | ![]() |
Symbolic expressions often yield direct solutions. Given a positive integer k, can you find a formula for the sum 1k+2k+...+nk?
Solution for k=2:
In[1]:= |
Out[1]= | ![]() |
The general solution is the nth harmonic number of order −
k:
In[2]:= |
Out[2]= | ![]() |
With built-in graphics, it’s easy to visualize geometric problems. Consider the following figure:
In[1]:= |
Out[1]= | ![]() |
For a given base length n, is it possible to fill this shape with similar shapes of base length 1?
Solution for n=2:
In[2]:= |
Out[2]= | ![]() |
Solution for n=3:
In[3]:= |
Out[3]= | ![]() |
Famous puzzles, problems and riddles are available through natural-language input:
In[1]:= |
Out[1]= | ![]() |
Many more in-depth examples can be found at the Wolfram Demonstrations Project.