Prime words

From Rosetta Code
Revision as of 12:16, 4 December 2020 by rosettacode>Gerard Schildberger (→‎{{header|REXX}}: added a REXX stub.)
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