RosettaCodeData/Task/Gapful-numbers/Phix/gapful-numbers.phix
2026-02-01 16:33:20 -08:00

21 lines
608 B
Text

constant starts = {1e2, 1e6, 1e7, 1e9, 7123},
counts = {30, 15, 15, 10, 25}
for i=1 to length(starts) do
integer count = counts[i],
j = starts[i],
pow = 100
while j>=pow*10 do pow *= 10 end while
printf(1,"First %d gapful numbers starting at %,d: ", {count, j})
while count do
integer fl = floor(j/pow)*10 + remainder(j,10)
if remainder(j,fl)==0 then
printf(1,"%d ", j)
count -= 1
end if
j += 1
if j>=10*pow then
pow *= 10
end if
end while
printf(1,"\n")
end for