Untouchable numbers: Difference between revisions
m
→{{header|Julia}}
(→{{header|REXX}}: changed the code to be more idiomatic, optimized the sigmaP function (aliquot function) for about a 5% improvement in speed, updated (correct) count of untouchable numbers for up to and including a million.) |
|||
Line 209:
=={{header|Julia}}==
I can prove that the number to required to sieve to assure only untouchables for
but the
of untouchables under 1,000,000.
<lang julia>using Primes
Line 222 ⟶ 223:
end
const maxtarget, sievelimit =
const untouchables = ones(Bool, maxtarget)
Line 241 ⟶ 242:
print(rpad(n, 5), i % 10 == 0 || i == 196 ? "\n" : "")
end
for N in [2000, 10, 100, 1000, 10_000, 100_000, 1_000_000]
println("The count of untouchable numbers ≤ $N is: ", count(x -> untouchables[x], 1:N))
end
Line 273 ⟶ 274:
The count of untouchable numbers ≤ 10000 is: 1212
The count of untouchable numbers ≤ 100000 is: 13863
The count of untouchable numbers ≤ 1000000 is: 150232
</pre>
|