RosettaCodeData/Task/Gapful-numbers/Logo/gapful-numbers.logo
2023-07-01 13:44:08 -04:00

28 lines
616 B
Text

to bookend_number :n
output sum product 10 first :n last :n
end
to gapful? :n
output and greaterequal? :n 100 equal? 0 modulo :n bookend_number :n
end
to gapfuls_in_range :start :size
localmake "gapfuls []
do.while [
if (gapful? :start) [
make "gapfuls (lput :start gapfuls)
]
make "start sum :start 1
] [less? (count :gapfuls) :size]
output :gapfuls
end
to report_range :start :size
print (word "|The first | :size "| gapful numbers >= | :start "|:|)
print gapfuls_in_range :start :size
(print)
end
foreach [ [1 30] [1000000 15] [1000000000 10] ] [
apply "report_range ?
]