Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def findAB (c):
- c = c multiplied by 100
- for a in 0..9: # or possibly 1..9
- for b in 0..9:
- set ab to a multiplied by 10 plus b
- if (ab multiplied by ab) is equal to (c plus ab):
- return (a,b)
- return nothing
- c | a | b | ab | return
- -----+-----+-----+------+----------
- | | | |
- | | | |
- | | | |
- | | | |
- for a in range(1,10):
- for b in range(10):
- ab = a*10+b
- ab2 = ab*ab
- if (ab2 % 100) == ab:
- print "a=",a,", b = ",b
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement