RosettaCodeData/Task/100-doors/Fantom/100-doors-1.fantom
2023-07-01 13:44:08 -04:00

5 lines
199 B
Text

states := (1..100).toList
100.times |i| {
states = states.map |state| { state % (i+1) == 0 ? -state : +state }
}
echo("Open doors are " + states.findAll { it < 0 }.map { -it })