Arithmetic numbers: Difference between revisions

Add SETL
(Add Draco)
(Add SETL)
Line 3,027:
Number of composite arithmetic numbers <= 1228663: 905043
</pre>
 
=={{header|SETL}}==
<syntaxhighlight lang="setl">program arithmetic_numbers;
[divsum, divcount] := calcdivsums(130000);
 
print("First 100 arithmetic numbers:");
 
loop for nth in [1..100000] do
loop until divsum(num) mod divcount(num) = 0 do num +:= 1; end loop;
comp +:= if num>1 and divsum(num) /= num+1 then 1 else 0 end if;
 
if nth <= 100 then
putchar(rpad(str num, 5));
if nth mod 10 = 0 then print(); end if;
end if;
 
if nth in [1000, 10000, 100000] then
print("The " + nth + "th arithmetic number is " + num + ".");
print("Of the first " + nth + " arithmetic numbers, " +
comp + " are composite.");
end if;
end loop;
 
proc calcdivsums(m);
sums := [];
counts := [];
loop for d in [1..m] do
loop for n in [d, d*2..m] do
sums(n) +:= d;
counts(n) +:= 1;
end loop;
end loop;
return [sums, counts];
end proc;
end program;</syntaxhighlight>
{{out}}
<pre>First 100 arithmetic numbers:
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 105
107 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
The 1000th arithmetic number is 1361.
Of the first 1000 arithmetic numbers, 782 are composite.
The 10000th arithmetic number is 12953.
Of the first 10000 arithmetic numbers, 8458 are composite.
The 100000th arithmetic number is 125587.
Of the first 100000 arithmetic numbers, 88219 are composite.</pre>
 
=={{header|VBScript}}==
Line 3,100 ⟶ 3,153:
</pre>
</small>
 
 
=={{header|Wren}}==
2,114

edits