Numbers which are the cube roots of the product of their proper divisors: Difference between revisions

→‎{{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}}==
UsesAs with the second Wren sample, uses the observation on the OEIS page to reduce the problem to finding numbers that are 1 or have 8 divisors (or 7 proper divisors).
<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;
3,048

edits