Arithmetic numbers: Difference between revisions

add RPL
(add RPL)
Line 2,315:
Number of composite arithmetic numbers <= 12953: 8458
done...
</pre>
 
=={{header|RPL}}==
{{works with|HP|49g}}
DIVIS ∑LIST LASTARG SIZE DUP UNROT MOD NOT
SWAP 2 > R→C
≫ '<span style="color:blue">ARITHM</span>' STO <span style="color:grey">@ ( n → (arithmetic?,composite?) ) </span>
≪ { 1 } 1
'''DO'''
1 +
'''IF''' DUP <span style="color:blue">ARITHM</span> RE '''THEN''' SWAP OVER + SWAP '''END'''
'''UNTIL''' OVER SIZE 100 ≥ '''END''' DROP
≫ '<span style="color:blue">TASK1</span>' STO
≪ → x
≪ (1,0) 1
'''DO'''
1 +
DUP <span style="color:blue">ARITHM</span>
'''IF''' DUP RE '''THEN''' ROT + SWAP '''ELSE''' DROP '''END'''
'''UNTIL''' OVER RE x ≥ '''END'''
" o/w comp.= " + SWAP IM +
≫ ≫ '<span style="color:blue">TASK23</span>' STO
 
1000 <span style="color:blue">TASK1</span> 1000 <span style="color:blue">TASK23</span>
{{out}}
<pre>
3: { 1 3 5 6 7 11 13 14 15 17 19 20 21 22 23 27 29 30 31 33 35 37 38 39 41 42 43 44 45 46 47 49 51 53 54 55 56 57 59 60 61 62 65 66 67 68 69 70 71 73 77 78 79 83 85 86 87 89 91 92 93 94 95 96 97 99 101 102 103 105107 109 110 111 113 114 115 116 118 119 123 125 126 127 129 131 132 133 134 135 137 138 139 140 141 142 143 145 147 149 }
2: "1361 o/w comp.= 782."
1: "12953 o/w comp.= 8458."
</pre>
 
1,150

edits