KaplinskyPuzzleSmall.frink

Download or view KaplinskyPuzzleSmall.frink in plain text format


/** Solver for a problem:

    https://twitter.com/robertkaplinsky/status/1057037622995009543
*/


a = array[1 to 9]
smallest = 1e100

for c = a.combinations[6]
   for p = c.permute[]
   {
      n = sqrt[p@0*100 + p@1*10 + p@2] - sqrt[p@3*10 + p@4] - sqrt[p@5]
      
      if abs[n] <= smallest
      {
         println["$p\t$n"]
         smallest = abs[n]
      }
   }


Download or view KaplinskyPuzzleSmall.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 20145 days, 18 hours, 46 minutes ago.