/** 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/
*/
OUTER:
for z = array[0 to 9].permute[]
{
n = 0
for i = 0 to 9
{
n = n + z@i
if n mod (i+1) != 0
next OUTER
n = 10 n
}
println[join[" ", z]]
}