Arithmetic numbers: Difference between revisions

(Added Quackery.)
Line 1,971:
The one millionth: 1,228,663
Composite arithmetic numbers ≤ 1,228,663: 905,043</pre>
 
=={{header|Ring}}==
<syntaxhighlight lang="ring">
see "works..." + nl
divisors = []
divSum = 0
limit = 10000
counta = 0
countb = 0
countCompa = 0
countCompb = 0
for n = 1 to limit
num = 0
divSum = 0
for m = 1 to n
if n%m = 0
num++
divSum = divSum + m
ok
next
for x = 1 to n
if divSum/num = x
add(divisors,n)
counta++
countb++
if counta < 1001
if not isPrime(n) and n!=1
countCompa++
ok
ok
if counta = 1000
countNuma = n
ok
if countb < 10001
if not isPrime(n) and n!=1
countCompb++
ok
ok
if countb = 10000
countNumb = n
exit 2
ok
ok
next
next
 
see "The first 100 arithmetic numbers are:" + nl + nl
 
row = 0
for n = 1 to 100
row++
see "" + divisors[n] + " "
if row%10=0
see nl
ok
next
 
see nl
see "1000th arithmetic number is " + countNuma + nl
see "Number of composite arithmetic numbers <= " + countNuma + ":" + countCompa + nl+nl
 
see "10000th arithmetic number is " + countNumb + nl
see "Number of composite arithmetic numbers <= " + countNumb + ":" + countCompb + nl
see "done..." + nl
 
func isPrime num
if (num <= 1) return 0 ok
if (num % 2 = 0 and num != 2) return 0 ok
for i = 3 to floor(num / 2) -1 step 2
if (num % i = 0) return 0 ok
next
return 1
</syntaxhighlight>
{{out}}
<pre>
works...
The first 100 arithmetic numbers are:
 
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
 
1000th arithmetic number is 1361
Number of composite arithmetic numbers <= 1361: 782
 
10000th arithmetic number is 12953
Number of composite arithmetic numbers <= 12953: 8458
</pre>
 
=={{header|Rust}}==
2,468

edits