Numbers with prime digits whose sum is 13

From Rosetta Code
Numbers with prime digits whose sum is 13 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.

Find all the numbers vhich digits are primes and sum of them is 13.

Ring

<lang ring> load "stdlib.ring"

sum = 0 limit = 1000000 aPrimes = []

for n = 1 to limit

   sum = 0
   st = string(n)
   for m = 1 to len(st)
       num = number(st[m])
       if isprime(num)
          sum = sum + num
          flag = 1
       else
          flag = 0
          exit
       ok
    next
    if flag = 1 and sum = 13
       add(aPrimes,n)
    ok

next

see "Unlucky numbers are:" + nl see showArray(aPrimes)

func showarray vect

    svect = ""
    for n in vect
        svect += "" + n + ","
    next
    ? "[" + left(svect, len(svect) - 1) + "]"

</lang>

Output:
Unlucky numbers are:
[337,355,373,535,553,733,2227,2272,2335,2353,2533,2722,3235,3253,3325,3352,3523,3532,5233,5323,5332,7222,22225,22252,22333,22522,23233,23323,23332,25222,32233,32323,32332,33223,33232,33322,52222,222223,222232,222322,223222,232222,322222]