Skip to content

Instantly share code, notes, and snippets.

@jbcrail
Created July 29, 2010 02:31
Show Gist options
  • Save jbcrail/497069 to your computer and use it in GitHub Desktop.
Save jbcrail/497069 to your computer and use it in GitHub Desktop.
# Solution to http://www.futilitycloset.com/2010/07/28/quitting-time/
import math
# RUT must be between (317,999) or range of sqrt(six digit #)
# since T != R, last digit in T^2 cannot equal R
T = set([2,3,4,7,8,9])
# R is set of last digit in T^2 taking account of above range
R = set([4,6,9])
# U contains all digits
U = set(range(0, 10))
for i in R:
t = T if i not in T else T.difference(set([i]))
for j in t:
for k in U.difference(set([i,j])):
career = str((i*100 + k*10 + j) ** 2)
if career[2] == career[5] and career[3] == career[4]:
print "CAREER = %s" % (career)
print "RUT = %d" % (math.sqrt(int(career)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment