How to resolve the algorithm Hex words step by step in the J programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Hex words step by step in the J programming language
Table of Contents
Problem Statement
For the purposes of this task a hex word means a word which (in lower case form) consists entirely of the letters a, b, c, d, e and f. Using unixdict.txt, find all hex words with 4 letters or more. Convert each such word to its decimal equivalent and compute its base 10 digital root. Display all three in increasing order of digital root and show the total count of such words. Keeping only words which contain at least 4 distinct letters, display the same statistics but in decreasing order of decimal equivalent together with their total count.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Hex words step by step in the J programming language
Source code in the j programming language
(#~$&1 0@#)(#,&":])/:~((+/@(".&>@":)^:_@]; ;~) dfh)@> (#~ (*/@e.&'abcdef' * 3<#)@>) cutLF fread'unixdict.txt'
26
│1│43966 │abbe │
│1│56026 │dada │
│1│57007 │deaf │
│1│703162 │ababa │
│1│14600926│decade│
│2│52958 │cede │
│2│65261 │feed │
│3│44013 │abed │
│3│47838 │bade │
│3│712173 │added │
│4│782014 │beebe │
│4│912586 │decca │
│5│56030 │dade │
│6│48813 │bead │
│6│14613198│deface│
│7│47806 │babe │
│7│64222 │fade │
│8│57005 │dead │
│8│15727310│efface│
│8│16435934│facade│
│9│48879 │beef │
│9│51966 │cafe │
│9│57069 │deed │
│9│64206 │face │
│9│896202 │dacca │
│9│11325150│accede│
(#~ $&1 0@#)(#,&":])\:~((+/@(".&>@":)^:_@]; ;~) dfh)@> (#~ (*/@e.&'abcdef' * 3 < #@~.)@>) cutLF fread'unixdict.txt'
13
│9│11325150│accede│
│9│64206 │face │
│9│51966 │cafe │
│8│16435934│facade│
│8│15727310│efface│
│7│64222 │fade │
│6│14613198│deface│
│6│48813 │bead │
│4│912586 │decca │
│3│47838 │bade │
│3│44013 │abed │
│1│14600926│decade│
│1│57007 │deaf │
You may also check:How to resolve the algorithm Count occurrences of a substring step by step in the AArch64 Assembly programming language
You may also check:How to resolve the algorithm Look-and-say sequence step by step in the jq programming language
You may also check:How to resolve the algorithm Roman numerals/Encode step by step in the HicEst programming language
You may also check:How to resolve the algorithm Greyscale bars/Display step by step in the Mathematica / Wolfram Language programming language
You may also check:How to resolve the algorithm Zig-zag matrix step by step in the ATS programming language