/** This is a solver for John Conway's "Digital Perfection" puzzle. See: https://www.quantamagazine.org/three-math-puzzles-inspired-by-john-horton-conway-20201015/ */ for [a,b,c,d,e,f,g,h,i,j] = array[0 to 9].permute[] { if parseInt["$a$b"] mod 2 == 0 if parseInt["$a$b$c"] mod 3 == 0 if parseInt["$a$b$c$d"] mod 4 == 0 if parseInt["$a$b$c$d$e"] mod 5 == 0 if parseInt["$a$b$c$d$e$f"] mod 6 == 0 if parseInt["$a$b$c$d$e$f$g"] mod 7 == 0 if parseInt["$a$b$c$d$e$f$g$h"] mod 8 == 0 if parseInt["$a$b$c$d$e$f$g$h$i"] mod 9 == 0 if parseInt["$a$b$c$d$e$f$g$h$i$j"] mod 10 == 0 println["$a $b $c $d $e $f $g $h $i $j"] }