As of August 16th, 2004, if you're going south on highway 101, just south of the Foster City exit you will see this cryptic billboard. It's a programming puzzle.

I found 'e' here
there is more discussion here
Here's my 'C' program I used to solve it. I used OpenSSL to check the primes. I'm sure it'd be cleaner in Python, and doing the fseek is a bit ugly, but this sucker finishes quicker than you can imagine anyway.

#include <stdio.h>
#include <openssl/bn.h>

int main(void)
{
   BIGNUM* my_num;
   int found = 0;
   int read_bytes;
   char this_read[11];
   FILE* input_file;

   input_file = fopen("e.txt", "r");

   if (input_file == NULL)
   {  printf("Failed!  Can't find or open the file.\n");
      return 1;
   }

   my_num = BN_new();

   while (1)
   {  if ( fread(this_read, 1, 10, input_file) < 10)
      {  break;
      }
      else
      {  this_read[10] = 0;
         BN_dec2bn(&my_num, this_read);

         if (BN_is_prime(my_num, 0, NULL, NULL, NULL))
         {  found = 1;
            break;
         }
         fseek(input_file, -9, SEEK_CUR);
   }  }

   BN_free(my_num);
   fclose(input_file);

   if (found)
   {  printf("%s is prime!\n", this_read);
   }
   else
   {  printf("no primes found\n");
   }
   found ^= 1;
   return found;
}

-- MattWalsh - 09 Aug 2004

Topic revision: r2 - 16 Aug 2004 - MattWalsh
 
This site is powered by the TWiki collaboration platformCopyright © 2008-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback