{"id":4529,"date":"2012-08-28T23:43:56","date_gmt":"2012-08-28T22:43:56","guid":{"rendered":"http:\/\/www.walkingrandomly.com\/?p=4529"},"modified":"2012-08-28T23:54:37","modified_gmt":"2012-08-28T22:54:37","slug":"computational-word-trivia-with-mathematica-longest-words-with-letters-in-alphabetical-order","status":"publish","type":"post","link":"https:\/\/walkingrandomly.com\/?p=4529","title":{"rendered":"Computational word trivia with Mathematica &#8211; longest words with letters in alphabetical order"},"content":{"rendered":"<p>Let&#8217;s use <a href=\"http:\/\/www.wolfram.com\/mathematica\/\">Mathematica<\/a> to to discover the longest English words where the letters are in alphabetical order.\u00a0 The following command will give all such words<\/p>\n<pre>DictionaryLookup[x__ \/; Characters[x] == Sort[Characters[x]]]<\/pre>\n<p>I&#8217;m not going to show all of the output because there are 562 of them (including single letter words such as &#8216;I&#8217; and &#8216;a&#8217;) as we can see by doing<\/p>\n<pre> Length[\r\n DictionaryLookup[x__ \/; Characters[x] == Sort[Characters[x]]]\r\n]\r\n\r\n562<\/pre>\n<p>The longest of these words has seven characters:<\/p>\n<pre>Max[Map[StringLength,\r\n  DictionaryLookup[x__ \/; Characters[x] == Sort[Characters[x]]]]]\r\n\r\n7<\/pre>\n<p>It turns out that only one such word has the maximum 7 characters<\/p>\n<pre>DictionaryLookup[x__ \/; Characters[x] == Sort[Characters[x]] &amp;&amp; StringLength[x] == 7]\r\n\r\n{\"billowy\"}<\/pre>\n<p>There are 34 such words that contain 6 characters<\/p>\n<pre> DictionaryLookup[\r\n x__ \/; Characters[x] == Sort[Characters[x]] &amp;&amp; StringLength[x] == 6]\r\n\r\n{\"abbess\", \"Abbott\", \"abhors\", \"accent\", \"accept\", \"access\", \\\r\n\"accost\", \"adders\", \"almost\", \"begins\", \"bellow\", \"Bellow\", \"bijoux\", \\\r\n\"billow\", \"biopsy\", \"bloops\", \"cellos\", \"chills\", \"chilly\", \"chimps\", \\\r\n\"chinos\", \"chintz\", \"chippy\", \"chivvy\", \"choosy\", \"choppy\", \"Deimos\", \\\r\n\"effort\", \"floors\", \"floppy\", \"flossy\", \"gloppy\", \"glossy\", \"knotty\"}<\/pre>\n<p>If you insist on all letters being different, there are 9:<\/p>\n<pre>DictionaryLookup[\r\n x__ \/; Characters[x] == Sort[Characters[x]] &amp;&amp; StringLength[x] == 6 &amp;&amp;\r\n    Length[Union[Characters[x]]] == Length[Characters[x]]]\r\n\r\n{\"abhors\", \"almost\", \"begins\", \"bijoux\", \"biopsy\", \"chimps\", \\\r\n\"chinos\", \"chintz\", \"Deimos\"}<\/pre>\n<p>How about where all the letters are in <strong>reverse alphabetical order with no repeats<\/strong>?  The longest such words have 7 characters<\/p>\n<pre>Max[\r\n Map[StringLength,\r\n  DictionaryLookup[\r\n   x__ \/; Characters[x] == Reverse[Sort[Characters[x]]]]]]\r\n\r\n7<\/pre>\n<p>Here they are<\/p>\n<pre>DictionaryLookup[\r\n x__ \/; Characters[x] == Reverse[Sort[Characters[x]]] &amp;&amp;\r\n   StringLength[x] == 7 &amp;&amp;\r\n   Length[Union[Characters[x]]] == Length[Characters[x]]]\r\n\r\n{\"sponged\", \"wronged\"}<\/pre>\n<ul>\n<li>You can follow WalkingRandomly via <a href=\"http:\/\/feeds.feedburner.com\/WalkingRandomly\">RSS<\/a>,<a href=\"https:\/\/twitter.com\/walkingrandomly\">Twitter<\/a>, <a href=\"http:\/\/www.facebook.com\/Walkingrandomly\">Facebook<\/a> and <a href=\"https:\/\/plus.google.com\/108930714356162091073\/posts\">Google+<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Let&#8217;s use Mathematica to to discover the longest English words where the letters are in alphabetical order.\u00a0 The following command will give all such words DictionaryLookup[x__ \/; Characters[x] == Sort[Characters[x]]] I&#8217;m not going to show all of the output because there are 562 of them (including single letter words such as &#8216;I&#8217; and &#8216;a&#8217;) as [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[8,61,7,60],"tags":[],"class_list":["post-4529","post","type-post","status-publish","format-standard","hentry","category-mathematica","category-natural-language","category-programming","category-trivia"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3swhs-1b3","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/4529","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4529"}],"version-history":[{"count":17,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/4529\/revisions"}],"predecessor-version":[{"id":4544,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/4529\/revisions\/4544"}],"wp:attachment":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4529"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4529"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4529"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}