Get Started »

# Discrete Mathematics

 In[1]:= ⨯ `FactorInteger[30]`
 Out[1]=

Find the GCD (or LCM) of any two integers:

 In[2]:= ⨯ `GCD[24, 60]`
 Out[2]=

Display the 4`th prime number:`

``` ```
``` In[1]:= ⨯ Prime[4] Out[1]= Test the primality of a number: In[2]:= ⨯ PrimeQ[%] Out[2]= This works with coprime numbers as well: In[3]:= ⨯ CoprimeQ[51, 15] Out[3]= ```
``` Use the Mod function for the remainder: In[1]:= ⨯ Mod[17, 5] Out[1]= Get all possible permutations of a list: In[1]:= ⨯ Permutations[{a, b, c}] Out[1]= Apply Permute to a list using disjoint Cycles: (Cycles takes a list of lists as an argument.) In[2]:= ⨯ Permute[{a, b, c, d}, Cycles[{{2, 4}, {1, 3}}]] Out[2]= Find the permutation order: In[3]:= ⨯ PermutationOrder[Cycles[{{2, 4}, {1, 3}}]] Out[3]= Generate a Graph from a list of edges: (Use ESCueESC for an UndirectedEdge or ESCdeESC for a DirectedEdge.) In[1]:= ⨯ Graph[{1 <-> 2, 2 \[DirectedEdge] 3, 3 \[DirectedEdge] 4, 4 <-> 1, 3 \[DirectedEdge] 1, 2 \[DirectedEdge] 2}, VertexLabels -> All] Out[1]= Find the shortest path between two vertices: In[2]:= ⨯ FindShortestPath[%, 3, 2] Out[2]= Explore well-known graphs using natural-language input: In[3]:= X pappus graph image Out[3]= The Wolfram Language also includes functions for combinatorics, probability, integer sequences and much more. QUICK REFERENCE: Number Theoretic Functions » QUICK REFERENCE: Discrete Mathematics » Hands–on Start toWolfram Mathematica » Full Documentation » Demonstrations Project » ```
``` ```
``` › ```
``` ```
``` ```
``` ```
``` Enable JavaScript to interact with content and submit forms on Wolfram websites. Learn how » ```
``` Deutsch English Español Français 日本語 한국어 Português Русский 中文 ```