DigitalPerfection2.frink

Download or view DigitalPerfection2.frink in plain text format


/** 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]]
}


Download or view DigitalPerfection2.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 20217 days, 23 hours, 47 minutes ago.