Thursday, May 19, 2016

How To Manually Install Python Modules Without pip and On A Windows Server Not Connected To The Internet

 

1) Download the modules to your laptop.

2) Copy the .tar.gz files to any temporary directory you created on the Windows server you are installing on.

3) Unzip. You will need to unzip twice as these files are Tar-ed and Zipped. You know you done it correctly when you see the folder structure and a file called setup.py.

4) Start a windows command window and CD down to the directory with setup.py.

5) Type: python setup.py install (do that for each module in their respective directory)

6) The install script will print out the status and indicate if the install was successful.

Thursday, February 11, 2016

Curious Sequence

 

On a college visit with my high school son to Rose Hullman in Terre Haute, IN  I picked up a copy of the schools’s alumni magazine.  The magazine had a section of brain teasers and logic problems written by Herb Bailey. One of the brain teasers was interesting to me since it was a challenge to write an algorithm to identify a specific number sequence called a “curious” sequence.    The brain teaser was as follows:

image

To solve this brain teaser I had to fully understand the rules of the sequence.   After analyzing the sequence, I had an idea that a curious sequence can be defined by two characteristics.  First the sequence equals n+1 when summed up.   So for n =3 for example, 2+0+2+0 = 4.   The second part is that each position reveals the number of digest in the sequence when referencing as an array with an index.    This is demonstrated below.

image

Notice how if the sequence is treated as an array and how each element of the array can be referenced by an index number.    So for the first element of the array when the index=0, the value is 2.   2 also represent the number of zeros present in the array.   Moving to the next element where the index=1 shows a value of 0.  Interesting enough there are zero 1s in the sequence of 2020.   Pretty clever to say the least! 

Now that I got a clearer understanding of the problem the question becomes, can algorithm can be created that can identify all curious sequences when n=4, but also when n=5, n=6, n=6….?    As it turns out it is very possible to develop an algorithm that will identify curious sequences in a linear time complexity.  I used Perl to impliment a solution. The results for n=3 to n=9 are shown below.

image