SHARE
TWEET

Arithmetic Golfing

a guest Sep 5th, 2017 177 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Python 2.7 code to find an arithmetic expression that results in an integer with certain properties.
  2. # Expression is used for golfing.
  3.  
  4. for a in range(10000):
  5.     for b in range(100):
  6.         s = str(a**b)
  7.         if len(s) >= 9 and s[0] == "1" and s[1] == "3"\
  8.         and s[3] == "2" and s[4] == "4" and s[6] == "5"\
  9.         and s[7] == "6" and s[8] == "0":
  10.             print "%s**%s = %s" % (a, b, s)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top