Prime words: Difference between revisions

From Rosetta Code
Content added Content deleted
(Created page with "{{draft task}} A word is a prime one if its letters ASCII codes are primes. =={{header|Ring}}== <lang ring> load "stdlib.ring" cStr = read("unixdict.txt") wordList = str2list...")
 
m (→‎{{header|REXX}}: added a REXX stub.)
Line 1: Line 1:
{{draft task}}
{{draft task}}
A word is a prime one if its letters ASCII codes are primes.
A word is a prime one if its letters ASCII codes are primes.
=={{header|REXX}}==

=={{header|Ring}}==
=={{header|Ring}}==
<lang ring>
<lang ring>

Revision as of 12:16, 4 December 2020

Prime words is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

A word is a prime one if its letters ASCII codes are primes.

REXX

Ring

<lang ring> load "stdlib.ring"

cStr = read("unixdict.txt") wordList = str2list(cStr) Words = []

for n = 1 to len(wordList)

   num = 0 
   len = len(wordList[n])
   for m = 1 to len
       asc = ascii(wordList[n][m])
       if isprime(asc)
          num = num + 1
       else
          exit
       ok
   next
   if num = len and len > 2
      add(Words,wordList[n])
   ok

next

see "Prime words are:" + nl see Words </lang> Output:

Prime words are:
aaa
age
agee
ama
egg
eke
emma
gag
gage
gam
game
gamma
gee
gem
gemma
keg
mae
magma
make
mamma
meek
meg