So many anagrams

Computer Science Level pending

STAFF edit: We currently are aware that the pastebin link has expired. Please ignore this problem for now.

Which of the following words has the maximum number of anagrams?


Details and Assumptions:

  • Two words are anagrams of each other if it is possible to rearrange the letters in the first to obtain the second. For example, "SILENT" and "LISTEN" are anagrams
  • For simplicity, assume that English consists of exactly these words.
  • You may want to write a program to find the answer.
arrest post recast spear trace

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Giorgos K.
Feb 20, 2018

Solved using Mathematica
Lets call g the list of all english words
then the following code

1
Intersection[g,#]&/@((StringJoin /@Permutations[Characters@#])&/@{"arrest","post","recast","spear","trace"})

returns..

1
2
3
4
5
{{arrest,rarest,raster,raters,sartre,starer},
{opts,post,pots,spot,stop,tops},
{caster,caters,crates,reacts,recast,traces},
{pares,parse,pears,rapes,reaps,spare,spear},
{caret,cater,crate,react,recta,trace}}

Mathematica is powerful indeed! Nice and crisp solution.

Agnishom Chattopadhyay - 3 years, 3 months ago

2 pending reports

Vote up reports you agree with

×

Problem Loading...

Note Loading...

Set Loading...