Jordan-Pólya numbers: Difference between revisions
Content added Content deleted
(added Raku programming solution) |
(→{{header|jq}}: indentation) |
||
Line 531: | Line 531: | ||
| until(.k > .mx or .t > $lim; |
| until(.k > .mx or .t > $lim; |
||
.t *= .k |
.t *= .k |
||
| if .t <= $lim |
|||
then reduce JordanPolya(($lim/.t)|floor; .t)[] as $rest (.; |
then reduce JordanPolya(($lim/.t)|floor; .t)[] as $rest (.; |
||
.v += [.t * $rest] ) |
.v += [.t * $rest] ) |
||
| .k += 1 |
| .k += 1 |
||
else . |
else . |
||
end) |
end) |
||
| .v |
| .v |
||
| unique |
| unique |
||
Line 564: | Line 564: | ||
| .m = (.m / .factorial[$i]) |
| .m = (.m / .factorial[$i]) |
||
| if .m == 1 then .emit = .f else . end) |
| if .m == 1 then .emit = .f else . end) |
||
| if .emit then ., break $out else . end) |
|||
| if .emit then .emit |
| if .emit then .emit |
||
elif .i == 2 then Decompose($n; .start-1) |
elif .i == 2 then Decompose($n; .start-1) |