primechain3.frink

Download or view primechain3.frink in plain text format

/** Generates right-truncatable primes */
nums = [1,3,5,7]

while length[nums] > 0
{
   nums2 = new array
   
   for n = nums
   {
      for p = [1,3,5,7,9]
      {
         n2 = parseInt["$n$p"]
         if isPrime[n2]
            nums2.push[n2]
      }
   }

   nums = nums2
   println[nums]
}
   
      


Download or view primechain3.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, eliasen@mindspring.com