GelfandsQuestion.frink

Download or view GelfandsQuestion.frink in plain text format


// Solver for "Gelfand'sQuestion"
// http://mathworld.wolfram.com/GelfandsQuestion.html

n=1
a = new array

while true
{
   a@0 = left[toString[2^n], 1]
   a@1 = left[toString[3^n], 1]
   a@2 = left[toString[4^n], 1]
   a@3 = left[toString[5^n], 1]
   a@4 = left[toString[6^n], 1]
   a@5 = left[toString[7^n], 1]
   a@6 = left[toString[8^n], 1]
   a@7 = left[toString[9^n], 1]

   j = join["", a]
   if j == "23456789"
      println["**** $n $j"]

   if length[toSet[a]] == 1
      println["**** $n $j"]
   
   n = n + 1
   if n mod 10000 == 0
      println[n]
}


Download or view GelfandsQuestion.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 20143 days, 9 hours, 46 minutes ago.