Skip to content

Instantly share code, notes, and snippets.

@vkotek
Last active January 5, 2016 11:49
Show Gist options
  • Save vkotek/0efbf1aaa433f1ffeade to your computer and use it in GitHub Desktop.
Save vkotek/0efbf1aaa433f1ffeade to your computer and use it in GitHub Desktop.
import itertools
# set test vars
yy = "1993"
mm = "05"
dd = "19"
# convert yyyy to yy
if len(str(yy)) == 4:
yy = yy[2:]
# join vars to get date part of RC
rc_a = yy + mm + dd
# set up list for RC results
rc_list = []
# Magic happens here
for i in itertools.product([str(i) for i in xrange(0,10)], repeat=3): # iterate through 000 to 999 as i
rc = rc_a + (''.join(i)) # join i to the current RC date
rem = str(int(rc) % 11) # divide by 11 and get remainder
if rem == "10": # if remainder is 10, make it 0
rem = "0"
rc = rc + "" + (rem) # add the remainder to the 9 digit RC
rc_list.append(rc) # add that shit to the list
print len(rc_list)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment