Radical of an integer: Difference between revisions

m
m (→‎{{header|J}}: include bonus)
m (→‎{{header|Julia}}: add stretch)
Line 219:
println("\nBreakdown of numbers of distinct prime factors for positive integers from 1 to 1,000,000:")
histogram(map(radicallength, 1:1_000_000), nbins = 8)
 
println("\nCheck on breakdown:")
primecount = length(primes(1_000_000)) # count of primes to 1 million
powerscount = mapreduce(p -> Int(floor(6 / log10(p)) - 1), +, primes(1000))
println("Prime count to 1 million: ", lpad(primecount, 6))
println("Prime powers less than 1 million: ", lpad(powerscount, 6))
println("Subtotal:", lpad(primecount + powerscount, 32))
println("The integer 1 has 0 prime factors: ", lpad(1, 6))
println("-"^41, "\n", "Overall total:", lpad(primecount + powerscount + 1, 27))
</syntaxhighlight>{{out}}
<pre>
Line 246 ⟶ 255:
└ ┘
Frequency
 
Check on breakdown:
Prime count to 1 million: 78498
Prime powers less than 1 million: 236
Subtotal: 78734
The integer 1 has 0 prime factors: 1
-----------------------------------------
Overall total: 78735
</pre>
 
=={{header|Pascal}}==
==={{header|Free Pascal}}===
4,105

edits