Numbers divisible by their individual digits, but not by the product of their digits.
Numbers divisible by their individual digits, but not by the product of their 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 and show numbers divisible by their individual digits, but not by the product of their digits, where n < 1000
Ring
<lang ring> load "stdlib.ring"
decimals(0) see "working..." + nl see "Numbers divisible by their individual digits, but not by the product of their digits are:" + nl
row = 0 limit = 1000
for n = 1 to limit
flag = 1 pro = 1 strn = string(n) for m = 1 to len(strn) temp = strn[m] if temp != 0 pro = pro * number(temp) ok if n%temp = 0 flag = 1 else flag = 0 exit ok next bool = ((n%pro) != 0) if flag = 1 and bool row = row + 1 see "" + n + " " if row%10 = 0 see nl ok ok
next
see nl + "Found " + row + " numbers" + nl see "done..." + nl </lang>
- Output:
working... Numbers divisible by their individual digits, but not by the product of their digits are: 22 33 44 48 55 66 77 88 99 122 124 126 155 162 168 184 222 244 248 264 288 324 333 336 366 396 412 424 444 448 488 515 555 636 648 666 728 777 784 824 848 864 888 936 999 Found 45 numbers done...