Skip to content

Instantly share code, notes, and snippets.

@RSully
Created February 11, 2012 22:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RSully/1804815 to your computer and use it in GitHub Desktop.
Save RSully/1804815 to your computer and use it in GitHub Desktop.
6n ± 1
from math import floor
def pp(n):
return (6*(floor(n/2)+1)) + (-1 if n % 2 == 0 else 1)
for i in xrange(0, 50):
print "%d\t\t%d" % (i, pp(i))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment