Radical of an integer: Difference between revisions

Content added Content deleted
(→‎{{header|Wren}}: Added a horizontal bar chart (inspired by Julia example) plus other minor tweaks.)
Line 323: Line 323:
Fmt.print(" $d: $,8d", i, counts[i])
Fmt.print(" $d: $,8d", i, counts[i])
}
}
System.print(" ---------")
Fmt.print(" ---------")
Fmt.print(" $,8d", Nums.sum(counts))
Fmt.print(" $,8d", Nums.sum(counts))
Fmt.print("\nor graphically:")
Nums.barChart("", 50, Nums.toStrings(1..7), counts[1..-1])
}
}
}
}
Line 338: Line 340:
}
}
}
}
System.print("\nFor primes or powers (>1) thereof <= 1,000,000:")
Fmt.print("\nFor primes or powers (>1) thereof <= 1,000,000:")
Fmt.print(" Number of primes = $,6d", pcount)
Fmt.print(" Number of primes = $,6d", pcount)
Fmt.print(" Number of powers = $,6d", ppcount)
Fmt.print(" Number of powers = $,6d", ppcount)
Fmt.print(" Add 1 for number 1 = $,6d", 1)
Fmt.print(" Add 1 for number 1 = $,6d", 1)
System.print(" ------")
Fmt.print(" ------")
Fmt.print(" $,6d", pcount + ppcount + 1)</syntaxhighlight>
Fmt.print(" $,6d", pcount + ppcount + 1)</syntaxhighlight>


Line 369: Line 371:
---------
---------
1,000,000
1,000,000

or graphically:

--------------------------------------------------
1 ■■■■■■■■ 78735
2 ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 288726
3 ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 379720
4 ■■■■■■■■■■■■■■■■■■■■■■ 208034
5 ■■■■ 42492
6 ◧ 2285
7 ◧ 8
--------------------------------------------------


For primes or powers (>1) thereof <= 1,000,000:
For primes or powers (>1) thereof <= 1,000,000:
Line 376: Line 390:
------
------
78,735
78,735

</pre>
</pre>