# Wolfram Function Repository

Instant-use add-on functions for the Wolfram Language

Function Repository Resource:

Solve an alphametic puzzle

Contributed by:
Peter Valko

ResourceFunction["Alphametic"][ finds a solution to the alphametic puzzle |

ResourceFunction["Alphametic"][*string*,*n*] returns *n* solutions if possible.

ResourceFunction["Alphametic"][*string*,All] returns all solutions.

The *string* must contain one and only one equal sign.

Upper and lower case are treated as different letters.

The solver uses interval arithmetic and backtrack search.

Solve the classic alphametic puzzle "send+more=money":

In[1]:= |

Out[1]= |

This has a unique solution:

In[2]:= |

Out[2]= |

In this example, there are 1200 solutions:

In[3]:= |

Out[3]= |

If a puzzle has no solution, then an empty list is returned:

In[4]:= |

Out[4]= |

In[5]:= |

Out[5]= |

Parentheses and exponentiation operations are allowed:

In[6]:= |

Out[6]= |

- 2.0.0 – 15 April 2020
- 1.0.0 – 08 April 2020

This work is licensed under a Creative Commons Attribution 4.0 International License