Numbers in base-16 representation that cannot be written with decimal digits

Revision as of 07:45, 24 June 2021 by CalmoSoft (talk | contribs) (Created page with "{{Draft task}} ;Task: Find numbers in base-16 representation that cannot be written with decimal digits, where '''n < 500''' <br><br> =={{header|Ring}}== <lang ring> see "w...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Numbers in base-16 representation that cannot be written with decimal digits 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.
Task
Find numbers in base-16 representation that cannot be written with decimal digits, where n < 500



Ring

<lang ring> see "working..." + nl see "Numbers in base-16 representation that cannot be written with decimal digits:" + nl

row = 0 baseList = "ABCDEF" limit = 500

for n = 1 to limit

   flag = 1  
   hex = upper(hex(n))
   for m = 1 to len(hex)
       ind = substr(baseList,hex[m])
       if ind < 1
          flag = 0
          exit
       ok
   next
    
   if flag = 1
      see "" + n + " "
      row = row + 1
      if row%5 = 0
         see nl
      ok
   ok

next

see nl + "Found " + row + " numbers" + nl see "done..." + nl </lang>

Output:
working...
Numbers in base-16 representation that cannot be written with decimal digits:
10 11 12 13 14 
15 170 171 172 173 
174 175 186 187 188 
189 190 191 202 203 
204 205 206 207 218 
219 220 221 222 223 
234 235 236 237 238 
239 250 251 252 253 
254 255 
Found 42 numbers
done...