Numbers which are the cube roots of the product of their proper divisors: Difference between revisions
Numbers which are the cube roots of the product of their proper divisors (view source)
Revision as of 22:19, 30 September 2022
, 1 year ago→{{header|ALGOL 68}}: Tweak comments and add attribution to blurb
(→{{header|ALGOL 68}}: Massive simplification - no cubes, cube roots or proper divisor products are required - just the count of proper divisors will do...) |
(→{{header|ALGOL 68}}: Tweak comments and add attribution to blurb) |
||
Line 21:
=={{header|ALGOL 68}}==
<syntaxhighlight lang="algol68">
BEGIN # find some numbers which are the cube roots of the product of their #
Line 29:
# NB: numbers with 8 divisors have 7 proper divisors #
INT max number = 500 000; # maximum number we will consider #
# form a table of proper divisor counts - assume the pdc of 1 is 7
[ 1 : max number ]INT pdc; FOR i TO UPB pdc DO pdc[ i ] := 1 OD;
pdc[ 1 ] := 7;
Line 37:
# show the numbers which are the cube root of their proper divisor #
# product - equivalent to finding the numbers with a proper divisor #
# count of 7 ( we have "cheated" and set the pdc of 1 to 7
INT next show := 500;
INT c count := 0;
|