Minimal steps down to 1: Difference between revisions
→{{header|Perl 6}}: Reword slightly
Thundergnat (talk | contribs) (→{{header|Perl 6}}: Add a Perl 6 example) |
Thundergnat (talk | contribs) (→{{header|Perl 6}}: Reword slightly) |
||
Line 71:
my @max = %min.grep( {.value.<s> == $max} )».key.sort(+*);
say "\nDivisors: {@div.perl}, subtract: $sub, threshold: {comma $limit}\n" ~
"Below {comma $limit} found {+@max} number{+@max == 1 ?? '' !! 's'} " ~
"
for flat 1..10, @max -> $m {
Line 86:
}</lang>
{{out}}
<pre>Divisors: [2, 3], subtract: 1, threshold: 2,000
Below 2,000 found 16 numbers
(1) 0 steps:
(2) 1 steps: /2=>1
Line 115:
(1943) 14 steps: -1=>1942, /2=>971, -1=>970, /2=>485, -1=>484, /2=>242, /2=>121, -1=>120, /2=>60, /2=>30, /3=>10, -1=>9, /3=>3, /3=>1
Divisors: [2, 3], subtract: 1, threshold: 50,000
Below 50,000 found 3 numbers
(1) 0 steps:
(2) 1 steps: /2=>1
Line 131:
(38879) 22 steps: -1=>38878, /2=>19439, -1=>19438, /2=>9719, -1=>9718, /2=>4859, -1=>4858, /2=>2429, -1=>2428, /2=>1214, /2=>607, -1=>606, /2=>303, /3=>101, -1=>100, /2=>50, /2=>25, -1=>24, /2=>12, /2=>6, /2=>3, /3=>1
Divisors: [2, 3], subtract: 2, threshold: 2,000
Below 2,000 found 1 number
(1) 0 steps:
(2) 1 steps: /2=>1
Line 145:
(1699) 17 steps: -2=>1697, -2=>1695, /3=>565, -2=>563, -2=>561, /3=>187, -2=>185, -2=>183, /3=>61, -2=>59, -2=>57, /3=>19, -2=>17, -2=>15, /3=>5, -2=>3, /3=>1
Divisors: [2, 3], subtract: 2, threshold: 50,000
Below 50,000 found 1 number
(1) 0 steps:
(2) 1 steps: /2=>1
|