RosettaCodeData/Task/Almost-prime/Phix/almost-prime.phix
2026-02-01 16:33:20 -08:00

15 lines
393 B
Text

with javascript_semantics
sequence res = columnize({tagset(5)}) -- ie {{1},{2},{3},{4},{5}}
integer n = 2, found = 0
while found<50 do
integer l = length(prime_factors(n,true))
if l<=5 and length(res[l])<=10 then
res[l] &= n
found += 1
end if
n += 1
end while
string fmt = "k = %d: "&join(repeat("%4d",10))&"\n"
for i=1 to 5 do
printf(1,fmt,res[i])
end for