Skip to content

Instantly share code, notes, and snippets.

Created June 6, 2012 11:25
Show Gist options
  • Save anonymous/2881357 to your computer and use it in GitHub Desktop.
Save anonymous/2881357 to your computer and use it in GitHub Desktop.
Solution for Euler numbers
#!/bin/bash
################################################################################
# Copyright (c) 2011, by Michael Neale. All rights reserved.
#
# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MICHAEL NEALE
#
# The copyright notice above does not evidence any
# actual or intended publication of such source code.
################################################################################
if [ ! -f eulers ]; then
wget -q -O eulers http://oeis.org/A028296/b028296.txt
fi
if [ $(( $1 % 2 )) == 1 ]; then
echo 0
exit 0
fi
grep "^$(($1 / 2)) " eulers | awk '{print $2}'
if [ $? -ne 0 ]; then
echo "For additional results you will need to hire me!"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment