Numbers divisible by their individual digits, but not by the product of their digits.: Difference between revisions

m
No edit summary
m (→‎{{header|Wren}}: Minor tidy)
(2 intermediate revisions by one other user not shown)
Line 1,810:
done...
 
</pre>
 
=={{header|RPL}}==
{{works with|HP|48}}
≪ DUP →STR → n
≪ '''CASE'''
DUP 9 ≤ n "0" POS OR '''THEN''' DROP 0 '''END'''
≪ n j DUP SUB STR→ ≫ 'j' 1 n SIZE 1 SEQ <span style="color:grey">@ make list of digits</span>
DUP2 MOD ∑LIST '''THEN''' DROP2 0 '''END'''
ΠLIST MOD SIGN
'''END'''
≫ '<span style="color:blue">GOOD?</span>' STO
 
≪ 1 999 '''FOR''' j '''IF''' j <span style="color:blue">GOOD?</span> '''THEN''' j + '''END NEXT''' ≫ EVAL
{{out}}
<pre>
1: { 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 }
</pre>
 
Line 1,944 ⟶ 1,961:
=={{header|Wren}}==
{{libheader|Wren-math}}
{{libheader|Wren-seq}}
{{libheader|Wren-fmt}}
<syntaxhighlight lang="ecmascriptwren">import "./math" for Int, Nums
import "./seqfmt" for LstFmt
import "/fmt" for Fmt
 
var res = []
Line 1,959 ⟶ 1,974:
}
System.print("Numbers < 1000 divisible by their digits, but not by the product thereof:")
for (chunk in Lst.chunks(res, 9)) Fmt.printtprint("$4d", chunkres, 9)
System.print("\n%(res.count) such numbers found")</syntaxhighlight>
 
9,482

edits