DigitalPerfection.frink

Download or view DigitalPerfection.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/
*/


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"]
}


Download or view DigitalPerfection.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 19971 days, 15 hours, 29 minutes ago.